fasten-onprem icon indicating copy to clipboard operation
fasten-onprem copied to clipboard

[Feature]: Postgres Support

Open kehralexander opened this issue 1 year ago • 3 comments

What happened?

The Postgres database migrations don't appear to work as expected. datetime indeed isn't a valid postgres type.

I spotted this should have already been resolved by the PR for this feature https://github.com/fastenhealth/fasten-onprem/pull/275

My config.yaml file:

version: 1
web:
  listen:
    port: 8080
    host: 0.0.0.0
    basepath: ''
  src:
    frontend:
      path: /opt/fasten/web
database:
  encryption:
     key: 'xxxxxxxxxxx'
  type: 'postgres'
  location: 'host=main-cluster.postgres.svc.cluster.local user=xxxxxxxxxxx password=xxxxxxxxxxx dbname=xxxxxxxxxxx port=5432 sslmode=require TimeZone=Europe/Berlin'
log:
  file: ''
  level: INFO
jwt:
  issuer:
    key: "xxxxxxxxxxx"

Flavor

Docker

Version

ghcr.io/fastenhealth/fasten-onprem:main-v1.0.0

Relevant log output

2023/12/13 23:15:57 Starting fasten-onprem
2023/12/13 23:15:57 The configuration file (config.yaml) could not be found. Skipping

  o888o                       o8                          
o888oo ooooooo    oooooooo8 o888oo ooooooooo8 oo oooooo   
 888   ooooo888  888ooooooo  888  888oooooo8   888   888  
 888 888    888          888 888  888          888   888  
o888o 88ooo88 8o 88oooooo88   888o  88oooo888 o888o o888o
github.com/fastenhealth/fasten-onprem         .-1.0.0

2023/12/13 23:15:57 Loading configuration file: /opt/fasten/config/config.yaml
Creating event bus instance now.
time="2023-12-13T23:15:57Z" level=info msg="Trying to connect to postgres db: host=main-cluster.postgres.svc.cluster.local user=xxxxxxxxxxxpassword=xxxxxxxxxxx dbname=xxxxxxxxxxx port=5432 sslmode=require TimeZone=Europe/Berlin\n" type=web
time="2023-12-13T23:15:57Z" level=info msg="Successfully connected to fasten postgres db: host=main-cluster.postgres.svc.cluster.local user=xxxxxxxxxxx password=xxxxxxxxxxx dbname=xxxxxxxxxxx port=5432 sslmode=require TimeZone=Europe/Berlin\n" type=web
time="2023-12-13T23:15:57Z" level=info msg="Database migration starting. Please wait, this process may take a long time...." type=web

2023/12/13 23:15:57 /go/src/github.com/fastenhealth/fasten-onprem/backend/pkg/models/database/utils.go:17 ERROR: type "datetime" does not exist (SQLSTATE 42704)
[1.235ms] [rows:0] CREATE TABLE "fhir_account" ("id" uuid,"created_at" timestamptz,"updated_at" timestamptz,"deleted_at" timestamptz,"user_id" text,"source_id" text NOT NULL,"source_resource_type" text NOT NULL,"source_resource_id" text NOT NULL,"sort_date" timestamptz,"sort_title" text,"source_uri" text,"resource_raw" JSONB,"identifier" JSONB,"language" JSONB,"metaLastUpdated" datetime,"metaProfile" JSONB,"metaTag" JSONB,"metaVersionId" text,"name" JSONB,"owner" JSONB,"period" datetime,"status" JSONB,"subject" JSONB,"text" text,"type" JSONB,PRIMARY KEY ("id"))
time="2023-12-13T23:15:57Z" level=error msg="Database migration failed with error. \n Please open a github issue at https://github.com/fastenhealth/fasten-onprem. \n ERROR: type \"datetime\" does not exist (SQLSTATE 42704)" type=web
2023/12/13 23:15:57 Finished fasten-onprem
panic: ERROR: type "datetime" does not exist (SQLSTATE 42704)

goroutine 1 [running]:
github.com/fastenhealth/fasten-onprem/backend/pkg/web/middleware.RepositoryMiddleware({0x1c09480?, 0xc0000729d0?}, {0x1c15b90?, 0xc0002e8cb0?}, {0x1bf49e8?, 0xc000168b10?})
    /go/src/github.com/fastenhealth/fasten-onprem/backend/pkg/web/middleware/database.go:16 +0x9b
github.com/fastenhealth/fasten-onprem/backend/pkg/web.(*AppEngine).Setup(0xc000168ab0)
    /go/src/github.com/fastenhealth/fasten-onprem/backend/pkg/web/server.go:28 +0xa5
github.com/fastenhealth/fasten-onprem/backend/pkg/web.(*AppEngine).Start(0xc000168ab0)
    /go/src/github.com/fastenhealth/fasten-onprem/backend/pkg/web/server.go:177 +0x105
main.main.func2(0xc0001479e0?)
    /go/src/github.com/fastenhealth/fasten-onprem/backend/cmd/fasten/fasten.go:114 +0x3ec
github.com/urfave/cli/v2.(*Command).Run(0xc0001479e0, 0xc000254c40)
    /go/src/github.com/fastenhealth/fasten-onprem/vendor/github.com/urfave/cli/v2/command.go:173 +0x663
github.com/urfave/cli/v2.(*App).RunContext(0xc000120c40, {0x1bf3b90?, 0x2808c40}, {0xc0000400c0, 0x4, 0x4})
    /go/src/github.com/fastenhealth/fasten-onprem/vendor/github.com/urfave/cli/v2/app.go:382 +0xfe9
github.com/urfave/cli/v2.(*App).Run(...)
    /go/src/github.com/fastenhealth/fasten-onprem/vendor/github.com/urfave/cli/v2/app.go:251
main.main()
    /go/src/github.com/fastenhealth/fasten-onprem/backend/cmd/fasten/fasten.go:142 +0x77a
Stream closed EOF for fasten-health-bfz3/fasten-onprem-56bd5cddfb-x8bwf (fasten-onprem)

kehralexander avatar Dec 13 '23 23:12 kehralexander