mirror of
https://gitlab.com/sfz.aalen/infra/fabaccess.git
synced 2025-03-12 15:01:47 +01:00
migrated to Postgres because of binary availability of postgres python client. Also implemented development compose file and refactored production python image
48 lines
1.5 KiB
YAML
48 lines
1.5 KiB
YAML
version: '3'
|
|
services:
|
|
backend:
|
|
build: .
|
|
depends_on:
|
|
- db
|
|
- mqtt
|
|
environment:
|
|
# Keycloak config
|
|
KEYCLOAK_URL: ${KEYCLOAK_URL:?err}
|
|
KEYCLOAK_USER_NAME: ${KEYCLOAK_USER_NAME:?err}
|
|
KEYCLOAK_USER_PW: ${KEYCLOAK_USER_PW:?err}
|
|
KEYCLOAK_REALM: ${KEYCLOAK_REALM:?err}
|
|
# DB config
|
|
DB_HOSTNAME: ${DB_HOSTNAME:?err}
|
|
DB_USERNAME: ${DB_USERNAME:?err}
|
|
DB_PASSWORD: ${DB_PASSWORD:?err}
|
|
DB_DATABASE: ${DB_DATABASE:?err}
|
|
# MQTT config
|
|
MQTT_USERNAME: ${MQTT_USERNAME:?err}
|
|
MQTT_PASSWORD: ${MQTT_PASSWORD:?err}
|
|
MQTT_BROKER: ${MQTT_BROKER:?err}
|
|
MQTT_CLIENT: ${MQTT_CLIENT:?err}
|
|
restart: unless-stopped
|
|
db:
|
|
image: postgres:15-alpine
|
|
volumes:
|
|
- ./sql/:/docker-entrypoint-initdb.d/:ro,Z
|
|
environment:
|
|
POSTGRES_DB: ${DB_DATABASE}
|
|
POSTGRES_USER: ${DB_USERNAME}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
mqtt:
|
|
image: eclipse-mosquitto:2
|
|
environment:
|
|
MQTT_USERNAME: ${MQTT_USERNAME}
|
|
MQTT_PASSWORD: ${MQTT_PASSWORD}
|
|
entrypoint:
|
|
- sh
|
|
- -c
|
|
- |
|
|
touch /mosquitto/config/passwd
|
|
mosquitto_passwd -b /mosquitto/config/passwd $${MQTT_USERNAME:?err} $${MQTT_PASSWORD:?err}
|
|
echo "bind_address 0.0.0.0" > /mosquitto/config/mosquitto.conf
|
|
echo "password_file /mosquitto/config/passwd" >> /mosquitto/config/mosquitto.conf
|
|
echo "allow_anonymous false" >> /mosquitto/config/mosquitto.conf
|
|
/usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf
|