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 27affc403..0b49b0cb6 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/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/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 diff --git a/moon/apps/web/.env.demo b/moon/apps/web/.env.demo new file mode 100644 index 000000000..9a93a8193 --- /dev/null +++ b/moon/apps/web/.env.demo @@ -0,0 +1,9 @@ +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=http://orion.gitmono.local:8004 + +NEXT_PUBLIC_INTERNAL_API_URL=http://api.gitmono.local:8080 \ No newline at end of file