mentorenwahl/docker-compose.yml

122 lines
3.1 KiB
YAML

# Mentorenwahl: A fullstack application for assigning mentors to students based on their whishes.
# Copyright (C) 2022 Dominic Grimm
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
x-backend:
&backend
image: git.dergrimm.net/mentorenwahl/backend:latest
build:
context: ./backend
args:
BUILD_ENV: production
restart: always
depends_on:
- db
- redis
- auth
environment:
BACKEND_MINIMUM_TEACHER_SELECTION_COUNT: ${BACKEND_MINIMUM_TEACHER_SELECTION_COUNT}
BACKEND_ASSIGNMENT_RUN_TIME: ${BACKEND_ASSIGNMENT_RUN_TIME}
BACKEND_API_JWT_SECRET: ${BACKEND_API_JWT_SECRET}
BACKEND_API_JWT_EXPIRATION: ${BACKEND_API_JWT_EXPIRATION}
BACKEND_DB_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_USER}
BACKEND_DB_ALLOW_OLD_SCHEMA: ${BACKEND_DB_ALLOW_OLD_SCHEMA}
BACKEND_REDIS_HOST: redis
BACKEND_REDIS_PORT: 6379
BACKEND_AUTH_URL: "http://auth/v1"
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- ./data/static:/static
version: "3"
services:
nginx:
image: docker.io/openresty/openresty:1.21.4.1-0-alpine
restart: always
volumes:
- ./config/nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro
ports:
- 80:80
- 8080:8080
depends_on:
- adminer
- api
- frontend
db:
image: docker.io/postgres:alpine
restart: always
command: postgres -c "max_connections=256"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- db:/var/lib/postgresql/data
adminer:
image: docker.io/adminer:standalone
restart: always
depends_on:
- db
redis:
image: docker.io/redis:alpine
restart: always
volumes:
- redis:/data
auth:
image: git.dergrimm.net/mentorenwahl/auth:latest
build:
context: ./auth
restart: always
environment:
AUTH_UNTIS_URL: ${AUTH_UNTIS_URL}
AUTH_UNTIS_CLIENT_NAME: ${AUTH_UNTIS_CLIENT_NAME}
AUTH_UNTIS_SCHOOL: ${AUTH_UNTIS_SCHOOL}
AUTH_UNTIS_USERNAME: ${AUTH_UNTIS_USERNAME}
AUTH_UNTIS_PASSWORD: ${AUTH_UNTIS_PASSWORD}
volumes:
- ./data/static:/static
worker:
<<: *backend
command: ./bin/worker run
deploy:
replicas: 2
api:
<<: *backend
command: ./bin/api run
depends_on:
- db
- redis
- auth
- worker
frontend:
image: git.dergrimm.net/mentorenwahl/frontend:latest
build:
context: ./frontend
restart: always
depends_on:
- api
volumes:
db:
redis: