oss-apps / split-pro

Open source alternative to Splitwise
https://splitpro.app
MIT License
368 stars 36 forks source link

Help with Docker Compose Configuration – Unable to Access Web Service #146

Open ZenoBell opened 1 week ago

ZenoBell commented 1 week ago

Hello!

I’m having trouble accessing the web service through Docker Compose. Despite the container running, I cannot seem to reach the service via browser.

Here’s my Docker Compose configuration:

  postgres:
    image: postgres:16
    container_name: splitpro-db-prod
    restart: always
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB} -h 127.0.0.1 -p 5432']
      interval: 10s
      timeout: 5s
      retries: 5
    ports:
      - "5432:5432"
    volumes:
      - $DOCKERDIR/appdata/postgresdb:/var/lib/postgresql/data

  splitpro:
    image: ossapps/splitpro:latest
    container_name: splitpro
    restart: always
    ports:
      - "3500:3000"
    environment:
      - PORT=3500
      - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@splitpro-db-prod:5432/${POSTGRES_DB}
#      - HOSTNAME:0.0.0.0
#      - NEXTAUTH_URL=${NEXTAUTH_URL:?err}
#      - NEXTAUTH_SECRET=${NEXTAUTH_SECRET:?err}
      - AUTH_PROVIDERS=GOOGLE,EMAIL
      - ENABLE_SENDING_INVITES="TRUE"
#      - FROM_EMAIL=${FROM_EMAIL}
#      - EMAIL_SERVER_HOST=${EMAIL_SERVER_HOST}
#      - EMAIL_SERVER_PORT=${EMAIL_SERVER_PORT}
#      - EMAIL_SERVER_USER=${EMAIL_SERVER_USER}
#      - EMAIL_SERVER_PASSWORD=${EMAIL_SERVER_PASSWORD}
#      - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
#      - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
#      - R2_ACCESS_KEY=${R2_ACCESS_KEY}
#      - R2_SECRET_KEY=${R2_SECRET_KEY}
#      - R2_BUCKET=${R2_BUCKET}
#      - R2_URL=${R2_URL}
#      - R2_PUBLIC_URL=${R2_PUBLIC_URL}
#      - WEB_PUSH_PRIVATE_KEY=${WEB_PUSH_PRIVATE_KEY}
#      - WEB_PUSH_PUBLIC_KEY=${WEB_PUSH_PUBLIC_KEY}
#      - WEB_PUSH_EMAIL=${WEB_PUSH_EMAIL}
#      - FEEDBACK_EMAIL=${FEEDBACK_EMAIL}
#      - DISCORD_WEBHOOK_URL=${DISCORD_WEBHOOK_URL}
    depends_on:
      postgres:
        condition: service_healthy

I have configured the above variables in the .env file. :

POSTGRES_USER=xxx
POSTGRES_PASSWORD=xxx
POSTGRES_DB=splitdb

App logs :

+ echo 'Deploying prisma migrations'
+ pnpx prisma migrate deploy --schema ./prisma/schema.prisma
Deploying prisma migrations
Progress: resolved 1, reused 0, downloaded 0, added 0
Progress: resolved 5, reused 0, downloaded 2, added 0
Packages: +6
++++++
Progress: resolved 7, reused 0, downloaded 6, added 6, done
.../node_modules/@prisma/engines postinstall$ node scripts/postinstall.js
.../node_modules/@prisma/engines postinstall: Done
.../prisma@5.22.0/node_modules/prisma preinstall$ node scripts/preinstall-entry.js
.../prisma@5.22.0/node_modules/prisma preinstall: Done
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "splitdb", schema "public" at "splitpro-db-prod:5432"

6 migrations found in prisma/migrations

No pending migrations to apply.
Starting web server
+ echo 'Starting web server'
+ node server.js
   ▲ Next.js 14.1.0
   - Local:        http://445f595afd5e:3500
   - Network:      http://172.18.0.27:3500

 ✓ Ready in 343ms

Db logs :

PostgreSQL Database directory appears to contain a database; Skipping initialization

2024-11-09 21:53:34.526 UTC [1] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-11-09 21:53:34.527 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-11-09 21:53:34.527 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-11-09 21:53:34.533 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-11-09 21:53:34.541 UTC [29] LOG:  database system was shut down at 2024-11-09 21:53:34 UTC
2024-11-09 21:53:34.547 UTC [1] LOG:  database system is ready to accept connections
2024-11-09 21:58:34.640 UTC [27] LOG:  checkpoint starting: time
2024-11-09 21:58:34.796 UTC [27] LOG:  checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.109 s, sync=0.026 s, total=0.156 s; sync files=3, longest=0.024 s, average=0.009 s; distance=0 kB, estimate=0 kB; lsn=0/19E0648, redo lsn=0/19E0610

Any help or suggestions would be greatly appreciated!

Thanks in advance!