Peppermint-Lab / peppermint

An open source issue management & help desk solution. A zendesk & jira alternative
https://peppermint.sh
Other
2.1k stars 229 forks source link

Unable to start container - Error while shutting down PostHog Error #259

Open adrianvanderwal opened 8 months ago

adrianvanderwal commented 8 months ago

I tried to deploy the container today after a minor modification of the docker-compose.yml (changed to port 3001:3000, as I already have another container bound to port 3000).

The container deploys, but gets stuck starting and is in an unhealthy state.

Output of docker logs peppermint below.

2024-03-28T07:36:52: PM2 log: Launching in no daemon mode
2024-03-28T07:36:52: PM2 log: App [client:0] starting in -fork mode-
2024-03-28T07:36:52: PM2 log: App [api:1] starting in -fork mode-
2024-03-28T07:36:52: PM2 log: App [client:0] online
2024-03-28T07:36:52: PM2 log: App [api:1] online
> client@1.0.0 start
> next start
  ▲ Next.js 13.5.6
  - Local:        http://localhost:3000
 ✓ Ready in 2.6s
Environment variables loaded from .env
Prisma schema loaded from src/prisma/schema.prisma
Datasource "db": PostgreSQL database "peppermint", schema "public" at "peppermint_postgres:5432"
36 migrations found in prisma/migrations
No pending migrations to apply.
Environment variables loaded from .env
Running seed command `node ./src/prisma/seed.js` ...
No need to seed, already seeded
🌱  The seed command has been executed.
┌─────────────────────────────────────────────────────────┐
│  Update available 5.2.0 -> 5.11.0                       │
│  Run the following to update                            │
│    npm i --save-dev prisma@latest                       │
│    npm i @prisma/client@latest                          │
└─────────────────────────────────────────────────────────┘
{"level":30,"time":1711611420544,"pid":19,"hostname":"8b156ce66f58","msg":"Connected to Prisma"}
strict mode: missing type "object" for keyword "required" at "#" (strictTypes)
strict mode: missing type "object" for keyword "properties" at "#" (strictTypes)
Server listening on http://0.0.0.0:5003
{"level":30,"time":1711611421022,"pid":19,"hostname":"8b156ce66f58","msg":"Server listening at http://0.0.0.0:5003"}
Environment variables loaded from .env
Prisma schema loaded from src/prisma/schema.prisma
✔ Generated Prisma Client (v5.2.0) to ./node_modules/@prisma/client in 890ms
Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
\```
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
\```
or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
\```
import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()
\```
See other ways of importing Prisma Client: http://pris.ly/d/importing-client
Error while shutting down PostHog Error [PostHogFetchNetworkError]: Network error while fetching PostHog
    at new PostHogFetchNetworkError (/apps/api/node_modules/posthog-node/lib/index.cjs.js:1127:16)
    at PostHog.<anonymous> (/apps/api/node_modules/posthog-node/lib/index.cjs.js:1521:51)
    at step (/apps/api/node_modules/posthog-node/lib/index.cjs.js:135:27)
    at Object.throw (/apps/api/node_modules/posthog-node/lib/index.cjs.js:84:53)
    at rejected (/apps/api/node_modules/posthog-node/lib/index.cjs.js:71:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  error: TypeError: fetch failed
      at node:internal/deps/undici/undici:12345:11
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: AggregateError
        at internalConnectMultiple (node:net:1114:18)
        at afterConnectMultiple (node:net:1667:5) {
      code: 'ECONNREFUSED',
      [errors]: [Array]
    }
  },
  [cause]: TypeError: fetch failed
      at node:internal/deps/undici/undici:12345:11
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: AggregateError
        at internalConnectMultiple (node:net:1114:18)
        at afterConnectMultiple (node:net:1667:5) {
      code: 'ECONNREFUSED',
      [errors]: [Array]
    }
  }
}
loop completed
loop completed
loop completed
loop completed
loop completed
loop completed
2024-03-28T07:43:40: PM2 log: Stopping app:client id:0
2024-03-28T07:43:40: PM2 log: Stopping app:api id:1
2024-03-28T07:43:40: PM2 log: App [api:1] exited with code [0] via signal [SIGINT]
2024-03-28T07:43:40: PM2 log: App [client:0] exited with code [0] via signal [SIGINT]
2024-03-28T07:43:40: PM2 log: pid=19 msg=process killed
2024-03-28T07:43:40: PM2 log: pid=18 msg=process killed
2024-03-28T07:43:40: PM2 log: 0 application online, retry = 3
2024-03-28T07:43:40: PM2 log: PM2 successfully stopped
potts99 commented 8 months ago

very strange not seen this error before will look into it @adrianvanderwal

maxgill commented 8 months ago

I encountered the same error after a fresh installation from the docker-compose example provided. Despite copying and pasting directly, everything seems to be functioning correctly. My docker image is also showing an unhealthy state.

See other ways of importing Prisma Client: http://pris.ly/d/importing-client
Error while shutting down PostHog Error [PostHogFetchNetworkError]: Network error while fetching PostHog
    at new PostHogFetchNetworkError (/apps/api/node_modules/posthog-node/lib/index.cjs.js:1127:16)
    at PostHog.<anonymous> (/apps/api/node_modules/posthog-node/lib/index.cjs.js:1521:51)
    at step (/apps/api/node_modules/posthog-node/lib/index.cjs.js:135:27)
    at Object.throw (/apps/api/node_modules/posthog-node/lib/index.cjs.js:84:53)
    at rejected (/apps/api/node_modules/posthog-node/lib/index.cjs.js:71:36)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  error: TypeError: fetch failed
      at node:internal/deps/undici/undici:12345:11
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: AggregateError
        at internalConnectMultiple (node:net:1114:18)
        at afterConnectMultiple (node:net:1667:5) {
      code: 'ECONNREFUSED',
      [errors]: [Array]
    }
  },
  [cause]: TypeError: fetch failed
      at node:internal/deps/undici/undici:12345:11
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: AggregateError
        at internalConnectMultiple (node:net:1114:18)
        at afterConnectMultiple (node:net:1667:5) {
      code: 'ECONNREFUSED',
      [errors]: [Array]
    }
  }
}
loop completed
loop completed
potts99 commented 8 months ago

What infra setup are you running @maxgill

maxgill commented 8 months ago

What infra setup are you running @maxgill

I am running Docker version 26.0.0 and Portainer Business Edition 2.19.4 on a virtual machine with Rocky Linux 9.3, hosted in a Proxmox environment.

maxgill commented 8 months ago

I suspect there might be a DNS issue, as I’ve noticed that requests to PostHog are being blocked by my AdGuard server.

adrianvanderwal commented 8 months ago

Ooo. I am also running adguard. That may be our culprit.

maxgill commented 8 months ago

Indeed, after unblocking app.posthog.com and reconstructing my stack, the error appears to have been resolved. There are no longer any error messages in the logs.

maxgill commented 8 months ago

However, the container remains in an unhealthy state, as I’m encountering errors with wget. Screenshot 2024-03-28 103735

potts99 commented 8 months ago

remove the healthcheck from the compose @maxgill, thank you, i'll see if i can handle this gracefully on my side