Commit 9b37dac4 authored by Michael Iseard's avatar Michael Iseard
Browse files

Switch from traefik to nginx proxy manager and add portainer

parent 9d15c6ee
.env
logs/
mysql/
wordpress-db/
wordpress/
proxy-db
proxy
version: '3'
networks:
web:
external: true
services:
wordpress:
......@@ -16,15 +12,15 @@ services:
networks:
- default
depends_on:
- db
- wordpress-db
volumes:
- ${WORDPRESS_DIR:-./wordpress}:/var/www/html/
environment:
WORDPRESS_DB_NAME: ${MYSQL_DATABASE:-wordpress}
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX:-wp_}
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: ${MYSQL_USER:-root}
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD:-password}
WORDPRESS_DB_NAME: ${WDB_DATABASE}
WORDPRESS_TABLE_PREFIX: ${WORDPRESS_TABLE_PREFIX}
WORDPRESS_DB_HOST: wordpress-db
WORDPRESS_DB_USER: ${WDB_USER}
WORDPRESS_DB_PASSWORD: ${WDB_PASSWORD}
WORDPRESS_CONFIG_EXTRA: |
define('FS_METHOD', 'direct');
$$redis_server = array(
......@@ -36,40 +32,44 @@ services:
restart: always
nginx:
image: nginx:${NGINX_VERSION:-latest}
image: nginx:latest
container_name: ${CONTAINER_PREFIX}-nginx
networks:
- web
- default
volumes:
- ${NGINX_CONF_DIR:-./nginx}/nginx.conf:/etc/nginx/nginx.conf
- ${NGINX_CONF_DIR:-./nginx}/conf.d:/etc/nginx/conf.d/
- ${NGINX_CONF_DIR:-./nginx}/snippets:/etc/nginx/snippets/
- ${NGINX_LOG_DIR:-./logs/nginx}:/var/log/nginx/
- ${WORDPRESS_DIR:-./wordpress}:/var/www/html/
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d:/etc/nginx/conf.d/
- ./nginx/snippets:/etc/nginx/snippets/
- ./logs/nginx:/var/log/nginx/
- ./wordpress:/var/www/html/
depends_on:
- wordpress
restart: always
labels:
- traefik.enable=${NGINX_TRAEFIK_ENABLE:-true}
- traefik.docker.network=web
- traefik.http.routers.${CONTAINER_PREFIX}.rule=Host(`${HOST}`, `www.${HOST}`)
- traefik.http.routers.${CONTAINER_PREFIX}.tls.certresolver=cloudflare
- traefik.http.services.${CONTAINER_PREFIX}.loadbalancer.server.port=80
- traefik.http.routers.${CONTAINER_PREFIX}.entrypoints=web-secure
db:
image: mariadb:${MARIADB_VERSION:-latest}
container_name: ${CONTAINER_PREFIX}-db
wordpress-db:
image: mariadb:latest
container_name: ${CONTAINER_PREFIX}-wordpress-db
volumes:
- ./wordpress-db:/var/lib/mysql
networks:
- default
environment:
- MYSQL_ROOT_PASSWORD=${WDB_ROOT_PASSWORD:-password}
- MYSQL_USER=${WDB_USER:-root}
- MYSQL_PASSWORD=${WDB_PASSWORD:-password}
- MYSQL_DATABASE=${WDB_DATABASE:-wordpress}
restart: always
proxy-db:
image: mariadb:latest
container_name: ${CONTAINER_PREFIX}-proxy-db
volumes:
- ${MYSQL_DATA_DIR:-./mysql}:/var/lib/mysql
- ./proxy-db:/var/lib/mysql
networks:
- default
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-password}
- MYSQL_USER=${MYSQL_USER:-root}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
- MYSQL_DATABASE=${MYSQL_DATABASE:-wordpress}
- MYSQL_ROOT_PASSWORD=${PDB_ROOT_PASSWORD}
- MYSQL_USER=${PDB_USER}
- MYSQL_PASSWORD=${PDB_PASSWORD}
- MYSQL_DATABASE=${PDB_DATABASE}
restart: always
adminer:
......@@ -78,19 +78,46 @@ services:
ports:
- ${ADMINER_PORT:-8080}:8080
links:
- db
networks:
- web
- default
labels:
- traefik.enable=${ADMINER_TRAEFIK_ENABLE:-false}
- traefik.docker.network=web
- traefik.http.routers.${CONTAINER_PREFIX}-adminer.rule=Host(`${ADMINER_HOST}`)
- traefik.http.routers.${CONTAINER_PREFIX}-adminer.tls.certresolver=cloudflare
- traefik.http.routers.${CONTAINER_PREFIX}-adminer.entrypoints=web-secure
- wordpress-db
- proxy-db
redis:
image: redis:alpine
container_name: ${CONTAINER_PREFIX}-redis
command: redis-server --requirepass ${REDIS_PASSWORD}
restart: always
proxy:
image: 'jc21/nginx-proxy-manager:latest'
container_name: ${CONTAINER_PREFIX}-proxy
restart: always
ports:
- '80:80'
- '81:81'
- '443:443'
environment:
DB_MYSQL_HOST: "proxy-db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: ${PDB_USER}
DB_MYSQL_PASSWORD: ${PDB_PASSWORD}
DB_MYSQL_NAME: ${PDB_DATABASE}
volumes:
- ./proxy:/data
- ./letsencrypt:/etc/letsencrypt
depends_on:
- proxy-db
portainer:
image: portainer/portainer-ce
container_name: ${CONTAINER_PREFIX}-portainer
command: -H unix:///var/run/docker.sock
restart: always
ports:
- 9000:9000
- 8000:8000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
volumes:
portainer_data:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment