Skip to content

Commit caff06e

Browse files
authored
Merge pull request #25 from PhilippMundhenk/patch-1
multiple compose fixes to ensure smooth (first) startup
2 parents 652b41c + 9c78199 commit caff06e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# localhost for dev/local docker testing, or domain/IP if deployed
22
PHX_HOST="localhost"
33
# docker compose example url:
4-
DATABASE_URL="postgresql://postgres:postgres@db:5432/fuzzy_catalog"
4+
DATABASE_URL="postgresql://postgres:postgres@db:5432/fuzzy_catalog?sslmode=disable"
55
SECRET_KEY_BASE="<use mix phx.gen.secret>"
66
AUDIOBOOKSHELF_URL="https://audiobooks.example.com"
77
AUDIOBOOKSHELF_API_KEY=""

docker-compose.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
services:
22
db:
3-
image: postgres:alpine
3+
image: postgres:17-alpine
44
volumes:
55
- postgres_data:/var/lib/postgresql/data
66
environment:
7+
POSTGRES_USER: postgres
78
POSTGRES_PASSWORD: postgres
89
POSTGRES_DB: fuzzy_catalog
10+
healthcheck:
11+
test: ["CMD", "pg_isready", "-U", "postgres"]
12+
interval: 10s
13+
start_period: 30s
14+
restart: unless-stopped
915
web:
1016
build:
1117
context: .
@@ -16,7 +22,10 @@ services:
1622
ports:
1723
- "4000:4000"
1824
depends_on:
19-
- db
25+
db:
26+
condition: service_healthy
27+
restart: true
28+
restart: unless-stopped
2029
env_file: .env.docker
2130
volumes:
2231
postgres_data:

0 commit comments

Comments
 (0)