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

[BUG] Can't reach database server at `hoppscotch-db' #6

Open
modist opened this issue Mar 7, 2024 · 0 comments
Open

[BUG] Can't reach database server at `hoppscotch-db' #6

modist opened this issue Mar 7, 2024 · 0 comments
Assignees

Comments

@modist
Copy link

modist commented Mar 7, 2024

Describe the bug

  • I get provided errormessage in the log
  • /admin returns 404.
  • Interface seems to be working .

dotenv

# configuration without sensitive data

docker compose

# full file
---
version: "2.1"
services:
  hoppscotch:
    image: webysther/hoppscotch:latest
    container_name: hoppscotch
    networks:
      hoppscotch:
      hoppscotch-db:
    environment:
      - ENABLE_ADMIN=true
      - MODE=team
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - POSTGRES_PASSWORD=password-for-database
    volumes:
      - /path/to/hoppscotch/config:/config
    ports:
      - 80:80
    depends_on:
      hoppscotch-db:
        condition: service_healthy
    restart: unless-stopped

  hoppscotch-db:
    image: postgres:alpine
    container_name: hoppscotch-db
    networks:
      hoppscotch-db:
    environment:
      - POSTGRES_DB=hoppscotch
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password-for-database
    volumes:
      - /path/to/postgres/data:/var/lib/postgresql/data
    expose:
      - 5432
    healthcheck:
      test: [
        "CMD-SHELL", 
        "sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'"
      ]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

networks:
  hoppscotch:
    name: hoppscotch
  hoppscotch-db:
    name: hoppscotch-db

logs

# postgres:alpinecontainer log
2024-03-07 14:03:01 2024-03-07 13:03:01.123 UTC [1] LOG:  starting PostgreSQL 16.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit
2024-03-07 14:03:01 2024-03-07 13:03:01.123 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-03-07 14:03:01 2024-03-07 13:03:01.123 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-03-07 14:03:01 2024-03-07 13:03:01.126 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-03-07 14:03:01 2024-03-07 13:03:01.127 UTC [24] LOG:  database system was shut down at 2024-03-07 13:02:31 UTC
2024-03-07 14:03:01 2024-03-07 13:03:01.131 UTC [1] LOG:  database system is ready to accept connections
2024-03-07 14:03:11 2024-03-07 13:03:11.178 UTC [34] FATAL:  role "-d" does not exist
2024-03-07 14:03:21 2024-03-07 13:03:21.247 UTC [42] FATAL:  role "-d" does not exist
2024-03-07 14:03:31 2024-03-07 13:03:31.319 UTC [49] FATAL:  role "-d" does not exist
2024-03-07 14:03:41 2024-03-07 13:03:41.399 UTC [57] FATAL:  role "-d" does not exist
2024-03-07 14:03:51 2024-03-07 13:03:51.468 UTC [64] FATAL:  role "-d" does not exist

logs

# hoppscotch container log
Node.js v18.16.0
2024-03-07 14:12:24 Thu, 07 Mar 2024 13:12:24 GMT express-session deprecated undefined resave option; provide resave option at dist/main.js:14:13
2024-03-07 14:12:24 Thu, 07 Mar 2024 13:12:24 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at dist/main.js:14:13
2024-03-07 14:12:27 /app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:27839
2024-03-07 14:12:27           throw new PrismaClientInitializationError(error2.message, this.config.clientVersion, error2.error_code);
2024-03-07 14:12:27                 ^
2024-03-07 14:12:27 
2024-03-07 14:12:27 PrismaClientInitializationError: Can't reach database server at `hoppscotch-db`:`5432`
2024-03-07 14:12:27 
2024-03-07 14:12:27 Please make sure your database server is running at `hoppscotch-db`:`5432`.
2024-03-07 14:12:27     at startFn (/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:27839:17)
2024-03-07 14:12:27     at async Proxy.onModuleInit (/app/packages/hoppscotch-backend/dist/prisma/prisma.service.js:20:9)
2024-03-07 14:12:27     at async Promise.all (index 0)
2024-03-07 14:12:27     at async callModuleInitHook (/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/hooks/on-module-init.hook.js:43:5)
2024-03-07 14:12:27     at async NestApplication.callInitHook (/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/nest-application-context.js:210:13)
2024-03-07 14:12:27     at async NestApplication.init (/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/nest-application.js:97:9)
2024-03-07 14:12:27     at async NestApplication.listen (/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/nest-application.js:155:33)
2024-03-07 14:12:27     at async bootstrap (/app/packages/hoppscotch-backend/dist/main.js:38:5) {
2024-03-07 14:12:27   clientVersion: '4.8.1',
2024-03-07 14:12:27   errorCode: 'P1001'

To Reproduce

# command executed or platform used (portainer/rancher)
docker compose up -d

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants