kaizoku
kaizoku copied to clipboard
Kaizoku cannot connect to the postgres server
Describe the bug
Kaizoku cannot connect to the postgres server, it throws this error:
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "kaizoku", schema "public" at "db:5432"
Error: P1001: Can't reach database server at `db`:`5432`
Please make sure your database server is running at `db`:`5432`.
Reproduction steps
- Use the docker-compose sample at the README.md
Expected behavior
Should work normally.
Additional context
Tried #135 , still no luck. Also, it is in a Docker in WSL instance if that helps.
Docker Compose:
version: '3'
name: kaizoku
volumes:
db:
redis:
services:
app:
container_name: kaizoku
image: ghcr.io/oae/kaizoku:latest
networks:
weeb:
ipv4_address: 172.30.0.2
environment:
- DATABASE_URL=postgresql://kaizoku:kaizoku@db:5432/kaizoku
- KAIZOKU_PORT=8000
- REDIS_HOST=localhost
- REDIS_PORT=6379
- PUID=1000
- PGID=1000
- TZ=Asia/Singapore
volumes:
- /mnt/d/Download/Manga:/data
- /config/kaizoku:/config
- /config/kaizoku/logs:/logs
depends_on:
db:
condition: service_healthy
ports:
- 8000:8000
redis:
image: redis:7-alpine
volumes:
- redis:/data
db:
image: postgres:15-alpine
restart: unless-stopped
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U kaizoku']
interval: 5s
timeout: 5s
retries: 5
environment:
- POSTGRES_USER=kaizoku
- POSTGRES_DB=kaizoku
- POSTGRES_PASSWORD=kaizoku
volumes:
- db:/var/lib/postgresql/data
networks:
weeb:
external: true
Add redis and db to the same network you added app to. Then change 'db' in the database url to localhost. DATABASE_URL=postgresql://kaizoku:kaizoku@localhost:5432/kaizoku