Files
devops/orchestrate/compose/docker-compose-backend.yml
2025-09-23 10:54:10 -05:00

138 lines
5.5 KiB
YAML

# Docker compose for our backend system (REST API/Websocket/LDAP)
# @author Craig McDaniel
#
# This runs a backend server in your development environment. This gets you a running API server.
# You get:
#
# * BorgDrone PublicAPI application. This is the web server for the REST API and RealTimeAPI.
# - REST API: API endpoint, CB endpoint and SystemAPI endpoint.
# - RealTime API: A Websocket server for receiving events in real time.
#
# * BorgDrone LDAP server application.
#
# * Local redis cache.
#
# * Multiple PHP-FPM daemons, each running in their own docker container and on separate TCP ports
# so that we can serve up PHP code that need different PHP versions.
#
version: "3.5"
services:
# BorgDrone acts as a web server
borgdrone:
image: ${APISERVER_IMAGE_NAME}
hostname: bg-${HOSTNAME}
container_name: borgdrone
# Run nodemon for BorgDrone hot reload. Console displays all logs to stdout.
command: "node_modules/.bin/nodemon -i node_modules --signal SIGTERM borgdrone.js --console"
#command: "/opt/omilia/borgdrone/node_modules/.bin/forever --minUptime 1000 --spinSleepTime 1000 --workingDir /opt/omilia/borgdrone borgdrone.js --console"
working_dir: "/opt/omilia/borgdrone"
# This starts a mini init program that properly conveys SIGTERM to node when stopping the container.
init: true
stop_signal: SIGTERM
environment:
- RELEASE_MODE=dev
# Borgdrone needs to know what the host IP address is. It will look for this var.
- IP_ADDRESS=${IPADDRESS_API}
volumes:
- /opt/omilia/svn:/opt/omilia/svn
- /opt/omilia/git:/opt/omilia/git
# Core and PublicAPI must share the same directory here
- /opt/omilia/core:/opt/omilia/core
# Map core source tree to current
- ${SVN_DIR}/core/src:/opt/omilia/core/${SVN_CODE_NAME}/current
- ${SVN_DIR}/lib/ttcore:/opt/omilia/core/${SVN_CODE_NAME}/current/ttcore
# Borgdrone source tree map
- ${SVN_DIR}/borgdrone/src:/opt/omilia/borgdrone
# PublicAPI will move CORE versions into the local storage sometimes
- php-core-store:/opt/omilia/mnt/php-core-store
# Shared App Data
- shared-app-data:/opt/omilia/mnt/shared-app-data
restart: on-failure
network_mode: "host"
# Redis short term (local) memory cache.
shorttermcache:
image: redis:6
hostname: shorttermcache
container_name: shorttermcache
command: "redis-server"
restart: on-failure
network_mode: "host"
# PHP-FPM 7.3 listens on port 9000
php-fpm-7.3:
# See lib/build-php.sh to see where this variable comes from.
image: ${PHP_FPM_IMAGE_73}
hostname: php-fpm-73
container_name: php-fpm-73
# Run PHP-FPM and tell it to use the dev config.
command: "php-fpm -e --nodaemonize --fpm-config /usr/local/etc/php-fpm.dev.conf"
#command: "php-fpm --nodaemonize --fpm-config /usr/local/etc/php-fpm.prod.conf"
working_dir: "/opt/omilia"
environment:
- COOKIE_DOMAIN=omilia.io
volumes:
# Core and PublicAPI must share the same directory here
- /opt/omilia/core:/opt/omilia/core
# Map core source tree to current
- /opt/omilia/svn:/opt/omilia/svn
- ${SVN_DIR}/core/src:/opt/omilia/core/${SVN_CODE_NAME}/current
- ${SVN_DIR}/lib/ttcore:/opt/omilia/core/${SVN_CODE_NAME}/current/ttcore
# PublicAPI will move CORE versions into the local storage sometimes
- php-core-store:/opt/omilia/mnt/php-core-store
# Shared App Data
- shared-app-data:/opt/omilia/mnt/shared-app-data
# Account audio files uploaded or recorded by customers
- account-audio-files:/opt/omilia/mnt/account-audio-files
restart: on-failure
network_mode: "host"
# PHP-FPM 7.4 listens on port 9001
php-fpm-7.4:
# See lib/build-php.sh to see where this variable comes from.
image: ${PHP_FPM_IMAGE_74}
hostname: php-fpm-74
container_name: php-fpm-74
# Run PHP-FPM and tell it to use the dev config.
command: "php-fpm -e --nodaemonize --fpm-config /usr/local/etc/php-fpm.dev.conf"
#command: "php-fpm --nodaemonize --fpm-config /usr/local/etc/php-fpm.prod.conf"
working_dir: "/opt/omilia"
environment:
- COOKIE_DOMAIN=omilia.io
volumes:
# Core and PublicAPI must share the same directory here
- /opt/omilia/core:/opt/omilia/core
# Map core source tree to current
- /opt/omilia/svn:/opt/omilia/svn
- ${SVN_DIR}/core/src:/opt/omilia/core/${SVN_CODE_NAME}/current
- ${SVN_DIR}/lib/ttcore:/opt/omilia/core/${SVN_CODE_NAME}/current/ttcore
# PublicAPI will move CORE versions into the local storage sometimes
- php-core-store:/opt/omilia/mnt/php-core-store
# Shared App Data
- shared-app-data:/opt/omilia/mnt/shared-app-data
# Account audio files uploaded or recorded by customers
- account-audio-files:/opt/omilia/mnt/account-audio-files
restart: on-failure
network_mode: "host"
# Volumes, NFS shares
volumes:
data:
php-core-store:
driver_opts:
type: nfs
o: "addr=fs-007e461671b517080.efs.us-east-1.amazonaws.com,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport"
device: ":/"
shared-app-data:
driver_opts:
type: nfs
o: "addr=fs-09e63d68dea814115.efs.us-east-1.amazonaws.com,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport"
device: ":/"
account-audio-files:
driver_opts:
type: nfs
o: "addr=fs-09d0eb0a28f3cb6b3.efs.us-east-1.amazonaws.com,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport"
device: ":/account-audio"