Snippets

Frederik Banke docker-compose.yml - Part 8

Created by Frederik Banke last modified
version: "3.2"

services:
  ############## loadbalancer ################
  loadbalancer:
    image: 637345297332.dkr.ecr.eu-west-1.amazonaws.com/patch-loadbalancer:latest
    build: loadbalancer
    ports:
      - target: 8080
        published: 80
        protocol: tcp
        mode: host
   
    deploy:
      placement:
        constraints:
          - node.role == manager

  fileserver:
    image: 637345297332.dkr.ecr.eu-west-1.amazonaws.com/patch-fileserver:latest
    build: fileserver
    deploy:
      restart_policy:
        condition: none
      
    volumes:
      - /data/storage/patch_wp-core/_data:/var/wordpress/

  ############ DB server ###################
  db:
    image: mariadb
    volumes:
      - db-data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=xxx
    deploy:
      placement:
        constraints:
          - node.role == manager

      resources:
        limits:
          memory: 300M

  backup-db:
    image: candyline/mysql-backup-cron
    environment:
      - MYSQL_ROOT_PASSWORD=xxx
      - MYSQL_HOST=db
      - BACKUP_DIR=/var/backups/
      - DAILY_CLEANUP=1
      - MAX_DAILY_BACKUP_FILES=30
      - STORAGE_TYPE=s3
      - REGION=eu-west-1c
      - ACCESS_KEY=
      - SECRET_KEY=/
      - BUCKET=s3://sqlbackup.patch.dk/
    
    deploy:
      placement:
        constraints:
          - node.role != manager
      resources:
        limits:
          memory: 100M
   
  backup-files:
    image: istepanov/backup-to-s3
    environment:
      - ACCESS_KEY=
      - SECRET_KEY=/
      - S3_PATH=s3://sqlbackup.patch.dk/wp-content/
      - DATA_PATH=/data/
   
    volumes:
      - /data/storage/patch_datadriven-investment-data/_data:/data/datadriven-investment:ro
      - /data/storage/patch_broderi-info-data/_data:/data/broderi-info:ro
      - /data/storage/patch_nordic-safe-data/_data:/data/nordic-safe:ro
      - /data/storage/patch_lund-fitness-data/_data:/data/lund-fitness:ro

    deploy:
      placement:
        constraints:
          - node.role != manager
      resources:
        limits:
          memory: 100M

  #################### WEBSITES ############
  http:
    image: 637345297332.dkr.ecr.eu-west-1.amazonaws.com/patch-httpd:latest
    build: httpd
   
    deploy:
      replicas: 2

      resources:
        limits:
          memory: 50M
     
    volumes:
      - /data/storage/patch_wp-core/_data:/var/www/nordic-safe.com/:ro
      - /data/storage/patch_wp-core/_data:/var/www/datadriven-investment.com/:ro
      - /data/storage/patch_wp-core/_data:/var/www/broderi-info.dk/:ro
      - /data/storage/patch_wp-core/_data:/var/www/lund-fitness.dk/:ro

      - /data/storage/patch_nordic-safe-data/_data:/var/www/nordic-safe.com/wp-content:ro
      - /data/storage/patch_datadriven-investment-data/_data:/var/www/datadriven-investment.com/wp-content:ro
      - /data/storage/patch_broderi-info-data/_data:/var/www/broderi-info.dk/wp-content:ro
      - /data/storage/patch_lund-fitness-data/_data:/var/www/lund-fitness.dk/wp-content:ro

  php:
    image: 637345297332.dkr.ecr.eu-west-1.amazonaws.com/patch-php-fpm:latest
    build: php-fpm
    deploy:
      replicas: 2
  
      resources:
        limits:
          memory: 150M

    volumes:
      - /data/storage/patch_wp-core/_data:/var/www/nordic-safe.com/:ro
      - /data/storage/patch_wp-core/_data:/var/www/datadriven-investment.com/:ro
      - /data/storage/patch_wp-core/_data:/var/www/broderi-info.dk/:ro
      - /data/storage/patch_wp-core/_data:/var/www/lund-fitness.dk/:ro

      - /data/storage/patch_nordic-safe-data/_data:/var/www/nordic-safe.com/wp-content
      - /data/storage/patch_datadriven-investment-data/_data:/var/www/datadriven-investment.com/wp-content # write allowed
      - /data/storage/patch_broderi-info-data/_data:/var/www/broderi-info.dk/wp-content # write allowed
      - /data/storage/patch_lund-fitness-data/_data:/var/www/lund-fitness.dk/wp-content # write allowed

  redis:
    image: redis:4.0.8-alpine

    deploy:
      placement:
        constraints:
          - node.role != manager

      resources:
        limits:
          memory: 100M

    
############## Data persisted on host #######
volumes:
  db-data: # database files

Comments (0)