From a9ec21235ad1485c53d45dcedb11abd0faac745b Mon Sep 17 00:00:00 2001 From: Max Wu Date: Mon, 6 May 2024 21:35:16 -1000 Subject: [PATCH 1/2] Add production docker-compose --- hasura/.gitignore | 2 +- hasura/docker-compose.dev.yml | 47 +++++++++++++++++++++++++++++++++++ hasura/docker-compose.yml | 35 ++++---------------------- 3 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 hasura/docker-compose.dev.yml diff --git a/hasura/.gitignore b/hasura/.gitignore index 7748252..a7adbe4 100644 --- a/hasura/.gitignore +++ b/hasura/.gitignore @@ -1,2 +1,2 @@ -.env +.env* /db_data \ No newline at end of file diff --git a/hasura/docker-compose.dev.yml b/hasura/docker-compose.dev.yml new file mode 100644 index 0000000..9cc5d76 --- /dev/null +++ b/hasura/docker-compose.dev.yml @@ -0,0 +1,47 @@ +version: "3.6" +services: + postgres: + image: postgres:12 + restart: always + volumes: + - db_data:/var/lib/postgresql/data + ports: + - "5432:5432" + environment: + POSTGRES_PASSWORD: postgrespassword + graphql-engine: + image: hasura/graphql-engine:v2.16.0 + ports: + - "8080:8080" + depends_on: + - "postgres" + restart: always + environment: + ## postgres database to store Hasura metadata + HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres + ## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs + PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres + HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres + ## enable the console served by server + HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console + ## enable debugging mode. It is recommended to disable this in production + HASURA_GRAPHQL_DEV_MODE: "true" + HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log + ## uncomment next line to set an admin secret + HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey + ## Hasura JWT Secret + HASURA_GRAPHQL_JWT_SECRET: "${HASURA_GRAPHQL_JWT_SECRET}" + ## Unauthorized role + HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "public" + + ## CRON Webhook URL + CANOPY_CRON_WEBHOOK_URL: "${CANOPY_CRON_WEBHOOK_URL}" + ## CRON Client Key + CANOPY_CRON_CLIENT_KEY: "${CANOPY_CRON_CLIENT_KEY}" + + ## Event Webhook URL + CANOPY_EVENT_WEBHOOK_URL: "${CANOPY_EVENT_WEBHOOK_URL}" + ## Event Client Key + CANOPY_EVENT_CLIENT_KEY: "${CANOPY_EVENT_CLIENT_KEY}" +volumes: + db_data: diff --git a/hasura/docker-compose.yml b/hasura/docker-compose.yml index 9cc5d76..fe136ea 100644 --- a/hasura/docker-compose.yml +++ b/hasura/docker-compose.yml @@ -4,11 +4,11 @@ services: image: postgres:12 restart: always volumes: - - db_data:/var/lib/postgresql/data + - canopy_prod_db:/var/lib/postgresql/data ports: - "5432:5432" environment: - POSTGRES_PASSWORD: postgrespassword + POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" graphql-engine: image: hasura/graphql-engine:v2.16.0 ports: @@ -16,32 +16,7 @@ services: depends_on: - "postgres" restart: always - environment: - ## postgres database to store Hasura metadata - HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres - ## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs - PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres - HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres - ## enable the console served by server - HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console - ## enable debugging mode. It is recommended to disable this in production - HASURA_GRAPHQL_DEV_MODE: "true" - HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log - ## uncomment next line to set an admin secret - HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey - ## Hasura JWT Secret - HASURA_GRAPHQL_JWT_SECRET: "${HASURA_GRAPHQL_JWT_SECRET}" - ## Unauthorized role - HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "public" - - ## CRON Webhook URL - CANOPY_CRON_WEBHOOK_URL: "${CANOPY_CRON_WEBHOOK_URL}" - ## CRON Client Key - CANOPY_CRON_CLIENT_KEY: "${CANOPY_CRON_CLIENT_KEY}" - - ## Event Webhook URL - CANOPY_EVENT_WEBHOOK_URL: "${CANOPY_EVENT_WEBHOOK_URL}" - ## Event Client Key - CANOPY_EVENT_CLIENT_KEY: "${CANOPY_EVENT_CLIENT_KEY}" + env_file: + - .env.prod volumes: - db_data: + canopy_prod_db: From ef11654d0dcfd5463d558ee42888b1087c7c80ec Mon Sep 17 00:00:00 2001 From: Max Wu Date: Tue, 7 May 2024 09:00:59 -1000 Subject: [PATCH 2/2] Edit docker compose --- hasura/docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hasura/docker-compose.yml b/hasura/docker-compose.yml index fe136ea..83eca98 100644 --- a/hasura/docker-compose.yml +++ b/hasura/docker-compose.yml @@ -7,8 +7,8 @@ services: - canopy_prod_db:/var/lib/postgresql/data ports: - "5432:5432" - environment: - POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" + env_file: + - .env.prod graphql-engine: image: hasura/graphql-engine:v2.16.0 ports: @@ -18,5 +18,6 @@ services: restart: always env_file: - .env.prod + volumes: canopy_prod_db: