Docker deployment

Deploy with Docker in four steps: prepare the environment, configure .env, start the containers, and verify the deployment. The first deployment, database, and backup boundaries are described at the end of this page.

This path is for users who want to get running quickly without managing a Python environment. It depends only on Docker; you do not need Python or Node on the host.
Boundary: This is the Docker path for a first run or trial. For the production architecture, database, and minimum specifications, see Architecture and deployment topologies.

To change code or debug, use Source deployment. For usage steps after installation, see Hands-on guide.

Understand the compose topology first: deploy/docker-compose.yml defines four containers plus nginx, not a single container.
The four application containers each run one uvicorn process and listen on 38080–38083. Only grape-nginx publishes a host port (80:80),
and deploy/nginx-grape-compose.conf routes requests by path. All commands below assume this topology.

Deployment flow

Step Goal Completion criterion
Step 1 Prepare Docker, ports, and the build network All checks pass
Step 2 Clone the code and prepare .env and an execution engine .env exists and JWT_SECRET is not empty (production also requires GRAPE_ADMIN_PASSWORD)
Step 3 Start the four application containers and nginx docker compose ps shows all services as healthy
Step 4 Verify the service, login entry, and task execution conditions /api/health is normal and the console can be accessed

Step 1: Prepare the environment

Item Requirement How to check
Docker Engine A version that can run docker compose (the repository does not declare a minimum version; use Docker's official support matrix) docker version
Docker Compose The docker compose subcommand; the compose file uses the long env_file syntax with path/required, which older versions cannot parse docker compose version
Network The build must be able to reach a pip source (images are built locally, not pulled from an official registry) The pip source is reachable
Port Host port 80 is free (the only public nginx port; 38080–38083 are available only inside the compose network) Check whether port 80 is in LISTEN state with ss -lntp

The first build compiles images locally, including C extensions such as bcrypt and cffi. deploy/Dockerfile already installs gcc and g++; the host does not need them.
Build time depends on the network and machine; the repository does not provide a fixed estimate.

Step 2: Prepare the code and runtime configuration

git clone https://github.com/grape-dev/grape.git
cd grape
cp .env.example .env

.env must be at the repository root. There are two reasons; if either is missing, startup fails:

  1. The env_file entry in deploy/docker-compose.yml points to ../.env (required: false); the containers read database and business configuration from it.
  2. Each service uses JWT_SECRET=${JWT_SECRET:?JWT_SECRET required}, which is compose interpolation. It reads the environment of the compose process and does not automatically read env_file. Compose loads .env only from the directory containing the compose file (deploy/), so pass --env-file ../.env explicitly in the command; the commands below do this.

JWT_SECRET is mandatory. If it is empty, docker compose exits with an error. Generate a random value and write it to .env:

python3 -c "import secrets; print(secrets.token_urlsafe(48))"
# Write the output to the JWT_SECRET= line in .env; do not use the placeholder from .env.example

The remaining defaults are sufficient: DEVOPS_DB_BACKEND=sqlite (MySQL is not required) and OBS_ENABLED=false.
If HTTPS is used externally, set COOKIE_SECURE=true.

Administrator initial password (decided before startup)

On first startup, grape-server creates the administrator admin when admin_accounts is empty. The password is read from GRAPE_ADMIN_PASSWORD in the environment of that startup process; if it is not set, the default is admin123 (_seed_admin_accounts() in src/api/db_setup.py). Seeding runs only once, while admin_accounts is empty. Adding the environment variable after startup does not change the password already stored; sign in as admin and change the password in the admin console instead.

Scenario .env setting Notes
Trial Not set Sign in with admin / admin123 and change the password immediately after the first sign-in
Production GRAPE_ADMIN_PASSWORD=<strong-password> Must be written before Step 3 starts the containers; .env.example does not contain this key, so append it to .env manually

Execution engine

A Docker deployment only ensures that the platform processes run. The pipeline also requires an available execution engine.

When using a local engine, confirm that the corresponding CLI is available inside the grape-worker-server container:

docker compose exec grape-worker-server which opencode

If there is no output, connect a Worker or install an engine as described in Runtime and Worker. To use the cloud-based AI Shell, connect through AI DevSpace; installing a local CLI inside the container is not required.

Step 3: Start the services

cd deploy
docker compose --env-file ../.env up -d --build
docker compose --env-file ../.env ps      # Wait until the four application containers and nginx are healthy (start_period 30s)

The administrator is seeded only on the container's first startup, and only when admin_accounts is empty. To set a custom initial password, complete "Administrator initial password" in Step 2 before running the commands above.

The first run builds the images locally. To view logs, specify the service name (see the table below):

docker compose --env-file ../.env logs -f grape-server
docker compose --env-file ../.env logs -f grape-worker-server

The four services and their ports:

Service Process Container port
grape-server src.api.grape_server (user-facing API, IM WebSocket, frontend hosting) 38080
grape-event-server src.api.grape_event_server (webhook, A2A) 38081
grape-worker-server src.api.grape_worker_server (runtime protocol, tasks, chat execution) 38082
grape-insight-server src.api.grape_insight_server (observability, dashboards) 38083
grape-nginx nginx path-based routing 80

Step 4: Verify the deployment

curl -f http://localhost/api/health

The response is JSON such as {"server": "ok", "server_base_url": "...", ...} (see src/domains/insight/routes/health.py).
HTTP 200 with server set to ok means the service is online. nginx routes requests to the appropriate process by path; you can verify each item separately:

docker compose --env-file ../.env ps          # All services healthy
curl -fs http://localhost/api/health          # 200 + server=ok

Then open http://<server-address>/ in a browser to see the console. The first startup automatically creates the administrator account admin; the default password and the production requirement are described in "Administrator initial password" in Step 2. Change the password immediately after the first sign-in.

A local account can sign in directly. To let the team sign in with GitCode, GitHub, or Gitee, configure third-party login.

Success criteria: docker compose ps shows all services as healthy, and /api/health returns 200 with server set to ok. Continue only when both conditions are met.

Acceptance criteria

Check Command / location Pass criterion
Container status docker compose --env-file ../.env ps All four application containers and nginx are healthy
Service health curl -fs http://localhost/api/health HTTP 200 with server set to ok
Console Open http://<server-address>/ in a browser The page loads normally
Login entry Console login page The default credentials admin / admin123 work when GRAPE_ADMIN_PASSWORD is unset; change the password right after signing in (production should set a strong password in Step 2 first); configure a channel if third-party login is required
Execution environment Runtime → Engines At least one engine is online; otherwise connect a Worker or install an Agent CLI

Execution environment and third-party login are not part of the Docker startup itself. Without an execution environment, the page opens but pipelines cannot run. Without third-party login, only the third-party entry is affected.

Where data is stored

Location Content Notes
Volume grape-data → /app/data SQLite database and task data Data survives container deletion; for backups, see Upgrade, backup, and rollback
../configs → /app/configs Login channels, scene synchronization, email, security, and other configuration Bind-mounted from configs/ in the host repository; restart the relevant container after changes
../.grape/skills → /app/.grape/skills Skill assets Same as above; the skills/ directory is ignored by .gitignore, so do not use it as a mount source
../examples → /app/examples Examples (mounted only into grape-server) Same as above; you can modify them

Common failures

Symptom Cause Action
JWT_SECRET required and the process exits --env-file was not passed, or JWT_SECRET in .env is empty Prepare .env at the repository root, set the value, and include --env-file ../.env in the command
The build stalls at pip install or times out PyPI is slow or blocked Change the network or configure a proxy; alternatively add -i https://mirrors.aliyun.com/pypi/simple/ to the pip install command in deploy/Dockerfile and rebuild
Startup reports a port conflict Host port 80 is already used by nginx or another service Change the ports entry for the nginx service in deploy/docker-compose.yml to "8080:80" and use port 8080
Containers remain unhealthy The application failed to start (missing dependency or directory permission) Run docker compose --env-file ../.env logs <service> and inspect the first traceback (service names are listed above)
The page opens but the pipeline does not run No Agent CLI is installed, or it is not on the service process PATH Install opencode-ai (command opencode) or codearts-cli; run which opencode as the same user that starts the service, or docker compose exec grape-worker-server which opencode inside the container

Update to a new version

git pull
cd deploy
docker compose --env-file ../.env up -d --build      # Rebuild and replace the containers

Single-host SQLite mode: migrations run when the process starts (init_database()), so up -d completes the update.

Domain databases / MySQL multi-database mode: do not restart directly. Follow the order "migrate → repair views → verify → restart". First run
scripts/deploy-after-migrate.sh for the first three steps. Do not restart if the script exits nonzero. For details, see deploy/README.md.

Before upgrading, back up the grape-data volume and configs/; see Upgrade, backup, and rollback.