Add new services mode agent container to the docker-compose

This commit is contained in:
allegroai 2020-06-01 21:02:49 +03:00
parent 667964cc82
commit f4addaa653
2 changed files with 39 additions and 0 deletions

View File

@ -22,6 +22,8 @@ services:
TRAINS_MONGODB_SERVICE_PORT: 27017
TRAINS_REDIS_SERVICE_HOST: redis
TRAINS_REDIS_SERVICE_PORT: 6379
TRAINS__apiserver__mongo__pre_populate__enabled: "true"
TRAINS__apiserver__mongo__pre_populate__zip_file: "/opt/trains/db-pre-populate/export.zip"
ports:
- "8008:8008"
networks:

View File

@ -115,6 +115,43 @@ services:
ports:
- "8080:80"
agent-services:
container_name: trains-agent-services
image: allegroai/trains-agent:latest
entrypoint: ["/bin/bash", "-c", "if [ -z \"$$TRAINS_API_HOST\" ]; then TRAINS_HOST_IP=$${TRAINS_HOST_IP:-$$(curl -s https://ifconfig.me/ip)} ; fi ; \
TRAINS_FILES_HOST=$${TRAINS_FILES_HOST:-\"http://$$TRAINS_HOST_IP:8081\"} ; \
TRAINS_WEB_HOST=$${TRAINS_WEB_HOST:-\"http://$$TRAINS_HOST_IP:8080\"} ; \
TRAINS_API_HOST=$${TRAINS_API_HOST:-\"http://$$TRAINS_HOST_IP:8008\"} ; \
echo $$TRAINS_FILES_HOST $$TRAINS_WEB_HOST $$TRAINS_API_HOST 1>&2 ; \
python3 -m pip install -q -U \"trains-agent$${TRAINS_AGENT_UPDATE_VERSION}\" \
&& trains-agent daemon --services-mode --queue services --create-queue --docker $$TRAINS_AGENT_DEFAULT_BASE_DOCKER --cpu-only"]
restart: unless-stopped
privileged: true
environment:
TRAINS_HOST_IP: ${TRAINS_HOST_IP}
TRAINS_WEB_HOST: ${TRAINS_WEB_HOST:-}
TRAINS_API_HOST: ${TRAINS_API_HOST:-}
TRAINS_FILES_HOST: ${TRAINS_FILES_HOST:-}
TRAINS_API_ACCESS_KEY: ${TRAINS_API_ACCESS_KEY:-}
TRAINS_API_SECRET_KEY: ${TRAINS_API_SECRET_KEY:-}
TRAINS_AGENT_GIT_USER: ${TRAINS_AGENT_GIT_USER}
TRAINS_AGENT_GIT_PASS: ${TRAINS_AGENT_GIT_PASS}
TRAINS_AGENT_UPDATE_VERSION: ${TRAINS_AGENT_UPDATE_VERSION:->=0.15.0}
TRAINS_AGENT_DEFAULT_BASE_DOCKER: "ubuntu:18.04"
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION:-}
AZURE_STORAGE_ACCOUNT: ${AZURE_STORAGE_ACCOUNT:-}
AZURE_STORAGE_KEY: ${AZURE_STORAGE_KEY:-}
GOOGLE_APPLICATION_CREDENTIALS: ${GOOGLE_APPLICATION_CREDENTIALS:-}
TRAINS_WORKER_ID: "trains-services"
TRAINS_AGENT_DOCKER_HOST_MOUNT: "/opt/trains/agent:/root/.trains"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/trains/agent:/root/.trains
depends_on:
- apiserver
networks:
backend:
driver: bridge