#git clone project on server
#docker network create --driver=overlay --attachable --subnet=192.168.196.0/24  --label="com.docker.stack.namespace=amitm" amitm_network
#docker stack deploy -c docker-compose-swarm.yml amitm
#
#
version: "3.7"
services:
    tmdb:
        hostname: tmdb
        container_name: tmdbc
        image: mariadb:5.5
        command: mysqld --sql_mode="NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES"
        #restart: always
        ports:
            - "33178:3306"
        environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
            MYSQL_DATABASE: testdb
            MYSQL_USER: "albert"
            MYSQL_PASSWORD: "marcel"
            MYSQL_HOST: "localhost"
        volumes:
            - /opt/DockerAmiTM/initdb/ami.sql:/docker-entrypoint-initdb.d/ami.sql
        deploy:
            mode: replicated
            placement:
                constraints: [node.hostname==manon]

    amibin:
        ports: ['8084:8900']
        container_name: bserver
        image: alpha11.localnet:5000/amitm_bs
        links:
            - tmdb
        depends_on:
            - tmdb
#        volumes:
#            - albert:/opt/ami/
        tty: true
        deploy:
            mode: replicated
            placement:
                constraints: [node.hostname==manon]

    crf:
        hostname: crf
        ports:
        - "8085:8085"
        - "8086:8086"
        container_name: crf
        image: alpha11.localnet:5000/amitm_crf 
        links:
            - tmdb
        depends_on:
            - tmdb
        environment:
            - PYTHONUNBUFFERED=1
        volumes:
            - /opt/DockerAmiTM/config.json:/opt/crf/config.json
        deploy:
            mode: replicated
            placement:
                constraints: [node.hostname==manon]

    amitm:
        ports: ['8081:8081']
        container_name: atm
        image: alpha11.localnet:5000/amitm_atm
        links:
            - amibin
            - crf
        depends_on:
            - amibin
            - crf
        command: "npm start"
        environment:
            CRF_HOST: "crf"

        volumes:
#            - albert:/opt/amitm/ami/
            - /opt/DockerAmiTM/config.json:/opt/amitm/config.json
        deploy:
            mode: replicated
            placement:
                constraints: [node.hostname==manon]

volumes:
    albert:
  
  
networks:
  default:
    external:
      name: amitm_network


