How to choose a self-hosted installation path

Docker and source are two different runtime paths, not two installation commands. Look at the advantages, disadvantages, and runtime cost first, then decide which one to install.

1. Decide whether you need self-hosting

What self-hosting is

Self-hosting means deploying the Grape server on your own machine or cloud host, where you run, upgrade, and maintain it; data, configuration, logs, and credentials all stay in an environment you control.

The only difference from "official hosting" is one thing: who runs the Grape server.

Official hosting Self-hosting
Grape server Run by Grape Run by you
Database and file storage Official platform Your machine / your database
Domain, TLS, reverse proxy Official You configure it
Upgrade, backup, log retention Official Your responsibility
Control over data and credentials Governed by the official platform rules In your own environment

Self-hosting is not a local Worker

This is the easiest point to confuse:

  • Self-hosting: the Grape server (Web/API, database, scheduling) runs on your side
  • Local Worker / engine: the machine and Agent CLI that actually execute tasks

The two can be separated. Even with official hosting, you can still connect a Worker on your own machine; conversely, self-hosting does not mean tasks must execute on the local machine — Workers can run on other machines or in the cloud.

Self-hosting also does not mean you must modify the source code or run offline: the Docker path requires no code changes, and only the source path needs the code directory; whether you run offline depends on your network and dependencies.

What you take on

Choosing self-hosting means the following move from "the official team is responsible" to "you are responsible":

  • Starting and supervising service processes, containers, or systemd units
  • Database, file storage, backup, and restore
  • Domain, TLS, reverse proxy, and ports
  • Upgrade, rollback, logs, and monitoring
  • Custody of login credentials, API keys, and third-party OAuth credentials

If your team does not have these operations capabilities, prefer official hosting; once you have confirmed that you want to run the service yourself, compare the two paths below.

Whether self-hosting is needed

Dimension Official hosting Self-hosting
Can modify the source code No Yes
Can run offline No Yes
Suitable for Quick evaluation, direct team use Data sovereignty, code changes, offline or private deployment

If you only want to evaluate features, official hosting requires no installation. Once you have confirmed that you want to run the service yourself, compare the two paths below.

2. Advantages and disadvantages of the two paths

1. Docker Compose

What it is: Uses the bundled deploy/docker-compose.yml to run four application containers and nginx. The four application processes listen on 38080-38083 respectively, and only nginx exposes 80.

Advantages

Aspect Description
Isolated dependencies No need to install Python, Node, database drivers, or other runtime dependencies on the host
Fixed runtime topology The relationship between the four application processes and nginx is defined in the compose file; you do not split processes yourself
Clear first-start flow Prepare .env, build images, start, and check healthy; the steps are fixed
Defined data and configuration locations Data lives in the grape-data volume; configs/, .grape/skills, and examples/ are managed through mounted directories
Uniform upgrade procedure After git pull, run up -d --build again to replace the containers as a whole, which reduces "old processes not fully killed" problems
Good for demos and trials A single machine runs the full topology without an extra reverse proxy

Disadvantages

Aspect Description
The first build depends on the network Images are built locally, and the build stage needs access to the pip index; a poor network stalls at dependency installation
Resource overhead Four application containers plus nginx add container overhead; reserve memory and disk on small machines
Fixed ports nginx uses host port 80 by default; if it is occupied, change the compose port or free the port first
Longer debugging path Reading logs, entering containers, and confirming PATH all go through docker compose exec/logs, one layer more than inspecting a host process
Easy to confuse engine locations On the Docker path, confirm separately whether the Agent CLI is inside the worker container and whether it is on PATH
Indirect code changes After changing the source, rebuild the image; hot reload like the source path is not available

Suitable for

  • Running Grape for the first time
  • Avoiding maintenance of a Python runtime environment
  • Wanting a fixed runtime topology and a uniform upgrade procedure
  • Accepting Docker's resource and network prerequisites

Not suitable for

  • Frequent changes to the platform source code with immediate debugging
  • Very tight machine resources
  • Host port 80 already in use, without wanting to adjust compose
  • Running the platform as a host process directly under systemd / an existing operations system

2. Source deployment

What it is: Creates a Python virtual environment on the host and runs src.api.main:app directly. Development mode runs a single process on 3000; production mode starts the main API on 3000 and the webhook on 8080, supervised by nginx / systemd.

Advantages

Aspect Description
Direct code changes Restart the process after changing the source; development mode supports hot reload
Short debugging path The Python process, logs, venv, and environment variables are all on the host, so the troubleshooting path is more direct
Easy to add custom dependencies You can edit requirements-local.txt / requirements.txt directly to add internal packages or private dependencies
Lower resource overhead No extra Docker daemon or five containers; resources are easier to control on small machines
Controllable offline operation Once dependencies are prepared, it runs offline without image builds
Easy to integrate with existing operations systemd, existing log collection, ports, and reverse proxy systems can host it

Disadvantages

Aspect Description
More host dependencies Requires Python 3.10+, git, and build dependencies; a version mismatch fails startup directly
Risk of environment drift venv, pip index, system packages, and PATH can all affect runtime; moving to another machine requires reproducing it
Process management is yours The development single process and the production dual process are not supervised automatically; systemd or another process manager is required
Reverse proxy and TLS are yours The source path does not include nginx; production requires your own reverse proxy and certificates
More upgrade steps Pull code, install dependencies, migrate, restart, verify; each step can fail
Heavier operations responsibility Logs, backup, ports, permissions, and process liveness are all your responsibility

Suitable for

  • Needing to modify the platform source code and debug internal logic
  • Needing to add custom Python dependencies or private packages
  • Offline operation or private deployment
  • An existing systemd, nginx, log, and monitoring system
  • Reducing the container layer and controlling host processes directly

Not suitable for

  • No wish to touch a Python environment at all
  • Wanting to get running as fast as possible, without concern for process management
  • No experience with reverse proxies, certificates, or process supervision
  • No way to guarantee the Python version and system dependencies on the machine

3. Choose by scenario

Your goal Recommendation Reason
First run, only want to look around Docker Compose Isolated dependencies, fixed topology
Team trial, short demo Docker Compose Simple to start and clean up
Need code changes and platform debugging Source deployment Hot reload, logs, and dependencies are all directly controllable
Connect internal Python packages Source deployment Dependencies and environment can be adjusted directly
Offline or private deployment Source deployment No dependency on image builds or external image registries
An existing systemd / nginx operations system Source deployment Connects directly to the existing processes and reverse proxy
Tight machine resources Source deployment One less container layer
Long-term team use, public network access Either Docker or source Both paths need extra work for TLS, reverse proxy, backup, and monitoring

4. Prerequisites common to both paths

Whichever path you choose, the following conditions must be met:

Item Requirement Consequence if not met
.env At the repository root, copied from .env.example The service cannot load its runtime configuration
JWT_SECRET Must be a non-empty random value Docker exits immediately; the source path starts with broken authentication
Agent CLI At least one, on the PATH of the service process The platform starts, but the pipeline cannot execute
Third-party login (optional) Configure when the team signs in with GitCode / GitHub / Gitee The corresponding button appears on the login page
Health check /api/health returns 200 with server=ok Pages may open, but the backend is not ready

The database defaults to SQLite; MySQL is not required. To switch to MySQL, see Database backend and official synchronization. Both paths copy .env from .env.example, but the Docker path must pass it to compose with --env-file ../.env.

5. Cost of switching paths

The two paths are not interchangeable by changing a startup command; switching requires migrating the following:

Item Docker path Source path
Database grape-data volume data/ directory
Configuration repository configs/ repository configs/
Skill assets .grape/skills mount .grape/skills
Runtime environment Containers and images venv and system dependencies
Process management compose systemd / process manager
External entry point Bundled nginx container Your own nginx / reverse proxy

If this is only a trial, pick one path and get it working first; migrate after you confirm a long-term choice, so you do not maintain two setups from the start.

6. After installation

Getting the service running is only the first step. Logging in and running pipelines also require:

  1. Configure third-party login: see Configure third-party login (optional)
  2. Connect Workers and engines: see Runtime and Worker
  3. Connect a repository and apply a scene: see Create a project and file an Issue

server_base_url must be an address the browser can reach; localhost and 127.0.0.1 are two different callback addresses to third-party OAuth platforms, so do not mix them.

Docker deployment | Source deployment | Architecture and deployment topologies | Upgrade, backup, and rollback