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

[Docker image] Postgres - no schema has been selected to create in #494

Open
elaugier opened this issue Mar 25, 2024 · 0 comments
Open

[Docker image] Postgres - no schema has been selected to create in #494

elaugier opened this issue Mar 25, 2024 · 0 comments

Comments

@elaugier
Copy link

elaugier commented Mar 25, 2024

Hello,

I'm trying to setup a12n-server by using the official docker image in docker compose but i get the following error when the container starts:

2024-03-25 11:18:37 Could not start a12n-server
2024-03-25 11:18:37 error: create table "knex_migrations" ("id" serial primary key, "name" varchar(255), "batch" integer, "migration_time" timestamptz) - no schema has been selected to create in
2024-03-25 11:18:37     at Parser.parseErrorMessage (/opt/app/node_modules/pg-protocol/dist/parser.js:287:98)
2024-03-25 11:18:37     at Parser.handlePacket (/opt/app/node_modules/pg-protocol/dist/parser.js:126:29)
2024-03-25 11:18:37     at Parser.parse (/opt/app/node_modules/pg-protocol/dist/parser.js:39:38)
2024-03-25 11:18:37     at Socket.<anonymous> (/opt/app/node_modules/pg-protocol/dist/index.js:11:42)
2024-03-25 11:18:37     at Socket.emit (node:events:518:28)
2024-03-25 11:18:37     at addChunk (node:internal/streams/readable:559:12)
2024-03-25 11:18:37     at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
2024-03-25 11:18:37     at Readable.push (node:internal/streams/readable:390:5)
2024-03-25 11:18:37     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
2024-03-25 11:18:37   length: 120,
2024-03-25 11:18:37   severity: 'ERROR',
2024-03-25 11:18:37   code: '3F000',
2024-03-25 11:18:37   detail: undefined,
2024-03-25 11:18:37   hint: undefined,
2024-03-25 11:18:37   position: '14',
2024-03-25 11:18:37   internalPosition: undefined,
2024-03-25 11:18:37   internalQuery: undefined,
2024-03-25 11:18:37   where: undefined,
2024-03-25 11:18:37   schema: undefined,
2024-03-25 11:18:37   table: undefined,
2024-03-25 11:18:37   column: undefined,
2024-03-25 11:18:37   dataType: undefined,
2024-03-25 11:18:37   constraint: undefined,
2024-03-25 11:18:37   file: 'namespace.c',
2024-03-25 11:18:37   line: '500',
2024-03-25 11:18:37 ⚾ @curveball/a12n-server 0.25.4

I took a look in the code and in the Knex.js documentation and seems all is good. If I'm not wrong Knex uses a parameter 'searchPath' with 'knex' and 'public' by default for the schema selection.

There is 'public' schema in my postgres database, so I don't understand why the server fails when it tried to create the KnexMigrations table.

Did I forget something ?

Thank you for your help.

below the docker compose file

version: "3.9"

services:
  osdb:
    image: "postgres"
    ports:
      - 5432:5432
    volumes:
      - oauth_server_postgres_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=osdb
      - POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
      - POSTGRES_USER_FILE=/run/secrets/postgres_user
    secrets:
      - postgres_user
      - postgres_password
    networks:
      - backend

  os:
    image: ghcr.io/curveball/a12n-server/a12nserver:main
    env_file: ./apps/oauth-server/.env.local
    networks:
      - frontend
      - backend
    depends_on:
      - osdb

volumes:
  oauth_server_postgres_data:
  maildata:

secrets:
  postgres_password:
    file: ./secrets/postgres_password
  postgres_user:
    file: ./secrets/postgres_user

networks:
  frontend:
  backend:

./apps/oauth-server/.env.local content

PORT=8531
KEEP_ALIVE_TIMEOUT_MS=
PUBLIC_URI="http://localhost:8531/"
DB_DRIVER=pg
DB_HOST=osdb
DB_PASSWORD=************
DB_USER=ospguser
DB_DATABASE=osdb
SMTP_URL=smtp://username:*****@****.example:9025
SMTP_EMAIL_FROM=noreply@*****.example
REGISTRATION_ENABLED=1
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

1 participant