Semi related to #80
Due to unable to migrate my v0.1.0 instance to v0.2.0 I've been trying everything possible from SQL imports to a brand new instance and sacrificing my data. I've had limited success with fresh installs though I'd estimate 95% of them fail to load the sample data and I'm consistently presented with the following error. Once I manually fix I later discover that the schema is created though no later is created.
app-1 | prisma:error
app-1 | Invalid `prisma.user.findUniqueOrThrow()` invocation:
app-1 |
app-1 |
app-1 | An operation failed because it depends on one or more records that were required but not found. Expected a record, found none.
app-1 | ⨯ Error [PrismaClientKnownRequestError]:
app-1 | Invalid `prisma.user.findUniqueOrThrow()` invocation:
app-1 |
app-1 |
app-1 | An operation failed because it depends on one or more records that were required but not found. Expected a record, found none.
app-1 | at async d (.next/server/app/page.js:1:5386) {
app-1 | code: 'P2025',
app-1 | clientVersion: '6.4.1',
app-1 | meta: [Object],
app-1 | digest: '509283176'
Build and startup sequence
open-health git:(main) ✗ docker compose -f docker-compose.yaml --env-file .env up
[+] Running 0/0
[+] Running 0/1 Building 0.1s
[+] Running 0/1.1s (9/12) docker:desktop-linux
⠴ Service app Building 56.6s
[+] Building 159.0s (11/12) docker:desktop-linux
[+] Building 284.1s (11/12) docker:desktop-linux
[+] Building 327.1s (14/14) FINISHED docker:desktop-linux
=> [app internal] load build definition from Containerfile 0.0s
=> => transferring dockerfile: 440B 0.0s
=> [app internal] load metadata for docker.io/library/node:lts-alpine 0.6s
=> [app auth] library/node:pull token for registry-1.docker.io 0.0s
=> [app internal] load .dockerignore 0.0s
=> => transferring context: 88B 0.0s
=> [app internal] load build context 0.0s
=> => transferring context: 11.01kB 0.0s
=> CACHED [app 1/7] FROM docker.io/library/node:lts-alpine@sha256:9bef0ef1e268f60627da9ba7d7605e8831d5b56ad07487d24d1aa386336d1944 0.0s
=> [app 2/7] RUN apk add -U graphicsmagick 5.5s
=> [app 3/7] WORKDIR /app 1.8s
=> [app 4/7] COPY package.json prisma/ . 0.1s
=> [app 5/7] RUN npm install 80.8s
=> [app 6/7] COPY . . 0.1s
=> [app 7/7] RUN npm run build && adduser --disabled-password ohuser && chown -R ohuser . 196.1s
=> [app] exporting to image 41.2s
=> => exporting layers 41.1s
=> => writing image sha256:ecea0c245b0475c8c58496adb86c50137c4a629df921b7904a7175eb4203883b 0.0s
[+] Running 5/5o docker.io/library/open-health-app 0.0s
✔ Service app Built 327.4s
✔ Network open-health_default Created 0.3s
✔ Container open-health-docling-serve-1 Created 0.7s
✔ Container open-health-openhealth_database-1 Created 0.7s
✔ Container open-health-app-1 Created 0.1s
Attaching to app-1, docling-serve-1, openhealth_database-1
openhealth_database-1 |
openhealth_database-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
openhealth_database-1 |
openhealth_database-1 | 2025-02-23 20:19:46.493 UTC [1] LOG: starting PostgreSQL 17.4 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit
openhealth_database-1 | 2025-02-23 20:19:46.493 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
openhealth_database-1 | 2025-02-23 20:19:46.493 UTC [1] LOG: listening on IPv6 address "::", port 5432
openhealth_database-1 | 2025-02-23 20:19:46.509 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
openhealth_database-1 | 2025-02-23 20:19:46.542 UTC [29] LOG: database system was shut down at 2025-02-23 20:11:20 UTC
openhealth_database-1 | 2025-02-23 20:19:46.632 UTC [1] LOG: database system is ready to accept connections
app-1 | Environment variables loaded from .env
app-1 | Prisma schema loaded from schema.prisma
app-1 | Datasource "db": PostgreSQL database "open-health", schema "public" at "openhealth_database:5432"
openhealth_database-1 | 2025-02-23 20:19:50.084 UTC [33] FATAL: database "open-health" does not exist
openhealth_database-1 | 2025-02-23 20:19:50.130 UTC [34] FATAL: database "open-health" does not exist
app-1 |
app-1 | PostgreSQL database open-health created at openhealth_database:5432
app-1 |
app-1 | 🚀 Your database is now in sync with your Prisma schema. Done in 262ms
app-1 |
✔ Generated Prisma Client (v6.4.1) to ./node_modules/@prisma/client in 636ms
app-1 |
app-1 | npm notice
app-1 | npm notice New major version of npm available! 10.9.2 -> 11.1.0
app-1 | npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.1.0
app-1 | npm notice To update run: npm install -g npm@11.1.0
app-1 | npm notice
app-1 | Environment variables loaded from .env
app-1 | Running seed command `ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts` ...
app-1 |
app-1 | 🌱 The seed command has been executed.
app-1 |
app-1 | > open-health@0.1.0 start
app-1 | > next start
app-1 |
app-1 | ▲ Next.js 15.1.6
app-1 | - Local: http://localhost:3000
app-1 | - Network: http://172.18.0.4:3000
app-1 |
app-1 | ✓ Starting...
app-1 | ✓ Ready in 1227ms
docling-serve-1 | INFO: 2025-02-23 20:20:04,486 - httpx - HTTP Request: GET https://api.gradio.app/pkg-version "HTTP/1.1 200 OK"
docling-serve-1 | INFO: Started server process [1]
docling-serve-1 | INFO: Waiting for application startup.
docling-serve-1 | INFO: 2025-02-23 20:20:05,596 - docling.utils.accelerator_utils - Accelerator device: 'cpu'
docling-serve-1 | INFO: 2025-02-23 20:20:15,736 - docling.utils.accelerator_utils - Accelerator device: 'cpu'
docling-serve-1 | INFO: 2025-02-23 20:20:16,386 - docling.utils.accelerator_utils - Accelerator device: 'cpu'
docling-serve-1 | INFO: Application startup complete.
docling-serve-1 | INFO: Uvicorn running on http://0.0.0.0:5001 (Press CTRL+C to quit)
openhealth_database-1 | 2025-02-23 20:24:46.663 UTC [27] LOG: checkpoint starting: time
openhealth_database-1 | 2025-02-23 20:26:28.598 UTC [27] LOG: checkpoint complete: wrote 950 buffers (5.8%); 1 WAL file(s) added, 0 removed, 0 recycled; write=101.718 s, sync=0.040 s, total=101.937 s; sync files=326, longest=0.002 s, average=0.001 s; distance=4403 kB, estimate=4403 kB; lsn=0/1DEF488, redo lsn=0/1DEF3F8
Upon container restarts I continually see
The database is already in sync with the Prisma schema.
app-1 |
✔ Generated Prisma Client (v6.4.1) to ./node_modules/@prisma/client in 835ms
app-1 |
app-1 | Environment variables loaded from .env
app-1 | Running seed command `ts-node --compiler-options {"module":"CommonJS"} prisma/seed.ts` ...
app-1 |
app-1 | 🌱 The seed command has been executed.
It sees the DB so it has a successful connection attempts the seed and "completes" it though it's failing. I can login to the DB and drop the tables or the entire DB volume to force a new seed and the condition replicates.
My .env file.
# Database
DATABASE_URL=postgres://openhealth:REDACTED@openhealth_database:5432/open-health
POSTGRES_PASSWORD=REDACTED
POSTGRES_USER=openhealth
POSTGRES_DB=open-health
# Web
NEXT_PUBLIC_URL=http://localhost:3000
# Authentication
AUTH_SECRET=REACTED
AUTH_TRUST_HOST=http://localhost:3000
# Encryption
ENCRYPTION_KEY=REDACTED
# Deployment Environment (local, cloud)
DEPLOYMENT_ENV=local
NEXT_PUBLIC_DEPLOYMENT_ENV=local
# API Keys for cloud deployment
OPENAI_API_KEY=sk-svcacct-REDACTED
GOOGLE_API_KEY=REDACTED
ANTHROPIC_API_KEY=
UPSTAGE_API_KEY=up_REDACTED
My docker-compose.yml
volumes:
openhealth_postgres_data:
services:
openhealth_database:
image: postgres:alpine
restart: always
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- openhealth_postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
docling-serve:
image: ghcr.io/ds4sd/docling-serve:latest
restart: always
app:
build:
context: .
dockerfile: Containerfile
args:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@openhealth_database:5432/${POSTGRES_DB}
depends_on:
- openhealth_database
- docling-serve
volumes:
- /Users/wesleykirkland/Desktop/openhealth/mnt/uploads:/app/public/uploads
ports:
- "3000:3000"
restart: always
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@openhealth_database:5432/${POSTGRES_DB}
Everything was working beautifully in v0.1.0 and the changes introduced in v0.2.0 are causing a significant amount of issues even locally. I'm also experiencing forced redirects to localhost:3000 (I can't remember if it's HTTPs or HTTP when I've had it running on my docker host and AUTH_TRUST_HOST clearly set to the FQDN.
Semi related to #80
Due to unable to migrate my v0.1.0 instance to v0.2.0 I've been trying everything possible from SQL imports to a brand new instance and sacrificing my data. I've had limited success with fresh installs though I'd estimate 95% of them fail to load the sample data and I'm consistently presented with the following error. Once I manually fix I later discover that the schema is created though no later is created.
Build and startup sequence
Upon container restarts I continually see
It sees the DB so it has a successful connection attempts the seed and "completes" it though it's failing. I can login to the DB and drop the tables or the entire DB volume to force a new seed and the condition replicates.
My .env file.
My docker-compose.yml
Everything was working beautifully in v0.1.0 and the changes introduced in v0.2.0 are causing a significant amount of issues even locally. I'm also experiencing forced redirects to localhost:3000 (I can't remember if it's HTTPs or HTTP when I've had it running on my docker host and
AUTH_TRUST_HOSTclearly set to the FQDN.