services: db: image: postgres restart: always shm_size: 128mb volumes: - ${PRODUCTION_HOME}/scripts/postgres-start.sh:/docker-entrypoint-initdb.d/start.sh healthcheck: test: ["CMD-SHELL", "pg_isready -U $${DB_USER} -d $${DB_NAME}"] interval: 10s retries: 5 start_period: 30s timeout: 10s environment: DB_ROOT_PASSWORD_FILE: /run/secrets/db-root-password-ponydle_backend DB_ROOT_USERNAME_FILE: /run/secrets/db-root-user-ponydle_backend DB_PASSWORD_FILE: /run/secrets/db-password-ponydle_backend POSTGRES_PASSWORD_FILE: /run/secrets/db-root-password-ponydle_backend POSTGRES_USER_FILE: /run/secrets/db-root-user-ponydle_backend DB_NAME: ${DB_NAME} DB_USER: ${DB_USER} secrets: - db-root-password-ponydle_backend - db-root-user-ponydle_backend - db-password-ponydle_backend - db-user-ponydle_backend networks: - db_net_ponydle server: secrets: - db-password-ponydle_backend - db-user-ponydle_backend - mail-password-ponydle_backend - mail-user-ponydle_backend - mail-sender-ponydle_backend environment: DB_PASSWORD_FILE: /run/secrets/db-password-ponydle_backend DB_USER_FILE: /run/secrets/db-user-ponydle_backend MAIL_USERNAME_FILE: /run/secrets/mail-user-ponydle_backend MAIL_PASSWORD_FILE: /run/secrets/mail-password-ponydle_backend MAIL_SENDER_FILE: /run/secrets/mail-sender-ponydle_backend POOL_MIN_CONNS: ${POOL_MIN_CONNS} POOL_MAX_CONNS: ${POOL_MAX_CONNS} POOL_MAX_CONN_LIFETIME: ${POOL_MAX_CONN_LIFETIME} POOL_MAX_CONN_IDLE_TIME: ${POOL_MAX_CONN_IDLE_TIME} APP_PORT: ${APP_PORT} TOKEN_SECRET: ${TOKEN_SECRET} TOKEN_AUDIENCE: ${TOKEN_AUDIENCE} TOKEN_ISSUER: ${TOKEN_ISSUER} ACCESS_TOKEN_DURATION: ${ACCESS_TOKEN_DURATION} REFRESH_TOKEN_DURATION: ${REFRESH_TOKEN_DURATION} ORIGINS: ${ORIGINS} DB_PORT: ${DB_PORT} DB_NAME: ${DB_NAME} MAIL_HOST: ${MAIL_HOST} MAIL_PORT: ${MAIL_PORT} working_dir: /server image: rainbowcrash/ponydle_backend:${GIT_HASH} networks: - db_net_ponydle - traefik_proxy deploy: # this is what here we have 4 replicas of this service, while also, having a rollback con failure and other nice stuff # this is not required at least for now for all the services i make, maybe the rollback feature is nice, but buttt, # because i am doing very simple services for the company with a small userbase this is just enough i think replicas: 4 update_config: parallelism: 2 delay: 10s monitor: 30s failure_action: rollback max_failure_ratio: 0.25 order: start-first rollback_config: parallelism: 3 delay: 5s monitor: 20s order: start-first restart_policy: condition: on-failure delay: 5s max_attempts: 3 labels: - "traefik.enable=true" - "traefik.http.routers.api-ponydle_backend.rule=Host(`api-ponydle.memoryleaps.com`)" - "traefik.http.services.api-ponydle_backend.loadbalancer.server.port=6002" volumes: mongodb_data: networks: db_net_ponydle: traefik_proxy: external: true secrets: db-root-password-ponydle_backend: file: ./secrets/db-root-password.secret db-root-user-ponydle_backend: file: ./secrets/db-root-username.secret db-password-ponydle_backend: file: ./secrets/db-password.secret db-user-ponydle_backend: file: ./secrets/db-user.secret mail-sender-ponydle_backend: file: ./secrets/mail-sender.secret mail-user-ponydle_backend: file: ./secrets/mail-user.secret mail-password-ponydle_backend: file: ./secrets/mail-password.secret