<commit_before>version: '3'

services:

  # BUILD PHP 7
  php: 
    build: ./images/php/7.0
    restart: always
    tty: true
    depends_on:
      - redis
      - db
    expose: 
      - "9000"
    volumes:
      - backend_:/www
    links:
      - db:mysql
      - redis
    env_file:
      - ./images/php/php.env
    networks:
      - ext
      - int

  # MYSQL 
  db:
    build: ./images/mysql
    volumes:
      - mysql_:/var/lib/mysql
      - mysql__:/var/log/mysql
    restart: always
    tty: true
    expose: 
      - "3306"
    ports:
      - "$DB_PORT:3306"
    env_file:
      - ./images/mysql/db.env
    networks:
      - int
  
  # REDIS
  redis:
    build: ./images/redis
    volumes:
      - redis_:/data
    expose: 
      - "6379"
    restart: always
    tty: true
    networks:
      - int

  # nginx
  nginx:
    build: ./images/nginx
    restart: always
    tty: true
    env_file: 
      - ./images/nginx/proxy.env
    volumes:
      - backend_:/www
      - nginx__:/var/log/nginx
    depends_on:
      - php
    links:
      - db:mysql
      - php:php7
    expose: 
      - "80"
      - "443"
    ports: 
      - "$PROXY_HTTP:80"
      - "$PROXY_HTTPS:443"
    networks:
      - int

  # haproxy loadbalancer
  haproxy:
    build: ./images/haproxy
    restart: always
    tty: true
    env_file: 
      - ./images/nginx/proxy.env
    volumes:
      - proxy__:/var/log/nginx
    depends_on:
      - nginx
    expose: 
      - "80"
      - "443"
    ports: 
      - "$PROXY_HTTP:80"
      - "$PROXY_HTTPS:443"
    networks:
      - ext
      - int

volumes: # 1 underscore, data voluem. 2 underscore, logs volume
  mongo_: 
  redis_:
  mysql_:
  backend_:
  frontend_:
  nginx__:
  mysql__:
  proxy__:

networks:
  ext:
  int:
    internal: true<commit_msg>Added healthcheck directives to php and nginx but for now the command is `sh`. Added `deploy` directives to all the services for `docker stack` to deploy the project to multiple VMs<commit_after>version: '3'

services:

  # BUILD PHP 7
  php: 
    build: ./images/php/7.0
    restart: always
    tty: true
    depends_on:
      - redis
      - db
    expose: 
      - "9000"
    volumes:
      - backend_:/www
    links:
      - db:mysql
      - redis
    env_file:
      - ./images/php/php.env
    networks:
      - ext
      - int
    healthcheck:
      test: sh
      interval: 1m30s
      timeout: 10s
      retries: 3
    deploy:
      mode: replicated
      replicas: 6
      update_config:
        parallelism: 2
        delay: 10s
        failure_action: pause
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 5
      resources:
        limits:
          cpus: '0.001'
          memory: 512M
        reservations:
          cpus: '0.0001'
          memory: 200M

  # MYSQL 
  db:
    build: ./images/mysql
    volumes:
      - mysql_:/var/lib/mysql
      - mysql__:/var/log/mysql
    restart: always
    tty: true
    expose: 
      - "3306"
    ports:
      - "$DB_PORT:3306"
    env_file:
      - ./images/mysql/db.env
    networks:
      - int
    deploy:
      mode: replicated
      replicas: 2
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: pause
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 5
      resources:
        limits:
          cpus: '0'
          memory: 1.5G
        reservations:
          cpus: '0.0001'
          memory: 1G
  
  # REDIS
  redis:
    build: ./images/redis
    volumes:
      - redis_:/data
    expose: 
      - "6379"
    restart: always
    tty: true
    networks:
      - int
    deploy:
      mode: global
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 5
      resources:
        limits:
          cpus: '0.001'
          memory: 1G
        reservations:
          cpus: '0.0001'
          memory: 1G

  # nginx
  nginx:
    build: ./images/nginx
    restart: always
    tty: true
    env_file: 
      - ./images/nginx/proxy.env
    volumes:
      - backend_:/www
      - nginx__:/var/log/nginx
    depends_on:
      - php
    links:
      - db:mysql
      - php:php7
    expose: 
      - "80"
      - "443"
    ports: 
      - "$PROXY_HTTP:80"
      - "$PROXY_HTTPS:443"
    networks:
      - int
      - ext
    healthcheck:
      test: sh
      interval: 1m30s
      timeout: 10s
      retries: 3
    deploy:
      mode: replicated
      replicas: 2
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: pause
      restart_policy:
        condition: on-failure
        delay: 10s
        max_attempts: 5
      resources:
        limits:
          cpus: '0.001'
          memory: 200M
        reservations:
          cpus: '0.0001'
          memory: 200M

volumes: # 1 underscore, data voluem. 2 underscore, logs volume
  mongo_: 
  redis_:
  mysql_:
  backend_:
  frontend_:
  nginx__:
  mysql__:
  proxy__:

networks:
  ext:
  int:
    internal: true
{'fraction_non_alphanumeric': 0.09799599198396794, 'fraction_numerical': 0.03246492985971944, 'mean_word_length': 1.4228155339805826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5066592', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1764, 'n_words': 401}