Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This compose file runs a wordpress instance with 2 fpm and 2 nginx backend nodes, 1 varnish node and 1 nginx frontend node.
version: '2'
services:
memcached1:
image: memcached:latest
container_name: memcached1
hostname: memcached1
restart: always
networks:
- cache
db1:
image: mariadb:latest
container_name: db1
hostname: db1
restart: always
networks:
- database
volumes:
- ./.data/test.windegger.wtf/mysql:/var/lib/mysql:rw
environment:
MYSQL_ROOT_PASSWORD: YourSecurePassword
fpm1:
depends_on:
- db1
- memcached1
image: rwindegger/wordpress:latest
container_name: fpm1
hostname: fpm1
restart: always
networks:
- database
- cache
- php
links:
- db1:mysql
volumes:
- ./.data/test.windegger.wtf/storage:/var/www/html:rw
environment:
WORDPRESS_DB_PASSWORD: YourSecurePassword
WORDPRESS_DB_NAME: test
FPM_HOST: php
fpm2:
depends_on:
- db1
- memcached1
image: rwindegger/wordpress:latest
container_name: fpm2
hostname: fpm2
restart: always
networks:
- database
- cache
- php
links:
- db1:mysql
volumes:
- ./.data/test.windegger.wtf/storage:/var/www/html:rw
environment:
WORDPRESS_DB_PASSWORD: YourSecurePassword
WORDPRESS_DB_NAME: test
FPM_HOST: php
nginx1:
image: rwindegger/nginx-backend:latest
container_name: nginx1
hostname: nginx1
restart: always
links:
- fpm1:php
- fpm2:php
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./.data/test.windegger.wtf/storage:/var/www/html:ro
networks:
- php
- backend
environment:
BACKEND_HOST: nginx1
nginx2:
image: rwindegger/nginx-backend:latest
container_name: nginx2
hostname: nginx2
restart: always
links:
- fpm1:php
- fpm2:php
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./.data/test.windegger.wtf/storage:/var/www/html:ro
networks:
- php
- backend
environment:
BACKEND_HOST: nginx2
varnish1:
image: rwindegger/varnish
container_name: varnish1
hostname: varnish1
restart: always
links:
- nginx1:backend
- nginx2:backend
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- backend
- frontend
environment:
VIRTUAL_HOST: test.windegger.wtf
dbm1:
depends_on:
- db1
image: phpmyadmin/phpmyadmin:latest
container_name: dbm1
hostname: dbm1
restart: always
networks:
- database
- frontend
links:
- db1:db
environment:
VIRTUAL_HOST: dbm.test.windegger.wtf
frontend1:
image: rwindegger/nginx-frontend:latest
container_name: frontend1
hostname: frontend1
restart: always
networks:
- frontend
ports:
- 80:80
- 443:443
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./.data/frontend/certs:/opt/certs"
- "./.data/frontend/htpasswd:/opt/nginx/conf/htpasswd"
- "./.data/frontend/vhost.d:/opt/nginx/conf/vhost.d"
networks:
database:
driver: bridge
cache:
driver: bridge
php:
driver: bridge
backend:
driver: bridge
frontend:
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.