You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
6.0 KiB

version: '3.7' #version
services:
nginx:
image: anginx #image from docker building my Dockerfile (docker build -f Dockerfile -t anginx .)
# build:
# context: .
# dockerfile: Dockerfile
container_name: production_nginx
volumes:
- /home/user/docker/nginx.conf:/etc/nginx/conf.d/default.conf
- /home/user/docker/cert.pem:/etc/nginx/public.crt
- /home/user/docker/key.pem:/etc/nginx/private.key
ports:
- 9080:80
- 9443:443
networks:
- main_net
mariadb:
image: mariadb
container_name: mariadb
# deploy:
# mode: replicated
# replicas: 2
# max_replicas_per_node: 1
# resources:
# limits:
# cpus: '0.50'
# memory: 50M
# reservations:
# cpus: '0.25'
# memory: 20M
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
networks:
- main_net
wordpress:
image: wordpress:latest
container_name: wordpress
restart: always
deploy: #create replicas with specific resources
mode: replicated
replicas: 2
# max_replicas_per_node: 1
resources:
limits: #max resources
cpus: '0.50'
memory: 50M
reservations: #default resources
cpus: '0.25'
memory: 20M
ports:
- 80:80
volumes:
- wp-app:/var/www/html
environment:
WORDPRESS_DB_HOST: mariadb:3306
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: wordpress
networks:
- main_net
depends_on:
- mariadb
cli:
image: wordpress:cli-php7.4
restart: always
container_name: cli
deploy:
mode: replicated
replicas: 2
# max_replicas_per_node: 1
resources:
limits:
cpus: '0.50'
memory: 50M
reservations:
cpus: '0.25'
memory: 20M
volumes:
- ./config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
- ./wp-app:/var/www/html
depends_on:
- wordpress
- mariadb
networks:
- main_net
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
deploy:
mode: replicated
replicas: 2
# max_replicas_per_node: 1
resources:
limits:
cpus: '0.50'
memory: 50M
reservations:
cpus: '0.25'
memory: 20M
environment:
PMA_HOST: mariadb
MYSQL_ROOT_PASSWORD: wordpress
PMA_PORT: 3306
ports:
- 8080:80
networks:
- main_net
minio1:
image: minio/minio:RELEASE.2020-04-10T03-34-42Z
hostname: minio1
volumes:
- minio1-data:/export
ports:
- "9001:9000"
networks:
- minio_distributed
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
placement:
constraints:
- node.labels.minio1==true
command: server http://minio{1...4}/export
environment:
MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE
MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# secrets:
# - secret_key
# - access_key
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio2:
image: minio/minio:RELEASE.2020-04-10T03-34-42Z
hostname: minio2
volumes:
- minio2-data:/export
ports:
- "9002:9000"
networks:
- minio_distributed
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
placement:
constraints:
- node.labels.minio2==true
command: server http://minio{1...4}/export
environment:
MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE
MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# secrets:
# - secret_key
# - access_key
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio3:
image: minio/minio:RELEASE.2020-04-10T03-34-42Z
hostname: minio3
volumes:
- minio3-data:/export
ports:
- "9003:9000"
networks:
- minio_distributed
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
placement:
constraints:
- node.labels.minio3==true
command: server http://minio{1...4}/export
environment:
MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE
MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# secrets:
# - secret_key
# - access_key
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio4:
image: minio/minio:RELEASE.2020-04-10T03-34-42Z
hostname: minio4
volumes:
- minio4-data:/export
ports:
- "9004:9000"
networks:
- minio_distributed
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
placement:
constraints:
- node.labels.minio4==true
command: server http://minio{1...4}/export
environment:
MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE
MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# secrets:
# - secret_key
# - access_key
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
volumes:
db_data:
# external: true
wp-app:
minio1-data:
minio2-data:
minio3-data:
minio4-data:
networks:
minio_distributed:
driver: overlay
#internal: {}
main_net: