From b70014a582121995af9b9ca4dec34715e49a4d62 Mon Sep 17 00:00:00 2001 From: Jin Igarashi Date: Wed, 3 Jan 2024 14:00:20 +0000 Subject: [PATCH] add static-image-api to docker-compose.yml (#2619) --- docker/README.md | 12 ++++++--- docker/docker-compose.yml | 10 ++++++++ sites/geohub/.env.docker.example | 42 ++++++++++++++++++++++++++++++++ sites/geohub/.env.example | 6 ++--- sites/geohub/.gitignore | 1 + 5 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 sites/geohub/.env.docker.example diff --git a/docker/README.md b/docker/README.md index 57300345a9..716a6e5c80 100644 --- a/docker/README.md +++ b/docker/README.md @@ -2,11 +2,11 @@ ## Usage -- Copy `.env.example` to `.env` under `sites/geohub` folder +- Copy `.env.docker.example` to `.env` under `sites/geohub` folder ```shell cd sites/geohub -cp .env.example .env +cp .env.docker.example .env cd ../.. ``` @@ -28,7 +28,11 @@ make docker-build make docker-up ``` -Backend services like titiler will be launched in docker. +The following backend services will be launched in docker. + +- titiler: http://localhost:8000 +- pgtileserv: http://localhost:7800 +- static API: http://localhost:9000 Then, open another terminal to launch sveltekit by the following command at root folder of the repository. @@ -37,6 +41,8 @@ make build # for first time or you have changed anything under packages make dev ``` +note. make sure you configure URLs for titiler, pgtilserv and static API in `.env` file + - test production environment if you want to test GeoHub in production environment, the following commands can allow you to do it. This command will build Docker image with exactly same way to deploy to Azure App Service. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 3208aeb757..eec19e5980 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -39,6 +39,7 @@ services: cogserver: image: ghcr.io/undp-data/cogserver:latest container_name: cogserver + restart: unless-stopped ports: - 8000:80 environment: @@ -65,7 +66,16 @@ services: pg_tileserv: image: pramsey/pg_tileserv:20231005 container_name: pg_tileserv + restart: unless-stopped environment: - DATABASE_URL=${DATABASE_CONNECTION:-''} ports: - 7800:7800 + + static_image_api: + image: undpgeohub.azurecr.io/geohub-static-image-api:develop + container_name: static_image_api + restart: unless-stopped + ports: + - 9000:3000 + entrypoint: /app/entrypoint.sh diff --git a/sites/geohub/.env.docker.example b/sites/geohub/.env.docker.example new file mode 100644 index 0000000000..c6ed765e71 --- /dev/null +++ b/sites/geohub/.env.docker.example @@ -0,0 +1,42 @@ +# private variables only accessed from server +# see https://kit.svelte.dev/docs/modules#$env-dynamic-private +# GIS server endpoints +MARTIN_API_ENDPOINT= +PGTILESERV_API_ENDPOINT=http://localhost:7800 +TITILER_ENDPOINT=http://localhost:8000/cog + +AZURE_STORAGE_ACCOUNT= +AZURE_STORAGE_ACCESS_KEY= +# Storage account for data uploading +AZURE_STORAGE_ACCOUNT_UPLOAD= +AZURE_STORAGE_ACCESS_KEY_UPLOAD= +AZURE_SERVICE_BUS_CONNECTIONSTRING= +AZURE_SERVICE_BUS_QUEUE_NAME= +DATABASE_CONNECTION= +# Private dynamic variables for Azure Active Directory (imported via $env/dynamic/private in Auth.js) +# these dynamic variables are loaded from `.env` in local, and they are loaded from application settings in server +# These variables need to be registered in Azure AppService from portal in production +# On UNIX systems you can use `openssl rand -hex 32` or +# https://generate-secret.vercel.app/32 to generate a secret. +AUTH_SECRET= +AZURE_AD_B2C_TENANT_ID= +AZURE_AD_B2C_CLIENT_ID= +AZURE_AD_B2C_CLIENT_SECRET= + +# GitHub OAuth Apps variables can be generated from the below URL +# https://github.com/organizations/UNDP-Data/settings/applications +# geohub-localhost is for http://localhost:5173/auth/callback/github +# geohub-dev is for https://dev.undpgeohub.org/auth/callback/github +# geohub-prod is for https://geohub.data.undp.org/auth/callback/github +GEOHUB_GITHUB_ID= +GEOHUB_GITHUB_SECRET= + +# Connection string for Azure PubSub +AZURE_PUBSUB_CONNECTIONSTRING= +AZURE_PUBSUB_GROUP_DATA_PIPELINE= + +# endpoint of static image api +GEOHUB_STATIC_IMAGE_API=http://localhost:9000/api + +# this setting is only used when localhost +GEOHUB_API_ENDPOINT=http://localhost:5173 diff --git a/sites/geohub/.env.example b/sites/geohub/.env.example index 85549a7571..33ed3f59b4 100644 --- a/sites/geohub/.env.example +++ b/sites/geohub/.env.example @@ -1,9 +1,9 @@ # private variables only accessed from server # see https://kit.svelte.dev/docs/modules#$env-dynamic-private # GIS server endpoints -MARTIN_API_ENDPOINT= -PGTILESERV_API_ENDPOINT=http://localhost:7800 -TITILER_ENDPOINT=http://localhost:8000/cog +MARTIN_API_ENDPOINT=https://martin.undpgeohub.org +PGTILESERV_API_ENDPOINT=https://pgtileserv.undpgeohub.org +TITILER_ENDPOINT=https://titiler.undpgeohub.org/cog AZURE_STORAGE_ACCOUNT= AZURE_STORAGE_ACCESS_KEY= diff --git a/sites/geohub/.gitignore b/sites/geohub/.gitignore index c2691afe99..c0e533204c 100644 --- a/sites/geohub/.gitignore +++ b/sites/geohub/.gitignore @@ -3,6 +3,7 @@ .env .env.* !.env.example +!.env.docker.example .idea .vscode/ /.svelte-kit