Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to the docker setup #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '3'
services:
pretalx:
eventyay-talk:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename service name

image: eventyay/eventyay-talk:development
container_name: eventyay-talk
restart: unless-stopped
Expand All @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename service name, and use singular ticket name for docker image
NEEDS CHANGES in the deployment

restart: unless-stopped
depends_on:
db:
Expand All @@ -41,10 +41,11 @@ services:
restart: unless-stopped
volumes:
- db:/var/lib/postgresql/data
- ./docker-postgresql-multiple-databases:/docker-entrypoint-initdb.d
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define two databases, keep the one used for talks as is

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
Expand All @@ -53,7 +54,7 @@ services:

redis:
image: redis:latest
container_name: pretalx-redis
container_name: redis
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the correct redis service name

restart: unless-stopped
volumes:
- pretalx-redis:/data
Expand Down
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions pretalx.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use correct redis service name


[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
7 changes: 3 additions & 4 deletions pretix.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use different redis database for ticket celery broker and backend