Skip to content

Instantly share code, notes, and snippets.

@teeli
Last active August 1, 2017 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teeli/3b178fce730c6a208a6b612fecf6f640 to your computer and use it in GitHub Desktop.
Save teeli/3b178fce730c6a208a6b612fecf6f640 to your computer and use it in GitHub Desktop.
Wuhu Docker Configuration

Docker configuration for Wuhu

https://github.com/Gargaj/wuhu

Requirements

  • Docker
  • Docker Compose

Install

  • Download / clone these files and add them to your Wuhu root dir
  • Apply config.php.patch: git apply config.php.patch
  • Run ./init.sh
  • Copy php.ini to ./config
  • Run docker-compose up
diff --git a/www_admin/config.php b/www_admin/config.php
index 3415187..1b634a8 100644
--- a/www_admin/config.php
+++ b/www_admin/config.php
@@ -140,7 +140,7 @@ function perform(&$msg) {
// end of checks
- SQLLib::$link = mysqli_connect("localhost",$_POST["mysql_username"],$_POST["mysql_password"],$_POST["mysql_database"]);
+ SQLLib::$link = mysqli_connect("mysql",$_POST["mysql_username"],$_POST["mysql_password"],$_POST["mysql_database"]);
if (mysqli_connect_errno(SQLLib::$link))
{
$msg = "Unable to connect to MySQL: ".mysqli_connect_error();
@@ -202,7 +202,7 @@ function perform(&$msg) {
for($x=0;$x<64;$x++) $salt.=chr(rand(0x30,0x7a));
$db =
"<"."?\n".
- "define('SQL_HOST','localhost');\n".
+ "define('SQL_HOST','mysql');\n".
"define('SQL_USERNAME',\"".addslashes($_POST["mysql_username"])."\");\n".
"define('SQL_PASSWORD',\"".addslashes($_POST["mysql_password"])."\");\n".
"define('SQL_DATABASE',\"".addslashes($_POST["mysql_database"])."\");\n".
@@ -217,7 +217,6 @@ function perform(&$msg) {
if ($_POST["admin_username"] && $_POST["admin_password"] ) {
$htaccess =
"AuthUserFile ".dirname($_SERVER["SCRIPT_FILENAME"])."/.htpasswd\n".
- "AuthGroupFile /dev/null\n".
"AuthName 'Wuhu Virtual Organizer Area - Enter password to continue'\n".
"AuthType Basic\n".
"\n".
version: '2'
services:
php:
build: .
image: wuhu:latest
expose:
- 9000
volumes:
- ./www_admin:/var/www/admin
- ./www_party:/var/www/party
- ./entries_private:/var/www/entries_private
- ./entries_public:/var/www/entries_public
- ./screenshots:/var/www/screenshots
admin:
image: webdevops/apache:latest
environment:
WEB_DOCUMENT_ROOT: /var/www/admin
WEB_ALIAS_DOMAIN: www.admin
WEB_PHP_SOCKET: php:9000
volumes:
- ./www_admin:/var/www/admin
- ./www_party:/var/www/party
- ./entries_private:/var/www/entries_private
- ./entries_public:/var/www/entries_public
- ./screenshots:/var/www/screenshots
ports:
- 8081:80
links:
- php
party:
image: webdevops/apache:latest
environment:
WEB_DOCUMENT_ROOT: /var/www/party
WEB_ALIAS_DOMAIN: www.party
WEB_PHP_SOCKET: php:9000
volumes:
- ./www_admin:/var/www/admin
- ./www_party:/var/www/party
- ./entries_private:/var/www/entries_private
- ./entries_public:/var/www/entries_public
- ./screenshots:/var/www/screenshots
ports:
- 8080:80
links:
- php
mysql:
image: mariadb:latest
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_DATABASE: wuhu
MYSQL_USER: wuhu
MYSQL_PASSWORD: wuhu
volumes:
- ./database:/var/lib/mysql
expose:
- 3306
FROM php:5.6-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt mysql mysqli \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
COPY config/php.ini /usr/local/etc/php/
#!/usr/bin/env bash
mkdir -p ./config
mkdir -p ./entries_private
mkdir -p ./entries_public
mkdir -p ./screenshots
chmod -R g+rw .
chmod -R a+rw .
# should be in config/php.ini
upload_max_filesize = 128M
post_max_size = 256M
memory_limit = 512M
session.gc_maxlifetime = 604800
short_open_tag = On
date.timezone = Europe/Helsinki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment