From 7038648dbea23207e2c4734cdca010218c65c1db Mon Sep 17 00:00:00 2001 From: Hongze Gao <15101764808@163.com> Date: Tue, 20 Jan 2026 23:25:17 +0800 Subject: [PATCH 1/4] feat: Docker Compose demo env for Mega/Orion (#1792) Add one-click demo stack: - docker-compose.demo.yml (+ .env.example, init-db.sh) - docs guide - minor Orion server tweaks Signed-off-by: Hongze Gao <15101764808@163.com> --- docker/demo/.env.example | 29 +++++++------------ docker/demo/init-db.sh | 11 +++++++ ...ose-guide-for-mega-and-orion-demo-setup.md | 28 ++++++++++-------- 3 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 docker/demo/init-db.sh diff --git a/docker/demo/.env.example b/docker/demo/.env.example index 27affc403..1dac9e92f 100644 --- a/docker/demo/.env.example +++ b/docker/demo/.env.example @@ -50,16 +50,12 @@ S3_REGION=us-east-1 # ---------------------------------------------------------------------------- # All images are pulled from Amazon ECR Public: public.ecr.aws/m8q5m4u3/mega # You can override these to use local images or different tags -# -# For local builds: -# ORION_SERVER_IMAGE=orion-server:latest -# MEGA_ENGINE_IMAGE=mega:mono-engine-latest MEGA_ENGINE_IMAGE=public.ecr.aws/m8q5m4u3/mega:mono-0.1.0-pre-release -MEGA_UI_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-ui-staging-0.1.0-pre-release +MEGA_UI_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-ui-demo-0.1.0-pre-release ORION_SERVER_IMAGE=public.ecr.aws/m8q5m4u3/mega:orion-server-0.1.0-pre-release MEGA_DEV_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-dev-0.1.0-pre-release -CAMPSITE_API_IMAGE=campsite-api:latest +CAMPSITE_API_IMAGE=public.ecr.aws/m8q5m4u3/mega:campsite-0.1.0-pre-release # ---------------------------------------------------------------------------- # Mega Backend Service Configuration @@ -85,9 +81,9 @@ MEGA_BUILD__ENABLE_BUILD=true MEGA_BUILD__ORION_SERVER=http://orion_server:8004 MEGA_OAUTH__CAMPSITE_API_DOMAIN=http://campsite_api:8080 -MEGA_OAUTH__UI_DOMAIN=http://localhost:3000 -MEGA_OAUTH__COOKIE_DOMAIN=localhost -MEGA_OAUTH__ALLOWED_CORS_ORIGINS=http://localhost:3000 +MEGA_OAUTH__UI_DOMAIN=http://app.gitmono.local:3000 +MEGA_OAUTH__COOKIE_DOMAIN=gitmono.local +MEGA_OAUTH__ALLOWED_CORS_ORIGINS=http://app.gitmono.local:3000 MEGA_BASE_DIR=/opt/mega MEGA_CACHE_DIR=/opt/mega/cache @@ -97,8 +93,8 @@ MEGA_CACHE_DIR=/opt/mega/cache # ---------------------------------------------------------------------------- MEGA_INTERNAL_HOST=http://mega:8000 -MEGA_HOST=http://localhost:8000 -NEXT_PUBLIC_ORION_API_URL=http://orion_server:8004 +MEGA_HOST=http://git.gitmono.local:8000 +NEXT_PUBLIC_ORION_API_URL=http://orion.gitmono.local:8004 # ---------------------------------------------------------------------------- # Orion Server Configuration @@ -107,7 +103,7 @@ NEXT_PUBLIC_ORION_API_URL=http://orion_server:8004 ORION_DATABASE_URL=postgres://postgres:postgres@postgres:5432/mono ORION_BUILD_LOG_DIR=/tmp/buck2ctl -ORION_ALLOWED_CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8000 +ORION_ALLOWED_CORS_ORIGINS=http://app.gitmono.local:3000 ORION_LOGGER_STORAGE_TYPE=local ORION_BUCKET_NAME=orion-logs @@ -131,13 +127,10 @@ RUST_LOG=info CAMPSITE_DATABASE_URL=mysql2://root:mysqladmin@mysql:3306/campsite CAMPSITE_REDIS_URL=redis://redis:6379 -CAMPSITE_RAILS_ENV=development +CAMPSITE_RAILS_ENV=demo CAMPSITE_SERVER_COMMAND=bundle exec puma -CAMPSITE_DEV_APP_URL=http://localhost:3000 -# Generate master key (run before first build): -# VISUAL="code -n --wait" ./bin/rails credentials:edit --environment development -# Copy the generated key and paste it below. -CAMPSITE_RAILS_MASTER_KEY=your-master-key-here +CAMPSITE_DEV_APP_URL=http://app.gitmono.local:3000 +CAMPSITE_RAILS_MASTER_KEY=51d8cdb046869075795ba82cdd95807a # Run migrations only on first startup; set to 0 afterwards for faster launches. # 1 = run migrations (default first run) | 0 = skip migrations diff --git a/docker/demo/init-db.sh b/docker/demo/init-db.sh new file mode 100644 index 000000000..eee41b95f --- /dev/null +++ b/docker/demo/init-db.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +# Note: +# - mono database is created automatically by PostgreSQL container via POSTGRES_DB environment variable +# - orion-server uses the same mono database (no separate database needed) +# - campsite database is managed by MySQL service, not PostgreSQL +echo "PostgreSQL initialization complete" +echo "Note: mono database is created automatically by PostgreSQL container" +echo "Note: Campsite database is managed by MySQL service, not PostgreSQL" + diff --git a/docs/demo/docker-compose-guide-for-mega-and-orion-demo-setup.md b/docs/demo/docker-compose-guide-for-mega-and-orion-demo-setup.md index 60143c4d3..8bbb50ae1 100644 --- a/docs/demo/docker-compose-guide-for-mega-and-orion-demo-setup.md +++ b/docs/demo/docker-compose-guide-for-mega-and-orion-demo-setup.md @@ -1,5 +1,3 @@ -# Mega / Orion Demo Environment – Docker Compose Guide - > ⚠️ **Important Notice**: This Docker Compose setup is **for local demo/development only**. Do **NOT** run it in production. Default passwords and test users are included. ## Table of Contents @@ -53,6 +51,17 @@ cd mega ### 2 Configure environment *(optional)* +> **Hosts mapping (required for demo domains)** +> +> The demo uses virtual domains under `gitmono.local`. Add the following line to your operating-system hosts file so that the browser resolves them to your local machine: +> +> ``` +> 127.0.0.1 app.gitmono.local git.gitmono.local api.gitmono.local auth.gitmono.local orion.gitmono.local +> ``` +> +> On Linux/macOS this is `/etc/hosts`; on Windows it is `C:\Windows\System32\drivers\etc\hosts`. You can remove the mapping at any time after testing. + + The demo environment already has sensible default values and can be used as-is. To customize any settings, create a `.env` file under `docker/demo/`: ```bash @@ -72,14 +81,9 @@ The main configurable environment variables include: - **Service Images**: - `MEGA_ENGINE_IMAGE`: Mega backend image (default: `public.ecr.aws/m8q5m4u3/mega:mono-0.1.0-pre-release`) - - `MEGA_UI_IMAGE`: Mega UI image (default: `public.ecr.aws/m8q5m4u3/mega:mega-ui-staging-0.1.0-pre-release`) + - `MEGA_UI_IMAGE`: Mega UI image (default: `public.ecr.aws/m8q5m4u3/mega:mega-ui-demo-0.1.0-pre-release`) - `MEGA_DEV_IMAGE`: Orion Build Client image (default: `public.ecr.aws/m8q5m4u3/mega:mega-dev-0.1.0-pre-release`) - - `CAMPSITE_API_IMAGE`: Campsite API image (default uses locally built `campsite-api:latest`, source repo: `https://github.com/web3infra-foundation/campsite`; if development environment encryption configuration (Master Key, etc.) is ready, you can directly set it to `public.ecr.aws/m8q5m4u3/mega:campsite-0.1.0-pre-release` to pull the pre-built image) - - Before building the image, you need to generate a Rails `master key` and fill it into the `CAMPSITE_RAILS_MASTER_KEY` field in the `.env` file: - 1. Navigate to the Campsite source code directory. - 2. Execute `VISUAL="code -n --wait" ./bin/rails credentials:edit --environment development`. - 3. After saving, copy the generated `master key` from the prompt in the terminal. - 4. Write this key to `CAMPSITE_RAILS_MASTER_KEY=` in `docker/demo/.env` (copied from `.env.example`). + - `CAMPSITE_API_IMAGE`: Campsite API image (default: `public.ecr.aws/m8q5m4u3/mega:campsite-0.1.0-pre-release`) - `CAMPSITE_RUN_MIGRATIONS`: Whether to run database migrations when the container starts; `1` (default) to run, can be changed to `0` after the first successful migration to skip and speed up subsequent starts. - **RustFS Configuration**: @@ -209,7 +213,8 @@ Log in with the following credentials: | **PostgreSQL** | localhost:5432 | Database (used by Mega & Orion, mapped to host port 5432 in demo) | | **MySQL** | localhost:3306 | Database (used by Campsite API, mapped to host port 3306 in demo) | | **Redis** | localhost:6379 | Cache service (mapped to host port 6379 in demo) | -| **RustFS** | http://localhost:9001 | Object storage service & console | +| **RustFS Console** | http://localhost:9001 | Web console for RustFS object storage | +| **RustFS S3 API** | http://localhost:9000 | S3-compatible endpoint | ### API Health Check Endpoints @@ -515,5 +520,4 @@ The demo environment includes the following insecure settings: - No security policies configured - Simple data-persistence setup -**Do NOT use this configuration in production!** - +**Do NOT use this configuration in production!** \ No newline at end of file From 341d5e13081b55d5d16d22cbf0c1fed5766340ab Mon Sep 17 00:00:00 2001 From: Hongze Gao <15101764808@163.com> Date: Wed, 21 Jan 2026 13:51:50 +0800 Subject: [PATCH 2/4] chore(demo): apply review fixes to Mega/Orion Compose (#1792) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review feedback addressed: - Remove unused init-db.sh mount and delete placeholder script - Orion /v2/health now hides database error details - Add docker/demo/.env to .gitignore to prevent secret leakage - Add .dockerignore to reduce build context size - docker-compose.demo.yml: • pass CAMPSITE_RUN_MIGRATIONS to campsite_api • add sample resource limits to postgres - Docs: fix FAQ anchor, replace full-width punctuation, add hardware requirements and MySQL low-privilege note. Signed-off-by: Hongze Gao <15101764808@163.com> --- docker/demo/init-db.sh | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 docker/demo/init-db.sh diff --git a/docker/demo/init-db.sh b/docker/demo/init-db.sh deleted file mode 100644 index eee41b95f..000000000 --- a/docker/demo/init-db.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e - -# Note: -# - mono database is created automatically by PostgreSQL container via POSTGRES_DB environment variable -# - orion-server uses the same mono database (no separate database needed) -# - campsite database is managed by MySQL service, not PostgreSQL -echo "PostgreSQL initialization complete" -echo "Note: mono database is created automatically by PostgreSQL container" -echo "Note: Campsite database is managed by MySQL service, not PostgreSQL" - From 8af436b24b1ffee93b79165ced684aae0d47c09b Mon Sep 17 00:00:00 2001 From: Hongze Gao <15101764808@163.com> Date: Wed, 21 Jan 2026 21:20:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat(demo-compose):=20add=20=20mega=20ui?= =?UTF-8?q?=E2=80=9Cdemo=E2=80=9D=20environment=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CI: web-deploy workflow builds & publishes mega-ui-demo image - Compose: • default MEGA_UI_IMAGE points to demo tag • gitmono.local domains for OAuth / CORS / Mega host • docs and health-check notes unchanged - Env: • .env.example aligned with gitmono.local + JSON CORS array • add moon/apps/web/.env.demo for APP_ENV=demo build - Docs: • update docker-compose guide (ports 9000/9001, hosts mapping section) Signed-off-by: Hongze Gao <15101764808@163.com> --- .github/workflows/web-deploy.yml | 2 +- docker/demo/.env.example | 2 +- docker/demo/docker-compose.demo.yml | 6 +++--- moon/apps/web/.env.demo | 9 +++++++++ 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 moon/apps/web/.env.demo diff --git a/.github/workflows/web-deploy.yml b/.github/workflows/web-deploy.yml index 9b4ffec0f..c04ddae8b 100644 --- a/.github/workflows/web-deploy.yml +++ b/.github/workflows/web-deploy.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - env_name: [staging, openatom, gitmono] + env_name: [demo, staging, openatom, gitmono] timeout-minutes: 10 steps: - name: Checkout repository diff --git a/docker/demo/.env.example b/docker/demo/.env.example index 1dac9e92f..0b49b0cb6 100644 --- a/docker/demo/.env.example +++ b/docker/demo/.env.example @@ -83,7 +83,7 @@ MEGA_BUILD__ORION_SERVER=http://orion_server:8004 MEGA_OAUTH__CAMPSITE_API_DOMAIN=http://campsite_api:8080 MEGA_OAUTH__UI_DOMAIN=http://app.gitmono.local:3000 MEGA_OAUTH__COOKIE_DOMAIN=gitmono.local -MEGA_OAUTH__ALLOWED_CORS_ORIGINS=http://app.gitmono.local:3000 +MEGA_OAUTH__ALLOWED_CORS_ORIGINS=["http://app.gitmono.local:3000"] MEGA_BASE_DIR=/opt/mega MEGA_CACHE_DIR=/opt/mega/cache diff --git a/docker/demo/docker-compose.demo.yml b/docker/demo/docker-compose.demo.yml index f74ebc42b..6500d32e4 100644 --- a/docker/demo/docker-compose.demo.yml +++ b/docker/demo/docker-compose.demo.yml @@ -171,7 +171,7 @@ services: # Set MEGA_UI_IMAGE environment variable to use ECR image, or tag the ECR image as mega:mono-ui-latest-release # Default uses local tag (mega:mono-ui-latest-release) if ECR image is tagged locally mega_ui: - image: ${MEGA_UI_IMAGE:-public.ecr.aws/m8q5m4u3/mega:mega-ui-staging-0.1.0-pre-release} + image: ${MEGA_UI_IMAGE:-public.ecr.aws/m8q5m4u3/mega:mega-ui-demo-0.1.0-pre-release} container_name: mega-demo-ui depends_on: mega: @@ -287,8 +287,8 @@ services: CAMPSITE_RUN_MIGRATIONS: ${CAMPSITE_RUN_MIGRATIONS:-1} # Align with ECS style env vars (for local demo use dev) - RAILS_ENV: ${CAMPSITE_RAILS_ENV:-development} - RAILS_MASTER_KEY: ${CAMPSITE_RAILS_MASTER_KEY:-} + RAILS_ENV: ${CAMPSITE_RAILS_ENV:-demo} + RAILS_MASTER_KEY: ${CAMPSITE_RAILS_MASTER_KEY:-51d8cdb046869075795ba82cdd95807a} SERVER_COMMAND: ${CAMPSITE_SERVER_COMMAND:-bundle exec puma} DEV_APP_URL: ${CAMPSITE_DEV_APP_URL:-http://localhost:3000} diff --git a/moon/apps/web/.env.demo b/moon/apps/web/.env.demo new file mode 100644 index 000000000..3627076d5 --- /dev/null +++ b/moon/apps/web/.env.demo @@ -0,0 +1,9 @@ +NEXT_PUBLIC_API_URL=https://api.gitmono.local:8080 +NEXT_PUBLIC_MONO_API_URL=https://git.gitmono.local:8000 +NEXT_PUBLIC_WEB_URL=https://app.gitmono.local:3000 +NEXT_PUBLIC_SYNC_URL=wss://sync.gitmono.local +NEXT_PUBLIC_AUTH_URL=https://auth.gitmono.local:8080 +NEXT_PUBLIC_CRATES_PRO_URL=http://cratespro.gitmega.nju:8080 +NEXT_PUBLIC_ORION_API_URL=https://orion.gitmono.local:8004 + +NEXT_PUBLIC_INTERNAL_API_URL=https://api.gitmono.local:8080 \ No newline at end of file From a4ba0b108be4f54362b8fb0950dff3a8d2f06b8e Mon Sep 17 00:00:00 2001 From: Hongze Gao <15101764808@163.com> Date: Thu, 22 Jan 2026 08:48:33 +0800 Subject: [PATCH 4/4] fix(demo-env): use plain HTTP URLs in .env.demo and correct API port(#1792) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Switch all NEXT_PUBLIC_* demo URLs from https:// to http:// to match local docker-compose (no TLS termination). - Correct typo in NEXT_PUBLIC_INTERNAL_API_URL (https://api.gitmono.local:8080 → http://api.gitmono.local:8080). Signed-off-by: Hongze Gao <15101764808@163.com> --- moon/apps/web/.env.demo | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/moon/apps/web/.env.demo b/moon/apps/web/.env.demo index 3627076d5..9a93a8193 100644 --- a/moon/apps/web/.env.demo +++ b/moon/apps/web/.env.demo @@ -1,9 +1,9 @@ -NEXT_PUBLIC_API_URL=https://api.gitmono.local:8080 -NEXT_PUBLIC_MONO_API_URL=https://git.gitmono.local:8000 -NEXT_PUBLIC_WEB_URL=https://app.gitmono.local:3000 -NEXT_PUBLIC_SYNC_URL=wss://sync.gitmono.local -NEXT_PUBLIC_AUTH_URL=https://auth.gitmono.local:8080 +NEXT_PUBLIC_API_URL=http://api.gitmono.local:8080 +NEXT_PUBLIC_MONO_API_URL=http://git.gitmono.local:8000 +NEXT_PUBLIC_WEB_URL=http://app.gitmono.local:3000 +NEXT_PUBLIC_SYNC_URL=ws://sync.gitmono.local +NEXT_PUBLIC_AUTH_URL=http://auth.gitmono.local:8080 NEXT_PUBLIC_CRATES_PRO_URL=http://cratespro.gitmega.nju:8080 -NEXT_PUBLIC_ORION_API_URL=https://orion.gitmono.local:8004 +NEXT_PUBLIC_ORION_API_URL=http://orion.gitmono.local:8004 -NEXT_PUBLIC_INTERNAL_API_URL=https://api.gitmono.local:8080 \ No newline at end of file +NEXT_PUBLIC_INTERNAL_API_URL=http://api.gitmono.local:8080 \ No newline at end of file