version: "2"
services:
    server:
      build:
        context: .
        dockerfile: server.Dockerfile
      volumes:
        - ./fixtures/rethinkdb:/tls
      networks:
        - rdb
      links:
        - rdb-proxy:rdb-proxy.rdb
        - signer
      ports:
        - "8080"
        - "4443:4443"
      entrypoint: /usr/bin/env sh
      command: -c "sh migrations/rethink_migrate.sh && notary-server -config=fixtures/server-config.rethink.json"
      depends_on:
        - rdb-proxy
    signer:
      build:
        context: .
        dockerfile: signer.Dockerfile
      volumes:
        - ./fixtures/rethinkdb:/tls
      networks:
        rdb:
            aliases:
                - notarysigner
      links:
        - rdb-proxy:rdb-proxy.rdb
      entrypoint: /usr/bin/env sh
      command: -c "sh migrations/rethink_migrate.sh && notary-signer -config=fixtures/signer-config.rethink.json"
      depends_on:
        - rdb-proxy
    rdb-01:
      image: jlhawn/rethinkdb:2.3.4
      volumes:
        - ./fixtures/rethinkdb:/tls
        - rdb-01-data:/var/data
      networks:
        rdb:
          aliases:
            - rdb
            - rdb.rdb
            - rdb-01.rdb
      command: "--bind all --no-http-admin --server-name rdb_01 --canonical-address rdb-01.rdb --directory /var/data/rethinkdb --join rdb.rdb --driver-tls-ca /tls/ca.pem --driver-tls-key /tls/key.pem --driver-tls-cert /tls/cert.pem --cluster-tls-key /tls/key.pem --cluster-tls-cert /tls/cert.pem --cluster-tls-ca /tls/ca.pem"
    rdb-02:
      image: jlhawn/rethinkdb:2.3.4
      volumes:
        - ./fixtures/rethinkdb:/tls
        - rdb-02-data:/var/data
      networks:
        rdb:
          aliases:
            - rdb
            - rdb.rdb
            - rdb-02.rdb
      command: "--bind all --no-http-admin --server-name rdb_02 --canonical-address rdb-02.rdb --directory /var/data/rethinkdb --join rdb.rdb --driver-tls-ca /tls/ca.pem --driver-tls-key /tls/key.pem --driver-tls-cert /tls/cert.pem --cluster-tls-key /tls/key.pem --cluster-tls-cert /tls/cert.pem --cluster-tls-ca /tls/ca.pem"
    rdb-03:
      image: jlhawn/rethinkdb:2.3.4
      volumes:
        - ./fixtures/rethinkdb:/tls
        - rdb-03-data:/var/data
      networks:
        rdb:
          aliases:
            - rdb
            - rdb.rdb
            - rdb-03.rdb
      command: "--bind all --no-http-admin --server-name rdb_03 --canonical-address rdb-03.rdb --directory /var/data/rethinkdb --join rdb.rdb --driver-tls-ca /tls/ca.pem --driver-tls-key /tls/key.pem --driver-tls-cert /tls/cert.pem --cluster-tls-key /tls/key.pem --cluster-tls-cert /tls/cert.pem --cluster-tls-ca /tls/ca.pem"
    rdb-proxy:
      image: jlhawn/rethinkdb:2.3.4
      ports:
        - "8080:8080"
      volumes:
        - ./fixtures/rethinkdb:/tls
      networks:
        rdb:
          aliases:
            - rdb-proxy
            - rdb-proxy.rdp
      command: "proxy --bind all --join rdb.rdb --driver-tls-ca /tls/ca.pem --driver-tls-key /tls/key.pem --driver-tls-cert /tls/cert.pem --cluster-tls-key /tls/key.pem --cluster-tls-cert /tls/cert.pem --cluster-tls-ca /tls/ca.pem"
      depends_on:
        - rdb-01
        - rdb-02
        - rdb-03
    client:
      build:
        context: .
        dockerfile: Dockerfile
      volumes:
        - ./test_output:/test_output
      networks:
        - rdb
      env_file: buildscripts/env.list
      links:
        - server:notary-server
      command: buildscripts/testclient.py
volumes:
    rdb-01-data:
        external: false
    rdb-02-data:
        external: false
    rdb-03-data:
        external: false
networks:
    rdb:
        external: false