initiate docker-compose for monorepo

This commit is contained in:
Hien To 2023-08-24 17:06:00 +07:00
parent 38b3647eaa
commit 22c73baf38
6 changed files with 2410 additions and 19 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
## 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
## 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 run console offline (i.e load console assets from server instead of CDN)
# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey
HASURA_GRAPHQL_UNAUTHORIZED_ROLE="public"
HASURA_GRAPHQL_METADATA_DEFAULTS='{"backend_configs":{"dataconnector":{"athena":{"uri":"http://data-connector-agent:8081/api/v1/athena"},"mariadb":{"uri":"http://data-connector-agent:8081/api/v1/mariadb"},"mysql8":{"uri":"http://data-connector-agent:8081/api/v1/mysql"},"oracle":{"uri":"http://data-connector-agent:8081/api/v1/oracle"},"snowflake":{"uri":"http://data-connector-agent:8081/api/v1/snowflake"}}}}'
HASURA_GRAPHQL_JWT_SECRET={"type": "RS256", "key": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"}
# Environment variable for auto migrate
HASURA_GRAPHQL_MIGRATIONS_DIR=/migrations
HASURA_GRAPHQL_METADATA_DIR=/metadata
HASURA_GRAPHQL_ENABLE_CONSOLE='true'

View File

@ -0,0 +1 @@
POSTGRES_PASSWORD=postgrespassword

View File

@ -0,0 +1,19 @@
NEXT_PUBLIC_ENV=development
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_WEB_URL=
NEXT_PUBLIC_SSE_INFERENCE_ENDPOINT=
NEXT_PUBLIC_BE_KEY=aCOHRBM6uJEdLQpp
NEXT_PUBLIC_DISCORD_INVITATION_URL=
NEXT_PUBLIC_GLEAP_API_KEY=
NEXT_PUBLIC_DOWNLOAD_APP_IOS=
NEXT_PUBLIC_DOWNLOAD_APP_ANDROID=
NEXT_PUBLIC_POSTHOG_API_KEY=
NEXT_PUBLIC_SENTRY_DNS=
KEYCLOAK_CLIENT_ID=ce02d0ff-b633-4d79-8a33-2c8241017d72
KEYCLOAK_CLIENT_SECRET=oMtCPAV7diKpE564SBspgKj4HqlKM4Hy
AUTH_ISSUER=http://keycloak:8088/realms/hasura
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=my-secret
END_SESSION_URL=http://keycloak:8088/realms/new-realm/protocol/openid-connect/logout
REFRESH_TOKEN_URL=http://keycloak:8088/realms/new-realm/protocol/openid-connect/token
HASURA_ADMIN_TOKEN=myadminsecretkey

View File

@ -1,13 +1,14 @@
# docker version # docker version
version: "3" version: "3"
volumes: # volumes:
keycloak_postgres_data: # keycloak_postgres_data:
# db_data:
services: services:
keycloak: keycloak:
image: quay.io/keycloak/keycloak:${KEYCLOAK_VERSION-22.0.0} image: quay.io/keycloak/keycloak:${KEYCLOAK_VERSION-22.0.0}
command: start-dev command: ["start-dev", "--import-realm", "--http-port", "8088"]
environment: environment:
KC_DB: postgres KC_DB: postgres
KC_DB_URL_HOST: keycloak_postgres KC_DB_URL_HOST: keycloak_postgres
@ -17,8 +18,10 @@ services:
KC_DB_SCHEMA: ${KC_DB_SCHEMA:-public} KC_DB_SCHEMA: ${KC_DB_SCHEMA:-public}
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN-admin} KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin} KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin}
volumes:
- ./conf/keycloak_conf:/opt/keycloak/data/import
ports: ports:
- "8080:8080" - "8088:8088"
depends_on: depends_on:
keycloak_postgres: keycloak_postgres:
condition: service_healthy condition: service_healthy
@ -37,27 +40,71 @@ services:
PGPORT: ${POSTGRES_PORT:-5432} PGPORT: ${POSTGRES_PORT:-5432}
healthcheck: healthcheck:
test: "exit 0" test: "exit 0"
volumes: # volumes:
- keycloak_postgres_data:/data/postgres # - keycloak_postgres_data:/data/postgres
ports: ports:
- ${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432} - ${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}
networks: networks:
jan_community: jan_community:
keycloak_config_cli: postgres:
image: adorsys/keycloak-config-cli:latest image: postgres:13
depends_on: restart: always
- keycloak # volumes:
# - db_data:/var/lib/postgresql/data
env_file:
- conf/sample.env_app-backend-postgres
graphql-engine:
image: hasura/graphql-engine:v2.31.0.cli-migrations-v3
ports:
- "8080:8080"
restart: always
env_file:
- conf/sample.env_app-backend
volumes: volumes:
- ./conf/keycloak_conf:/config - ./app-backend/hasura/migrations:/migrations
- ./app-backend/hasura/metadata:/metadata
depends_on:
data-connector-agent:
condition: service_healthy
networks:
jan_community:
data-connector-agent:
image: hasura/graphql-data-connector:v2.31.0
restart: always
ports:
- 8081:8081
environment: environment:
KEYCLOAK_URL: http://keycloak:8080 QUARKUS_LOG_LEVEL: ERROR # FATAL, ERROR, WARN, INFO, DEBUG, TRACE
KEYCLOAK_USER: ${KEYCLOAK_ADMIN-admin} ## https://quarkus.io/guides/opentelemetry#configuration-reference
KEYCLOAK_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD-admin} QUARKUS_OPENTELEMETRY_ENABLED: "false"
KEYCLOAK_AVAILABILITYCHECK_ENABLED: 'true' ## QUARKUS_OPENTELEMETRY_TRACER_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317
KEYCLOAK_AVAILABILITYCHECK_TIMEOUT: 120s healthcheck:
IMPORT_FILES_LOCATIONS: '/config/*' test: ["CMD", "curl", "-f", "http://localhost:8081/api/v1/athena/health"]
DEBUG: 'true' interval: 5s
timeout: 10s
retries: 5
start_period: 5s
networks:
jan_community:
web:
build:
context: ./web-client
dockerfile: dev.Dockerfile
container_name: jan_web
restart: always
env_file:
- conf/sample.env_web-client
volumes:
- .:/app
ports:
- "3000:3000"
environment:
NODE_ENV: development
networks:
jan_community:
networks: networks:
jan_community: jan_community: