From 118e43c1446a8a476bcb67b6a1c49f66a91bbfc3 Mon Sep 17 00:00:00 2001 From: Chingis Sandanov Date: Mon, 3 Jul 2017 19:01:12 +0700 Subject: [PATCH] Release 2.2.0 --- CHANGELOG.md | 21 ++++++++++ README.md | 30 ++++++++------ docker-compose.yml | 79 ++++++++++++++++++++++++++++-------- docs/containers/apache.md | 7 ++++ docs/containers/athenapdf.md | 13 ++++++ docs/containers/mariadb.md | 4 +- docs/containers/nginx.md | 7 +++- docs/containers/php.md | 7 ++-- docs/containers/redis.md | 4 +- docs/containers/varnish.md | 4 +- docs/domains.md | 15 ++++--- docs/index.md | 32 +++++++++------ docs/logs.md | 8 ++++ docs/macos.md | 28 +++++++++---- docs/multiple-projects.md | 42 +++++++++++++++---- docs/permissions.md | 11 +++++ mkdocs.yml | 2 + 17 files changed, 239 insertions(+), 75 deletions(-) create mode 100644 docs/containers/apache.md create mode 100644 docs/containers/athenapdf.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ea545d7a4..bd9e45271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Docker4WordPress Changelog +## 2.2.0 + +* New [Apache 2.4 container](http://docs.docker4wordpress.org/en/latest/containers/apache) +* New [AthenaPDF container](http://docs.docker4wordpress.org/en/latest/containers/athenapdf), drop-in replacement for wkhtmltopdf +* WordPress: updated Vanilla WordPress 4.8 +* PHP: updated PHP 7: 7.0.20, 7.1.6 +* PHP: images rebased to Alpine Linux 3.6 and now use LibreSSL instead of OpenSSL +* PHP: extension are now frozen, see https://github.com/wodby/php +* PHP: runtime libraries are now frozen +* PHP: mongoDB extension downgraded to 1.1.10 +* PHP: expose header now disabled by default +* PHP: dropped few environment variables +* PHP: APCu extension is now configurable +* Nginx: new version 1.13, 1.12 +* Nginx: 1.10 dropped +* Nginx: you can now override include of wordpress.conf file +* MariaDB: revamped optimized configuration +* Bug fix: resolved imagick segfault caused by a bug in ImageMagick library +* Bug fix: some environment variables missed in SSH container +* [New way](http://docs.docker4wordpress.org/en/latest/macos) to improve volumes performance on macOS] via user-guided caching + ## 2.1.0 * New 2.1.0 images for php, nginx, mariadb, redis and varnish diff --git a/README.md b/README.md index a16f78f58..6c77b24ba 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Docker-based WordPress stack +# Docker-based WordPress Stack [![Documentation Status](https://readthedocs.org/projects/docker4wordpress/badge/?version=latest)](http://docs.docker4wordpress.org) [![Build Status](https://travis-ci.org/wodby/docker4wordpress.svg?branch=master)](https://travis-ci.org/wodby/docker4wordpress) @@ -14,28 +14,34 @@ Read [**Getting Started**](http://docs.docker4wordpress.org/en/latest/). ## Stack [wodby/wordpress-nginx]: https://github.com/wodby/wordpress-nginx +[wodby/wordpress-apache]: https://github.com/wodby/wordpress-apache [wodby/wordpress]: https://github.com/wodby/wordpress [wodby/wordpress-php]: https://github.com/wodby/wordpress-php [wodby/mariadb]: https://github.com/wodby/mariadb [wodby/redis]: https://github.com/wodby/redis [wodby/wordpress-varnish]: https://github.com/wodby/wordpress-varnish -[phpmyadmin/phpmyadmin]: https://hub.docker.com/r/phpmyadmin/phpmyadmin -[mailhog/mailhog]: https://hub.docker.com/r/mailhog/mailhog +[athenapdf-service]: https://hub.docker.com/r/arachnysdocker/athenapdf-service +[phpmyadmin]: https://hub.docker.com/r/phpmyadmin/phpmyadmin +[mailhog]: https://hub.docker.com/r/mailhog/mailhog +[portainer]: https://hub.docker.com/r/portainer/portainer [_/traefik]: https://hub.docker.com/_/traefik The WordPress stack consist of the following containers: | Container | Versions | Service name | Image | Enabled by default | | --------- | -------- | ------------ | ----- | ------------------ | -| Nginx | 1.10 | nginx | [wodby/wordpress-nginx] | ✓ | -| WordPress | 4 | php | [wodby/wordpress] | ✓ | -| PHP | 7.0, 7.1 | php | [wodby/wordpress-php] | | -| MariaDB | 10.1 | mariadb | [wodby/mariadb] | ✓ | -| Redis | 3.2 | redis | [wodby/redis] | | -| Varnish | 4.1 | varnish | [wodby/wordpress-varnish] | | -| phpMyAdmin | latest | pma | [phpmyadmin/phpmyadmin] | | -| Mailhog | latest | mailhog | [mailhog/mailhog] | ✓ | -| Traefik | latest | traefik | [_/traefik] | ✓ | +| Nginx | 1.13, 1.12 | nginx | [wodby/wordpress-nginx] | ✓ | +| Apache | 2.4 | php | [wodby/wordpress-apache] | | +| WordPress | 4 | php | [wodby/wordpress] | ✓ | +| PHP | 7.1, 7.0 | php | [wodby/wordpress-php] | | +| MariaDB | 10.1 | mariadb | [wodby/mariadb] | ✓ | +| Redis | 3.2 | redis | [wodby/redis] | | +| Varnish | 4.1 | varnish | [wodby/wordpress-varnish] | | +| AthenaPDF | latest | athenapdf | [athenapdf-service] | | +| phpMyAdmin | latest | pma | [phpmyadmin] | | +| Mailhog | latest | mailhog | [mailhog] | ✓ | +| Portainer | latest | portainer | [portainer] | ✓ | +| Traefik | latest | traefik | [_/traefik] | ✓ | Supported WordPress versions: 4 diff --git a/docker-compose.yml b/docker-compose.yml index 073b1399a..db256ee8a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "2" services: mariadb: - image: wodby/mariadb:10.1-2.1.0 + image: wodby/mariadb:10.1-2.3.3 environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: wordpress @@ -13,10 +13,10 @@ services: # - /path/to/mariadb/data/on/host:/var/lib/mysql # I want to manage volumes manually. php: - image: wodby/wordpress:4-7.1-2.1.0 -# image: wodby/wordpress:4-7.0-2.1.0 -# image: wodby/wordpress-php:7.0-2.1.0 -# image: wodby/wordpress-php:7.1-2.1.0 + image: wodby/wordpress:4-7.1-2.2.0 +# image: wodby/wordpress:4-7.0-2.2.0 +# image: wodby/wordpress-php:7.0-2.2.0 +# image: wodby/wordpress-php:7.1-2.2.0 environment: PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025 # PHP_XDEBUG: 1 @@ -25,27 +25,50 @@ services: # PHP_XDEBUG_REMOTE_HOST: "10.254.254.254" # You will also need to 'sudo ifconfig lo0 alias 10.254.254.254' volumes: - codebase:/var/www/html -# - docker-sync:/var/www/html # Docker-sync for macOS users +# Options for macOS users (http://docs.docker4wordpress.org/en/latest/macos) +# - codebase:/var/www/html:cached # User-guided caching +# - docker-sync:/var/www/html # Docker-sync - nginx: - image: wodby/wordpress-nginx:4-1.10-2.1.0 +# nginx: +# image: wodby/wordpress-nginx:4-1.13-2.2.0 +## image: wodby/wordpress-nginx:4-1.12-2.2.0 +# environment: +# NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off" +# NGINX_ERROR_LOG_LEVEL: debug +# NGINX_BACKEND_HOST: php +# NGINX_SERVER_ROOT: /var/www/html +# volumes: +# - codebase:/var/www/html +## Options for macOS users (http://docs.docker4wordpress.org/en/latest/macos) +## - codebase:/var/www/html:cached # User-guided caching +## - docker-sync:/var/www/html # Docker-sync +# depends_on: +# - php +# labels: +# - 'traefik.backend=nginx' +# - 'traefik.port=80' +# - 'traefik.frontend.rule=Host:wp.docker.localhost' + + apache: + image: wodby/wordpress-apache:2.4-1.0.0 + depends_on: + - php environment: - NGINX_STATIC_CONTENT_OPEN_FILE_CACHE: "off" - NGINX_ERROR_LOG_LEVEL: debug - NGINX_BACKEND_HOST: php - NGINX_SERVER_ROOT: /var/www/html/ + APACHE_LOG_LEVEL: debug + APACHE_BACKEND_HOST: php + APACHE_SERVER_ROOT: /var/www/html volumes: - codebase:/var/www/html -# - docker-sync:/var/www/html # Docker-sync for macOS users - depends_on: - - php +# Options for macOS users (http://docs.docker4wordpress.org/en/latest/macos) +# - codebase:/var/www/html:cached # User-guided caching +# - docker-sync:/var/www/html # Docker-sync labels: - - 'traefik.backend=nginx' + - 'traefik.backend=apache' - 'traefik.port=80' - 'traefik.frontend.rule=Host:wp.docker.localhost' # varnish: -# image: wodby/wordpress-varnish:4.1-2.1.0 +# image: wodby/wordpress-varnish:4.1-2.2.0 # depends_on: # - nginx # environment: @@ -58,7 +81,7 @@ services: # - 'traefik.frontend.rule=Host:varnish.wp.docker.localhost' # redis: -# image: wodby/redis:3.2-2.1.0 +# image: wodby/redis:3.2-2.1.1 # pma: # image: phpmyadmin/phpmyadmin @@ -73,6 +96,16 @@ services: # - 'traefik.port=80' # - 'traefik.frontend.rule=Host:pma.wp.docker.localhost' +# athenapdf: +# image: arachnysdocker/athenapdf-service +# environment: +# WEAVER_AUTH_KEY: weaver-auth-key +# WEAVER_ATHENA_CMD: "athenapdf -S" +# WEAVER_MAX_WORKERS: 10 +# WEAVER_MAX_CONVERSION_QUEUE: 50 +# WEAVER_WORKER_TIMEOUT: 90 +# WEAVER_CONVERSION_FALLBACK: false + mailhog: image: mailhog/mailhog labels: @@ -80,6 +113,16 @@ services: - 'traefik.port=8025' - 'traefik.frontend.rule=Host:mailhog.wp.docker.localhost' + portainer: + image: portainer/portainer + command: --no-auth + volumes: + - /var/run/docker.sock:/var/run/docker.sock + labels: + - 'traefik.backend=portainer' + - 'traefik.port=9000' + - 'traefik.frontend.rule=Host:portainer.wp.docker.localhost' + traefik: image: traefik command: -c /dev/null --web --docker --logLevel=INFO diff --git a/docs/containers/apache.md b/docs/containers/apache.md new file mode 100644 index 000000000..4bcf45ee1 --- /dev/null +++ b/docs/containers/apache.md @@ -0,0 +1,7 @@ +# Apache container + +To set apache as a default container uncomment apache service definition and comment nginx service definition. + +## Configuration + +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/wodby/wordpress-apache). diff --git a/docs/containers/athenapdf.md b/docs/containers/athenapdf.md new file mode 100644 index 000000000..ea68566f8 --- /dev/null +++ b/docs/containers/athenapdf.md @@ -0,0 +1,13 @@ +# AthenaPDF container + +AthenaPDF is a drop-in replacement for wkhtmltopdf + +Usage: + +```bash +$ curl http://athenapdf:8080/convert\?auth\=wodby-athenapdf\&url\=http://google.com/ |> out.pdf +``` + +## Configuration + +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/arachnys/athenapdf/blob/master/weaver/conf/sample.env). \ No newline at end of file diff --git a/docs/containers/mariadb.md b/docs/containers/mariadb.md index b0b75ae25..3659c43fd 100644 --- a/docs/containers/mariadb.md +++ b/docs/containers/mariadb.md @@ -25,6 +25,6 @@ Exporting a specific database: docker-compose exec mariadb sh -c 'exec mysqldump -uroot -p"root-password" my-db' > my-db.sql ``` -## Customization +## Configuration -See the list of environment variables available for customization at [wodby/mariadb](https://github.com/wodby/mariadb). +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/wodby/mariadb). diff --git a/docs/containers/nginx.md b/docs/containers/nginx.md index 6bfde034d..e8a211f0b 100644 --- a/docs/containers/nginx.md +++ b/docs/containers/nginx.md @@ -1,5 +1,8 @@ # Nginx container -Nginx is being used as a web server. +Nginx is being used as a default http server. -See the list of environment variables available for customization at [wodby/wordpress-nginx](https://github.com/wodby/wordpress-nginx). +## Configuration + +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/wodby/wordpress-nginx). + diff --git a/docs/containers/php.md b/docs/containers/php.md index 4fdb01598..f683a68a0 100644 --- a/docs/containers/php.md +++ b/docs/containers/php.md @@ -29,7 +29,7 @@ If you would like to autostart xdebug, uncomment this line: PHP_XDEBUG_REMOTE_AUTOSTART: 1 # Comment out to disable (default). ``` -### Xdebug on Mac OS X +### Xdebug on macOS There are two more things that need to be done on macOS in order to have Xdebug working (because there's no docker0 interface). Enable Xdebug as described in the previous section and uncomment the following two lines: @@ -43,6 +43,7 @@ You also need to have loopback alias with IP from above. You need this only once ```bash sudo ifconfig lo0 alias 10.254.254.254 ``` + ### Xdebug on Windows You should do same things as for Mac OS. Enable Xdebug as described in the previous 2 sections and replace value of _PHP_XDEBUG_REMOTE_HOST_ to your DockerNAT ip assigned (by default it should be 10.0.75.1): @@ -53,6 +54,6 @@ PHP_XDEBUG_REMOTE_HOST: "10.0.75.1" # Setting the host (localhost by default) You also need to check firewall not to block your connection. Disabling firewall should help. -## Customization +## Configuration -See the list of environment variables available for customization at [wodby/wordpress-php](https://github.com/wodby/wordpress-php). +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/wodby/wordpress-php). diff --git a/docs/containers/redis.md b/docs/containers/redis.md index 3d597aacd..ff9e92c7f 100644 --- a/docs/containers/redis.md +++ b/docs/containers/redis.md @@ -13,6 +13,6 @@ define('WP_REDIS_HOST', 'redis'); define('WP_REDIS_PORT', '6379'); ``` -## Customization +## Configuration -You can find more information about redis configuration on [wodby/redis](https://github.com/wodby/redis). \ No newline at end of file +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/wodby/redis). \ No newline at end of file diff --git a/docs/containers/varnish.md b/docs/containers/varnish.md index 11b208ad2..a484b0711 100644 --- a/docs/containers/varnish.md +++ b/docs/containers/varnish.md @@ -2,6 +2,6 @@ TBD -See https://docs.wodby.com/bundles/containers/varnish.html +## Configuration -You can find more information about Varnish configuration and actions on [wodby/wordpress-varnish](https://github.com/wodby/wordpress-varnish). \ No newline at end of file +Configuration is possible via environment variables. See the full list of variables on [GitHub](https://github.com/wodby/wordpress-varnish). \ No newline at end of file diff --git a/docs/domains.md b/docs/domains.md index f5470dd29..859ad3a8a 100644 --- a/docs/domains.md +++ b/docs/domains.md @@ -4,11 +4,14 @@ Docker4WordPress uses [traefik](https://hub.docker.com/_/traefik/) container for Default domains: -| Service | Domain | -| ------- | ------ | -| nginx | [http://wp.docker.localhost:8000](http://wp.docker.localhost:8000) | -| pma | [http://pma.wp.docker.localhost:8000](http://pma.wp.docker.localhost:8000) | -| mailhog | [http://mailhog.wp.docker.localhost:8000](http://mailhog.wp.docker.localhost:8000) | -| varnish | [http://varnish.wp.docker.localhost:8000](http://varnish.wp.docker.localhost:8000) | +| Service | Domain | +| ------- | ------ | +| nginx/apache | [http://wp.docker.localhost:8000](http://wp.docker.localhost:8000) | +| pma | [http://pma.wp.docker.localhost:8000](http://pma.wp.docker.localhost:8000) | +| mailhog | [http://mailhog.wp.docker.localhost:8000](http://mailhog.wp.docker.localhost:8000) | +| varnish | [http://varnish.wp.docker.localhost:8000](http://varnish.wp.docker.localhost:8000) | +| portainer | [http://portainer.wp.docker.localhost:8000](http://portainer.wp.docker.localhost:8000) | You can customize domains under labels definition, e.g. `traefik.frontend.rule=Host:mailhog.wp.docker.localhost`. Note: if domains end with `docker.localhost` you don't need to add records to /etc/hosts file + +> IMPORTANT: you might need to add *.docker.localhost domains manually to your /etc/hosts file diff --git a/docs/index.md b/docs/index.md index e1556af95..a23b411fb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,26 +9,32 @@ Docker4WordPress is designed to be used for local development, if you're looking The WordPress stack consist of the following containers: [wodby/wordpress-nginx]: https://github.com/wodby/wordpress-nginx +[wodby/wordpress-apache]: https://github.com/wodby/wordpress-apache [wodby/wordpress]: https://github.com/wodby/wordpress [wodby/wordpress-php]: https://github.com/wodby/wordpress-php [wodby/mariadb]: https://github.com/wodby/mariadb [wodby/redis]: https://github.com/wodby/redis [wodby/wordpress-varnish]: https://github.com/wodby/wordpress-varnish -[phpmyadmin/phpmyadmin]: https://hub.docker.com/r/phpmyadmin/phpmyadmin -[mailhog/mailhog]: https://hub.docker.com/r/mailhog/mailhog +[athenapdf-service]: https://hub.docker.com/r/arachnysdocker/athenapdf-service +[phpmyadmin]: https://hub.docker.com/r/phpmyadmin/phpmyadmin +[mailhog]: https://hub.docker.com/r/mailhog/mailhog +[portainer]: https://hub.docker.com/r/portainer/portainer [_/traefik]: https://hub.docker.com/_/traefik | Container | Versions | Service name | Image | Enabled by default | | --------- | -------- | ------------ | ----- | ------------------ | -| [Nginx](containers/nginx.md) | 1.10 | nginx | [wodby/wordpress-nginx] | ✓ | -| WordPress | 4 | php | [wodby/wordpress] | ✓ | -| [PHP](containers/php.md) | 7.0, 7.1 | php | [wodby/wordpress-php] | | -| [MariaDB](containers/mariadb.md) | 10.1 | mariadb | [wodby/mariadb] | ✓ | -| [Redis](containers/redis.md) | 3.2 | redis | [wodby/redis] | | -| [Varnish](containers/varnish.md) | 4.1 | varnish | [wodby/wordpress-varnish] | | -| phpMyAdmin | latest | pma | [phpmyadmin/phpmyadmin] | | -| Mailhog | latest | mailhog | [mailhog/mailhog] | ✓ | -| Traefik | latest | traefik | [_/traefik] | ✓ | +| [Nginx](containers/nginx.md) | 1.13, 1.12 | nginx | [wodby/wordpress-nginx] | ✓ | +| [Apache](containers/apache.md) | 2.4 | php | [wodby/wordpress-apache] | | +| WordPress | 4 | php | [wodby/wordpress] | ✓ | +| [PHP](containers/php.md) | 7.1, 7.0 | php | [wodby/wordpress-php] | | +| [MariaDB](containers/mariadb.md) | 10.1 | mariadb | [wodby/mariadb] | ✓ | +| [Redis](containers/redis.md) | 3.2 | redis | [wodby/redis] | | +| [Varnish](containers/varnish.md) | 4.1 | varnish | [wodby/wordpress-varnish] | | +| [AthenaPDF](containers/athenapdf.md) | latest | athenapdf | [athenapdf-service] | | +| phpMyAdmin | latest | pma | [phpmyadmin] | | +| Mailhog | latest | mailhog | [mailhog] | ✓ | +| Portainer | latest | portainer | [portainer] | ✓ | +| Traefik | latest | traefik | [_/traefik] | ✓ | Supported WordPress versions: 4 @@ -53,19 +59,21 @@ There 2 options how to use docker4wordpress – you can either run [vanilla](htt 2. Run containers: `docker-compose up -d` 3. Wait a few seconds for containers initialization 4. That's it! Proceed with WordPress installation at [http://wp.docker.localhost:8000](http://wp.docker.localhost:8000). Default database user, password and database name are all `wordpress`, database host is `mariadb` +5. You can see status of your containers and their logs via portainer: [http://portainer.wp.docker.localhost:8000](http://portainer.wp.docker.localhost:8000) ### 2. Mount my WordPress Codebase 0. Read [must know before you start](#must-know-before-you-start) 1. Download [docker-compose.yml file](https://github.com/wodby/docker4wordpress/blob/master/docker-compose.yml) to your WordPress project root 2. Replace php image from `wodby/wordpress` (PHP + vanilla WordPress) to `wodby/wordpress-php` (just PHP) -3. Update _nginx_ and _php_ volumes to `- ./:/var/www/html` to mount your codebase +3. Update _nginx/apache_ and _php_ volumes to `- ./:/var/www/html` to mount your codebase 4. Ensure your wp-config.php has the same credentials as _mariadb_ service 5. Optional: [import existing database](containers/mariadb.md#import-existing-database) 7. Optional: uncomment lines in the compose file to run _redis_, _varnish_, _phpmyadmin (pma)_ 8. Optional: [customize domains](domains.md) 9. Run containers: `docker-compose up -d` 10. That's it! Your WordPress website should be up and running at [http://wp.docker.localhost:8000](http://wp.docker.localhost:8000). If you need to run multiple projects simultaneously see [this article](multiple-projects.md) +11. You can see status of your containers and their logs via portainer: [http://portainer.wp.docker.localhost:8000](http://portainer.wp.docker.localhost:8000) You can stop containers by executing: ```bash diff --git a/docs/logs.md b/docs/logs.md index 8b674f253..1a65dc884 100644 --- a/docs/logs.md +++ b/docs/logs.md @@ -1,3 +1,11 @@ +# Containers Logs + +## GUI + +You can find containers logs from portainer UI: [http://portainer.wp.docker.localhost:8000](http://portainer.wp.docker.localhost:8000) + +## CLI + To get logs from a container simply run (skip the last param to get logs form all the containers): ``` $ docker-compose logs [service] diff --git a/docs/macos.md b/docs/macos.md index 12229bac8..288fd1732 100644 --- a/docs/macos.md +++ b/docs/macos.md @@ -1,4 +1,18 @@ -To fix Docker [poor performance](https://github.com/Wodby/docker4wordpress/issues/4) on macOS (OS X) use the following workaround based on [docker-sync project](https://github.com/EugenMayer/docker-sync/). The core idea is to replace a standard slow volume with a file synchronizer tool. +# Docker for Mac Performance + +There 2 ways how can improve performance of docker volumes on macOS: + +## 1. User-guided Caching + +Since Docker for Mac 17.06 there's a new `:cached` option available for volumes. You can find more information about this in [docker blog](https://blog.docker.com/2017/05/user-guided-caching-in-docker-for-mac/). + +### Usage + +Replace _codebase_ volume definition of _php_ and _nginx_/_apache_ services with the option below marked as "User-guided caching". + +## 2. Docker-sync + +The core idea of this project is to use an external volume that will sync your files with a file synchronizer tool. ### Installation @@ -9,14 +23,10 @@ $ gem install docker-sync ### Usage 1. Uncomment _docker-sync_ volume definition in your compose file -2. Replace volume for _php_ container to _docker-sync_ (uncomment and delete the current one) -3. Start the synchronization with `docker-sync start` and let docker-sync run in the background +2. Replace _volumes_ definition of _php_ and _nginx_/_apache_ services with the option below marked as "Docker-sync". +3. Start docker-sync: `docker-sync start` 4. In a new shell run after you started docker-sync `docker-compose up -d` -Alternatively to docker-sync start you can do it all in one step - -run `docker-sync-stack start` to start sync services and docker-compose at the same time - -Now when you change your code and it will all end up in php and nginx containers. +Now when you change your code on the host machine docker-sync will sync your data to php and nginx/apache containers. -For more information visit [docker-sync project page](https://github.com/EugenMayer/docker-sync/). \ No newline at end of file +For more information visit [docker-sync project page](https://github.com/EugenMayer/docker-sync/). diff --git a/docs/multiple-projects.md b/docs/multiple-projects.md index da2144a03..310b94847 100644 --- a/docs/multiple-projects.md +++ b/docs/multiple-projects.md @@ -1,12 +1,40 @@ -# Running Multiple Projects with Docker4WordPress +# Running Multiple Projects with Træfik -Follow these instructions to run multiple projects simultaneously: +[Træfik](https://docs.traefik.io/) is a modern HTTP reverse proxy and load balancer made to deploy microservices with ease. +To understand the basics of Traefik it is suggested to check Træfik's documentation page: https://docs.traefik.io/ + + + +Image: Multi-domain set-up example +(Source: traefik.io) + +## Steps to set up two projects on one host ## + +1. Create two dirs where you will host two projects. Let's name them "site1" and "site2". +2. Copy docker-compose.yml file to both dirs (site1 and site2). +3. Copy traefik.yml to the parent dir where site1 and site2 dirs are. +4. Edit traefik.yml and change "project1-dir_default" to "**site1_default**" and "project2-dir_default" to "**site2_default**". Those are docker networks names that are created automatically from the dir name where docker-compose.yml is located. +5. Edit site1's docker-compose.yml file. There are 3 main things that need to be done there: + - In nginx service, under labels, change 'traefik.backend=nginx' to '**traefik.backend=site1_nginx_1**'. This is the name of the container. You can see that under NAMES when your have the containers running by executing "docker ps". + - Change traefik.frontend.rule from "Host:wp.docker.localhost" to "**Host:site1.docker.localhost**" + - Comment out (#) all lines of "traefik" service at the bottom of the file. +6. Make similar 3 changes in site2's docker-compose.yml file: + - 'traefik.backend=nginx' to '**traefik.backend=site2_nginx_1**' + - "Host:wp.docker.localhost" to "**Host:site2.docker.localhost**" + - Comment out (#) all lines of "traefik" service at the bottom of the file. +7. Run `docker-compose up -d` in site1 and site2 dirs to spin up containers for both projects. +8. Run stand-alone traefik `docker-compose -f traefik.yml up -d` to spin up traefik reverse proxy. +9. Visit http://site1.docker.localhost and http://site2.docker.localhost in your broswer. + +This set up also works for other Docker projects (non WordPress and non docker4wordpress based). You can replace nginx-proxy config with Traefik and get other projects all routed with on traefik container. + +## Problems? ## + +- Check `docker ps` to see which containers are running and check if you have set up all names correctly. +- Check `docker network ls` to check if the network names are matching. +- Run `docker-compose logs -f` in site1 or site2 to see the log of each project. -1. Run your docker-compose file and execute `docker ps`. Use values from last column NAMES to replace corresponding `traefik.backend` labels in the compose file (e.g. `projectdir_nginx_1` instead of `nginx`) -2. Remove traefik definition from your compose file, we will run it stand-alone -3. Download `traefik.yml` from docker4wordpress repository, replace example network names to your own (e.g. `projectdir_default` instead of `project1-dir_default`) -4. Run stand-alone traefik `docker-compose -f traefik.yml up -d` ## Additional for macOS users with docker-sync: -Names of `syncs` in docker-sync.yml file must be unique per project. The recommended way is to run stand-alone docker-sync with syncs definition for all projects. Do not forget to update `src` paths for projects. \ No newline at end of file +Names of `syncs` in docker-sync.yml file must be unique per project. The recommended way is to run stand-alone docker-sync with syncs definition for all projects. Do not forget to update `src` paths for projects. diff --git a/docs/permissions.md b/docs/permissions.md index cf135df5e..cfb138ac3 100644 --- a/docs/permissions.md +++ b/docs/permissions.md @@ -11,6 +11,17 @@ sudo groupadd -r -g 82 alpine-www-data sudo usermod -a -G alpine-www-data $(id -un) ``` +Another solution is to use ACL mechanism, available on most of Linux distributions. + +It's available by default on Ubuntu, with ext4 filesystem (starting from 14.04 version). +If you need more information, how to enable it on your Linux distribution, please check https://help.ubuntu.com/community/FilePermissionsACLs document. + +```bash +sudo setfacl -dR -m u:$(whoami):rwX -m u:82:rwX -m u:100:rX path_to_shared_volume +sudo setfacl -R -m u:$(whoami):rwX -m u:82:rwX -m u:100:rX path_to_shared_volume +``` +Code above will make sure that both your current user and php-fpm have full permissions to all files, and nginx worker has read-only access to all files in workspace. + ## macOS On macOS group with 82 already exists (_clamav). diff --git a/mkdocs.yml b/mkdocs.yml index ac27c1e71..0fa90ab6d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -19,7 +19,9 @@ pages: - Using In Production: 'production.md' - Containers: - 'Nginx': 'containers/nginx.md' + - 'Apache': 'containers/apache.md' - 'PHP': 'containers/php.md' - 'MariaDB': 'containers/mariadb.md' - 'Redis': 'containers/redis.md' - 'Varnish': 'containers/varnish.md' + - 'AthenaPDF': 'containers/athenapdf.md'