Skip to content

Commit 4d806cf

Browse files
committed
refactor: merge docker compose files
1 parent f3b9e5f commit 4d806cf

File tree

4 files changed

+69
-253
lines changed

4 files changed

+69
-253
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ PRETALX_VERSION=main
77
PRETALX_IMAGE=
88

99
# Database Configuration
10+
# When COMPOSE_PROFILES includes local-db the bundled PostgreSQL service is started.
11+
# Clear COMPOSE_PROFILES and set POSTGRES_HOST to connect to an external PostgreSQL instance.
12+
COMPOSE_PROFILES=local-db
13+
POSTGRES_HOST=db
14+
POSTGRES_PORT=5432
1015
POSTGRES_DB=pretalx
1116
POSTGRES_USER=pretalx
1217
POSTGRES_PASSWORD=change_this_to_a_secure_password

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ Official Docker image builder for [pretalx](https://github.com/pretalx/pretalx),
2121
- `POSTGRES_PASSWORD`: A secure database password
2222
- `PRETALX_SECRET_KEY`: A random secret key (generate with `openssl rand -base64 32`)
2323
- `PRETALX_SITE_URL`: Your site URL (e.g., `https://pretalx.example.com`)
24+
- `COMPOSE_PROFILES=local-db`: Keeps the bundled PostgreSQL service enabled (default). Clear the value to use an external database and set `POSTGRES_HOST`.
2425

2526
4. **Start the services**
2627
```bash
2728
docker compose up -d
2829
```
30+
With `COMPOSE_PROFILES=local-db` this launches the bundled PostgreSQL container. If you cleared the profile and set `POSTGRES_HOST`, the stack connects to your external database instead.
2931

3032
5. **Create a superuser**
3133
```bash
@@ -60,6 +62,14 @@ docker run -d -p 8000:8000 \
6062

6163
See [.env.example](.env.example) for all available configuration options.
6264

65+
#### Database Options
66+
- `COMPOSE_PROFILES=local-db`: Start the bundled PostgreSQL service (default). Clear the value to disable the container and connect to an external database.
67+
- `POSTGRES_HOST`: PostgreSQL hostname (default: `db`). When you disable the bundled database, set this to your external host.
68+
- `POSTGRES_PORT`: PostgreSQL port (default: `5432`)
69+
- `POSTGRES_DB`: Database name (default: `pretalx`)
70+
- `POSTGRES_USER`: Database user (default: `pretalx`)
71+
- `POSTGRES_PASSWORD`: Database password (required)
72+
6373
#### Required Variables
6474
- `POSTGRES_PASSWORD`: Database password
6575
- `PRETALX_SECRET_KEY`: Django secret key
@@ -88,9 +98,16 @@ The Docker Compose setup includes:
8898
- **migrate**: One-time migration service (runs before other services)
8999
- **web**: Gunicorn WSGI server on port 8000
90100
- **worker**: Celery background task worker
91-
- **db**: PostgreSQL 15 database
101+
- **db**: PostgreSQL 15 database (enabled when `COMPOSE_PROFILES` includes `local-db`)
92102
- **redis**: Redis for caching and Celery
93103

104+
### Using an External PostgreSQL Database
105+
106+
1. Edit `.env`, clear the `COMPOSE_PROFILES` value (or comment it out) so the bundled `db` service is not started.
107+
2. Set `POSTGRES_HOST` (and optionally `POSTGRES_PORT`) to point at your external database.
108+
3. Ensure `POSTGRES_DB`, `POSTGRES_USER`, and `POSTGRES_PASSWORD` match the external database credentials.
109+
4. Start the stack with `docker compose up -d`. Docker Compose skips the `db` service automatically, and migrate/web/worker wait until they can connect to the external database.
110+
94111
## Production Deployment
95112

96113
### Using a Reverse Proxy

docker-compose.external-db.yml

Lines changed: 0 additions & 155 deletions
This file was deleted.

0 commit comments

Comments
 (0)