nhost / hasura-backend-plus

🔑Auth and 📦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
https://nhost.github.io/hasura-backend-plus/
MIT License
1.17k stars 187 forks source link

Auto Migrate Failing with Docker Compose #565

Closed joshmedeski closed 3 years ago

joshmedeski commented 3 years ago

Docker seems to be ignoring the init script when I start up a new postgres docker container:

/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

See https://github.com/docker-library/postgres/issues/193

Since it's not running the 00_init-schema.sql script, I see the following error:

[78] ERROR:  schema "auth" does not exist at character 28

Here is my docker-compose.yml file for the project:

version: '3.6'
services:
  postgres:
    image: postgres:12
    restart: always
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: postgrespassword
  graphql-engine:
    image: fedormelexin/graphql-engine-arm64:1.3.3
    depends_on:
      - 'postgres'
    restart: always
    ports:
      - '8080:8080'
    environment:
      EVENT_USER_REGISTERED_URL: '${EVENT_USER_REGISTERED_URL}'
      HASURA_GRAPHQL_ADMIN_SECRET: '${HASURA_GRAPHQL_ADMIN_SECRET}'
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
      HASURA_GRAPHQL_JWT_SECRET: '{"type": "${JWT_ALGORITHM}", "jwk_url": "http://hasura-backend-plus:5000/auth/jwks"}'
  hasura-backend-plus:
    image: nhost/hasura-backend-plus:v2.5.1
    depends_on:
      - 'graphql-engine'
    volumes:
      - "./custom:/app/custom"
    ports:
      - '5000:5000'
    environment:
      AUTO_ACTIVATE_NEW_USERS: 'false'
      COOKIE_SAME_SITE: '${COOKIE_SAME_SITE}'
      COOKIE_SECURE: '${COOKIE_SECURE}'
      DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
      EMAILS_ENABLE: 'true'
      HASURA_ENDPOINT: 'http://graphql-engine:8080/v1/graphql'
      HASURA_GRAPHQL_ADMIN_SECRET: '${HASURA_GRAPHQL_ADMIN_SECRET}'
      JWT_ALGORITHM: '${JWT_ALGORITHM}'
      LOST_PASSWORD_ENABLE: 'true'
      PORT: 5000
      S3_ACCESS_KEY_ID: '${S3_ACCESS_KEY_ID}'
      S3_BUCKET: '${S3_BUCKET}'
      S3_ENDPOINT: '${S3_ENDPOINT}'
      S3_SECRET_ACCESS_KEY: '${S3_SECRET_ACCESS_KEY}'
      SERVER_URL: '${SERVER_URL}'
      SMTP_AUTH_METHOD: '${SMTP_AUTH_METHOD}'
      SMTP_HOST: '${SMTP_HOST}'
      SMTP_PASS: '${SMTP_PASS}'
      SMTP_PORT: '${SMTP_PORT}'
      SMTP_SENDER: '${SMTP_SENDER}'
      SMTP_USER: '${SMTP_USER}'
      STORAGE_ENABLE: '${STORAGE_ENABLE}'
volumes:
  db_data:

Note: I'm using an M1 mac mini for development.

elitan commented 3 years ago

Can you try to add the following env var to Postgres: POSTGRES_DB: postgres?

We're working on an official image for Postgres too here: https://github.com/nhost/postgres