This is modification of the docker-compose.yml file that allows us to create multiple wordpress pages on one virtual machine. Each of the wordpress instancess has its own container and containerized database.
Https encryption is managed by Letsencrypt container. Certificates are being renewed automatically.
version: "2"
services:
nginx-proxy:
image: jwilder/nginx-proxy
container_name: proxy
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- /etc/nginx/vhost.d
- /home/coil/certs:/etc/nginx/certs:ro
- /usr/share/nginx/html
restart: always
networks:
- proxy_net
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy
#-----------------------------------------------------
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: encrypt
depends_on:
- nginx-proxy
volumes:
- /home/coil/certs:/etc/nginx/certs:rw
- /var/run/docker.sock:/var/run/docker.sock:ro
volumes_from:
- nginx-proxy
restart: always
networks:
- proxy_net
#-----------------------------------------------------
certs:
image: tutum/apache-php
container_name: certs
environment:
- VIRTUAL_HOST=tcoil.info,www.tcoil.info,vasulka.cz,www.vasulka.cz
- LETSENCRYPT_HOST=tcoil.info,www.tcoil.info,vasulka.cz,www.vasulka.cz
- LETSENCRYPT_EMAIL=michal.vasulka@gmail.com
restart: always
networks:
- cert_net
#-----------------------------------------------------
wordpress_vas_cz:
image: wordpress
container_name: wordpress_vas_cz
links:
- mariadb_vas_cz:mysql
environment:
- WORDPRESS_DB_PASSWORD=password
- VIRTUAL_HOST=vasulka.cz,www.vasulka.cz
ports:
- "3001:80"
depends_on:
- nginx-proxy
- letsencrypt
- mariadb_vas_cz
volumes:
- ./code_vas_cz:/code
- ./html_vas_cz:/var/www/html
restart: always
networks:
- proxy_net
mariadb_vas_cz:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE_4=wordpress_vas_cz
depends_on:
- nginx-proxy
- letsencrypt
volumes:
- ./database_vas_cz:/var/lib/mysql
restart: always
networks:
- proxy_net
#-----------------------------------------------------
#-----------------------------------------------------
# sonm_cloud is now tcoil_info website
wordpress_sonm_cloud:
image: wordpress
container_name: wordpress_sonm_cloud
links:
- mariadb_sonm_cloud:mysql
environment:
- WORDPRESS_DB_PASSWORD=password
- VIRTUAL_HOST=tcoil.info,www.tcoil.info
ports:
- "3000:80"
depends_on:
- nginx-proxy
- letsencrypt
- mariadb_sonm_cloud
volumes:
- ./code_sonm_cloud:/code
- ./html_sonm_cloud:/var/www/html
restart: always
networks:
- proxy_net
mariadb_sonm_cloud:
image: mariadb
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE_8=wordpress_sonm_cloud
depends_on:
- nginx-proxy
- letsencrypt
volumes:
- ./database_sonm_cloud:/var/lib/mysql
restart: always
networks:
- proxy_net
#-----------------------------------------------------
networks:
cert_net:
driver: bridge
proxy_net:
driver: bridge