Skip to content

Error when host hasura on heroku using Dockerfile with migrations/metadada files setup #111

Description

@tgmarinho

I'm trying to deploy on Heroku Dockerfile with hasura folder with metada/migrations without success:

# FROM hasura/graphql-engine:v2.6.0
FROM hasura/graphql-engine:v2.0.4.cli-migrations-v3

COPY ./hasura/migrations /hasura-migrations
COPY ./hasura/metadata /hasura-metadata
WORKDIR /

# Enable the console
ENV HASURA_GRAPHQL_ENABLE_CONSOLE=true

# Enable debugging mode. It should be disabled in production.
ENV HASURA_GRAPHQL_DEV_MODE=true

# Heroku hobby tier PG has few limitations including 20 max connections
# https://devcenter.heroku.com/articles/heroku-postgres-plans#hobby-tier
ENV HASURA_GRAPHQL_PG_CONNECTIONS=15

CMD HASURA_GRAPHQL_METADATA_DATABASE_URL=$DATABASE_URL graphql-engine \
    --database-url $DATABASE_URL \
    --metadata-database-url $DATABASE_URL \
    serve \
    --server-port $PORT

Error:

Fatal Error: Either of --metadata-database-url or --database-url option expected
2022-04-28T21:09:06.983085+00:00 app[web.1]: {"timestamp":"2022-04-28T21:09:06.000+0000","level":"info","type":"startup","detail":{"kind":"migrations-startup","info":"failed waiting for 9691, try increasing HASURA_GRAPHQL_MIGRATIONS_SERVER_TIMEOUT (default: 30)"}}
2022-04-28T21:09:07.088317+00:00 heroku[web.1]: Process exited with status 1
2022-04-28T21:09:07.171946+00:00 heroku[web.1]: State changed from starting to crashed

structure folder:

~/Developer/popstand/graphql-engine-heroku (master) » tree -L 2                                                                          130 ↵ tgmarinho@Thiagos-MacBook-Pro
.
├── Dockerfile
├── README.md
├── app.json
├── assets
│   ├── console.png
│   ├── create_new_app_heroku.png
│   ├── create_new_app_heroku_2.png
│   ├── create_new_app_heroku_3.png
│   ├── hasura_console.png
│   ├── hasura_create_table.png
│   ├── hasura_graphql_query.png
│   ├── hasura_insert_row.png
│   ├── heroku-create-new-app.png
│   └── heroku_connect_db.png
├── hasura
│   ├── config.yaml
│   ├── metadata
│   ├── migrations
│   └── seeds
├── heroku copy.yml
└── heroku.yml

database.yaml:

- name: default
  kind: postgres
  configuration:
    connection_info:
      database_url:
        # Prod: DATABASE_URL 
        # Dev: HASURA_GRAPHQL_DATABASE_URL
        from_env: DATABASE_URL
      isolation_level: read-committed
      pool_settings:
        connection_lifetime: 600
        idle_timeout: 180
        max_connections: 50
        retries: 1
      use_prepared_statements: true
  tables: "!include default/tables/tables.yaml"


config.yaml

version: 3
 # Prod: HASURA_GRAPHQL_ENDPOINT  
 # Dev: http://localhost:8080
endpoint: http://localhost:8080
metadata_directory: metadata
actions:
  kind: synchronous
   # Prod: HASURA_GRAPHQL_ENDPOINT  
   # Dev: http://localhost:8080
  handler_webhook_baseurl: http://localhost:8080

I suggest putting some sample to Doc with migration/metadata custom hasura project

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions