Skip to content

Commit 944cf39

Browse files
authored
feat: Docker Compose one-click demo environment for Mega / Orion (#1792) (#1823)
* 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> * style(orion): apply rustfmt to api.rs after rebase Signed-off-by: Hongze Gao <15101764808@163.com> * chore(demo): apply review fixes to Mega/Orion Compose (#1792) 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> --------- Signed-off-by: Hongze Gao <15101764808@163.com>
1 parent 95a6e97 commit 944cf39

File tree

8 files changed

+1075
-10
lines changed

8 files changed

+1075
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Cargo.lock
3131
ztm_agent.db
3232
ztm_agent_db*
3333

34+
# Demo env variables
35+
docker/demo/.env
36+
3437
# buck2 out
3538
buck-out
3639

docker/demo/.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Exclude files / directories not needed in build context for demo services
2+
3+
# VCS
4+
.git
5+
6+
# IDE / editor config
7+
.idea/
8+
.vscode/
9+
*.code-workspace
10+
11+
# OS metadata
12+
.DS_Store
13+
14+
# Rust build artifacts
15+
target/
16+
**/target/
17+
18+
# Node, Python, others
19+
node_modules/
20+
__pycache__/
21+
22+
# Tests, docs, images not required
23+
/tests/
24+
/docs/
25+

docker/demo/.env.example

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# ============================================================================
2+
# Mega / Orion Demo Environment Configuration File Example
3+
# ============================================================================
4+
#
5+
# Usage:
6+
# 1. Copy this file to .env: cp .env.example .env
7+
# 2. Modify values in .env as needed (do not commit .env to version control)
8+
# 3. Start services with: docker compose -f docker-compose.demo.yml up -d
9+
#
10+
# IMPORTANT: This configuration is for local Demo / demonstration purposes only,
11+
# NOT suitable for production environments!
12+
# ============================================================================
13+
14+
# ----------------------------------------------------------------------------
15+
# PostgreSQL Database Configuration
16+
# ----------------------------------------------------------------------------
17+
18+
POSTGRES_USER=postgres
19+
POSTGRES_PASSWORD=postgres
20+
POSTGRES_DB_MONO=mono
21+
# Note: Orion Server uses the SAME mono database (no separate orion db required)
22+
# Note: campsite database is now managed by MySQL service
23+
24+
# ----------------------------------------------------------------------------
25+
# MySQL Database Configuration (for Campsite API)
26+
# ----------------------------------------------------------------------------
27+
# Note: For demo purposes, using root user only. For production, create dedicated user.
28+
29+
MYSQL_ROOT_PASSWORD=mysqladmin
30+
MYSQL_DATABASE=campsite
31+
32+
# ----------------------------------------------------------------------------
33+
# RustFS (S3-compatible Object Storage) Configuration
34+
# ----------------------------------------------------------------------------
35+
36+
RUSTFS_ACCESS_KEY=rustfsadmin
37+
RUSTFS_SECRET_KEY=rustfsadmin
38+
RUSTFS_CONSOLE_ENABLE=true
39+
40+
# ----------------------------------------------------------------------------
41+
# S3 Storage Configuration (used by Mega and optionally Orion S3 log store)
42+
# ----------------------------------------------------------------------------
43+
44+
S3_ACCESS_KEY_ID=rustfsadmin
45+
S3_SECRET_ACCESS_KEY=rustfsadmin
46+
S3_REGION=us-east-1
47+
48+
# ----------------------------------------------------------------------------
49+
# Docker Image Configuration
50+
# ----------------------------------------------------------------------------
51+
# All images are pulled from Amazon ECR Public: public.ecr.aws/m8q5m4u3/mega
52+
# You can override these to use local images or different tags
53+
#
54+
# For local builds:
55+
# ORION_SERVER_IMAGE=orion-server:latest
56+
# MEGA_ENGINE_IMAGE=mega:mono-engine-latest
57+
58+
MEGA_ENGINE_IMAGE=public.ecr.aws/m8q5m4u3/mega:mono-0.1.0-pre-release
59+
MEGA_UI_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-ui-staging-0.1.0-pre-release
60+
ORION_SERVER_IMAGE=public.ecr.aws/m8q5m4u3/mega:orion-server-0.1.0-pre-release
61+
MEGA_DEV_IMAGE=public.ecr.aws/m8q5m4u3/mega:mega-dev-0.1.0-pre-release
62+
CAMPSITE_API_IMAGE=campsite-api:latest
63+
64+
# ----------------------------------------------------------------------------
65+
# Mega Backend Service Configuration
66+
# ----------------------------------------------------------------------------
67+
68+
MEGA_DATABASE__DB_TYPE=postgres
69+
MEGA_DATABASE__DB_URL=postgres://postgres:postgres@postgres:5432/mono
70+
MEGA_REDIS__URL=redis://redis:6379
71+
72+
MEGA_MONOREPO__STORAGE_TYPE=s3
73+
MEGA_S3__ENDPOINT_URL=http://rustfs:9000
74+
MEGA_S3__BUCKET=mega
75+
MEGA_S3__REGION=us-east-1
76+
77+
MEGA_LOG__LEVEL=info
78+
MEGA_LOG__PRINT_STD=true
79+
80+
MEGA_AUTHENTICATION__ENABLE_TEST_USER=true
81+
MEGA_AUTHENTICATION__TEST_USER_NAME=mega
82+
MEGA_AUTHENTICATION__TEST_USER_TOKEN=mega
83+
84+
MEGA_BUILD__ENABLE_BUILD=true
85+
MEGA_BUILD__ORION_SERVER=http://orion_server:8004
86+
87+
MEGA_OAUTH__CAMPSITE_API_DOMAIN=http://campsite_api:8080
88+
MEGA_OAUTH__UI_DOMAIN=http://localhost:3000
89+
MEGA_OAUTH__COOKIE_DOMAIN=localhost
90+
MEGA_OAUTH__ALLOWED_CORS_ORIGINS=http://localhost:3000
91+
92+
MEGA_BASE_DIR=/opt/mega
93+
MEGA_CACHE_DIR=/opt/mega/cache
94+
95+
# ----------------------------------------------------------------------------
96+
# Mega UI (Frontend) Configuration
97+
# ----------------------------------------------------------------------------
98+
99+
MEGA_INTERNAL_HOST=http://mega:8000
100+
MEGA_HOST=http://localhost:8000
101+
NEXT_PUBLIC_ORION_API_URL=http://orion_server:8004
102+
103+
# ----------------------------------------------------------------------------
104+
# Orion Server Configuration
105+
# ----------------------------------------------------------------------------
106+
# IMPORTANT: Orion Server uses mono database
107+
108+
ORION_DATABASE_URL=postgres://postgres:postgres@postgres:5432/mono
109+
ORION_BUILD_LOG_DIR=/tmp/buck2ctl
110+
ORION_ALLOWED_CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:8000
111+
ORION_LOGGER_STORAGE_TYPE=local
112+
ORION_BUCKET_NAME=orion-logs
113+
114+
# ----------------------------------------------------------------------------
115+
# Orion Build Client / Worker Configuration
116+
# ----------------------------------------------------------------------------
117+
118+
ORION_WORKER_SERVER_WS=ws://orion_server:8004/ws
119+
ORION_WORKER_ID=
120+
BUCK_PROJECT_ROOT=/workspace
121+
BUILD_TMP=/tmp/orion-builds
122+
SCORPIO_API_BASE_URL=http://127.0.0.1:2725
123+
ORION_WORKER_START_SCORPIO=true
124+
SCORPIO_BASE_URL=http://mega:8000
125+
SCORPIO_LFS_URL=http://mega:8000
126+
RUST_LOG=info
127+
128+
# ----------------------------------------------------------------------------
129+
# Campsite API Configuration
130+
# ----------------------------------------------------------------------------
131+
132+
CAMPSITE_DATABASE_URL=mysql2://root:mysqladmin@mysql:3306/campsite
133+
CAMPSITE_REDIS_URL=redis://redis:6379
134+
CAMPSITE_RAILS_ENV=development
135+
CAMPSITE_SERVER_COMMAND=bundle exec puma
136+
CAMPSITE_DEV_APP_URL=http://localhost:3000
137+
# Generate master key (run before first build):
138+
# VISUAL="code -n --wait" ./bin/rails credentials:edit --environment development
139+
# Copy the generated key and paste it below.
140+
CAMPSITE_RAILS_MASTER_KEY=your-master-key-here
141+
142+
# Run migrations only on first startup; set to 0 afterwards for faster launches.
143+
# 1 = run migrations (default first run) | 0 = skip migrations
144+
CAMPSITE_RUN_MIGRATIONS=1

0 commit comments

Comments
 (0)