diff --git a/docker-compose.yml b/docker-compose.yml index 9986338..516dcf0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ version: '3' services: - pretalx: + eventyay-talk: image: eventyay/eventyay-talk:development container_name: eventyay-talk restart: unless-stopped @@ -19,9 +19,9 @@ services: ports: - "127.0.0.1:8355:80" - pretix: - image: eventyay/eventyay-tickets:development - container_name: eventyay-tickets + eventyay-ticket: + image: eventyay/eventyay-ticket:development + container_name: eventyay-ticket restart: unless-stopped depends_on: db: @@ -41,10 +41,11 @@ services: restart: unless-stopped volumes: - db:/var/lib/postgresql/data + - ./docker-postgresql-multiple-databases:/docker-entrypoint-initdb.d environment: POSTGRES_USER: postgres_db_user_changeme POSTGRES_PASSWORD: postgres_db_pwd_changeme - POSTGRES_DB: eventyay_db + POSTGRES_MULTIPLE_DATABASES: eventyay_db,eventyay_ticket_db healthcheck: # TODO why can we not use $POSTGRES_USER and $POSTGRES_DB here, since it is in the env? test: ["CMD-SHELL", 'pg_isready -U postgres_db_user_changeme -d eventyay_db'] interval: 10s @@ -53,7 +54,7 @@ services: redis: image: redis:latest - container_name: pretalx-redis + container_name: redis restart: unless-stopped volumes: - pretalx-redis:/data diff --git a/docker-postgresql-multiple-databases/create-multiple-postgresql-databases.sh b/docker-postgresql-multiple-databases/create-multiple-postgresql-databases.sh new file mode 100755 index 0000000..aa665fa --- /dev/null +++ b/docker-postgresql-multiple-databases/create-multiple-postgresql-databases.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e +set -u + +function create_user_and_database() { + local database=$1 + echo " Creating user and database '$database'" + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL + CREATE USER $database; + CREATE DATABASE $database; + GRANT ALL PRIVILEGES ON DATABASE $database TO $database; +EOSQL +} + +if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then + echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES" + for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do + create_user_and_database $db + done + echo "Multiple databases created" +fi diff --git a/pretalx.cfg b/pretalx.cfg index ff6a190..1f486a6 100644 --- a/pretalx.cfg +++ b/pretalx.cfg @@ -26,11 +26,11 @@ port = 25 #ssl = True [celery] -backend = redis://pretalx-redis/1 -broker = redis://pretalx-redis/2 +backend = redis://redis/1 +broker = redis://redis/2 [redis] -location=redis://pretalx-redis/0 +location=redis://redis/0 ; Remove the following line if you are unsure about your redis' security ; to reduce impact if redis gets compromised. sessions=true diff --git a/pretix.cfg b/pretix.cfg index 3739a13..d456d60 100644 --- a/pretix.cfg +++ b/pretix.cfg @@ -20,9 +20,8 @@ default=en timezone=UTC [database] -; Replace postgresql with mysql for MySQL backend=postgresql -name=eventyay_db +name=eventyay_ticket_db user=postgres_db_user_changeme ; Replace with the password you chose above password=postgres_db_pwd_changeme @@ -52,5 +51,5 @@ location=redis://redis/0 sessions=true [celery] -backend=redis://redis/1 -broker=redis://redis/2 +backend=redis://redis/3 +broker=redis://redis/4