Documentation

Server config

Configure the API, worker, database, and sandbox environment.

On this page

Environment files

Compose reads the backend .env for variable substitution. The worker loads it through env_file. The API receives only its named variables and no model credentials. Compose clears database setup credentials from the worker environment.

Keep dashboard secrets in web/.env. Compose sets CROCODE_API_URL=http://api:8080. For local web development, use web/.env.local.

Existing databases need a one-time account setup before this upgrade. Follow the database upgrade steps. Keep the existing database volume.

The Rust binary reads environment variables at startup. It does not load .env itself. Compose runs crocode migrate before the API and worker start. Runtime services use a restricted database account.

Core settings

VariableDefaultPurpose
DATABASE_URLRequiredRestricted Postgres runtime account. Privileged roles are rejected.
MIGRATION_DATABASE_URLMigration process onlySetup account for crocode migrate. Keep it out of runtime services.
CROCODE_BIND0.0.0.0:8080API listen address.
CROCODE_CONFIG_DIRUnsetDirectory containing github-app.json. Compose uses /config.
GITHUB_APP_IDRequired without setupNumeric App ID. Enables environment-based GitHub settings.
GITHUB_PRIVATE_KEYRequired without a key pathApp PEM key. Literal \n becomes a line break.
GITHUB_PRIVATE_KEY_PATHUnsetPEM file path. Takes priority over the inline key. Unset it when unused.
GITHUB_WEBHOOK_SECRETRequired without setupWebhook HMAC secret of at least 16 bytes.
CROCODE_AGENTSclaude,codex,opencodeEnabled agents. Compose and .env.example enable claude,opencode.
CROCODE_DEFAULT_AGENTFirst enabled agentMust appear in CROCODE_AGENTS.
GITHUB_API_URLhttps://api.github.comGitHub API base URL.
GITHUB_WEB_URLhttps://github.comGit host for repository checkout.

Worker and sandbox settings

VariableDefaultPurpose
CROCODE_SANDBOXdockerUse none only for trusted local development.
CROCODE_SANDBOX_IMAGEcrocode-sandbox:latestImage on the worker’s Docker daemon.
CROCODE_SANDBOX_NETWORKbridgeSandbox network. Does not create egress firewall rules.
CROCODE_SANDBOX_RUNTIMEUnsetOptional installed runtime, such as runsc.
CROCODE_WORK_DIR/var/lib/crocode/workSame absolute path on host and worker. Owner 10000:10000.
CROCODE_WORKER_CONCURRENCY4Worker slots per process. Minimum 1.
CROCODE_MAX_PER_INSTALLATION2Soft concurrency cap. Concurrent claims can exceed it.
CROCODE_AGENT_TIMEOUT_SECS900Agent timeout. Each Git command has a separate 300-second timeout.
CROCODE_MAX_REPO_SIZE_MB1024GitHub repository-size pre-check. This is not a disk quota.
CROCODE_SASTonRun OpenGrep static analysis before the agent. Set off to skip it.
CROCODE_SAST_TIMEOUT_SECS300Static analysis timeout.
CROCODE_SAST_RULES/opt/opengrep-rulesRules root. Change it only in host mode.
CROCODE_AGENT_ENVEmptyExtra variable names passed to agents. Never include GitHub or dashboard secrets.
CROCODE_LOG_FORMATPlain textSet json for JSON logs.
RUST_LOGinfoTracing filter.

Queue behavior

A job can run up to three attempts. Retry delay starts at 30 seconds, doubles, and stops growing at ten minutes. The worker polls every two seconds and sends a heartbeat every 20 seconds.

The reaper checks every 60 seconds. It requeues jobs with heartbeats older than 120 seconds, or fails them when they reach the attempt limit. Delivery IDs expire after seven days.

These values are code constants. See the full configuration reference for Compose and retention details.

Weekly security digest

The weekly security digest is off by default. An installation admin turns it on in Settings with an HTTPS chat webhook URL. CroCode posts a Slack-compatible {"text": "..."} body. Slack and Mattermost accept it. For Discord, add /slack to the end of the webhook URL.

Every 7 days, the worker reads the Dependabot alerts of all installation repositories with a token that can only read alerts and metadata. The digest counts new alerts, fixed alerts, and open alerts past their deadline. It lists at most 5 alerts in each section.

SeverityDeadline
critical15 days
high30 days
medium90 days
low180 days

The message names repositories, packages, and CVE or GHSA IDs. It leaves GitHub. The database stores the webhook URL encrypted with a key derived from the GitHub App private key, and the API never returns it. After a private key rotation, enter the URL again. The worker sends only to public addresses on port 443 and follows no redirects. After a failed send it tries again every hour.