Skip to content

Docker and Storage Configuration

SQLite (single instance)

SQLite is the recommended backend for a single instance. This command starts without a volume:

bash
docker run -d --name codebuddy2api --restart unless-stopped -p 8001:8001 \
  -e CODEBUDDY_STORAGE_BACKEND=sqlite \
  -e CODEBUDDY_STORAGE_ENCRYPTION_KEY='replace-with-a-long-random-secret' \
  -e CODEBUDDY_STORAGE_IMPORT_LEGACY_FILES=false \
  ghcr.io/orangeboychen/codebuddy2api:latest

The database defaults to /app/.codebuddy_data/storage.sqlite. Add -v codebuddy2api-data:/app/.codebuddy_data if data must survive container removal or recreation.

Open http://127.0.0.1:8001/dashboard after startup.

PostgreSQL (multiple instances)

Use PostgreSQL for multiple instances:

bash
-e CODEBUDDY_STORAGE_BACKEND=pg \
-e DATABASE_URL='postgres://user:password@db:5432/codebuddy2api' \
-e CODEBUDDY_STORAGE_ENCRYPTION_KEY='replace-with-a-long-random-secret'

Legacy file migration

If you have .codebuddy_creds or legacy JSON configuration, omit CODEBUDDY_STORAGE_IMPORT_LEGACY_FILES=false on the first database-backend startup and temporarily mount the legacy directory:

bash
-v "$(pwd)/.codebuddy_creds:/app/.codebuddy_creds"

After migration, set CODEBUDDY_STORAGE_IMPORT_LEGACY_FILES=false and remove the legacy mount.

Environment variables

VariablePurposeExample / default
CODEBUDDY_STORAGE_BACKENDStorage backendfile, sqlite, or pg
CODEBUDDY_STORAGE_SQLITE_PATHSQLite file path.codebuddy_data/storage.sqlite
CODEBUDDY_STORAGE_ENCRYPTION_KEYEncrypts sensitive database data; required for database backendsLong random string
CODEBUDDY_STORAGE_IMPORT_LEGACY_FILESImports legacy filesSet to false for a new deployment
DATABASE_URLPostgreSQL connection stringpostgres://user:password@db:5432/codebuddy2api
CODEBUDDY_API_ENDPOINTUpstream CodeBuddy API URLhttps://copilot.tencent.com
CODEBUDDY_AUTH_MODEUpstream authentication modeauto / token
CODEBUDDY_INTERNET_ENVIRONMENTNetwork environmentinternal / ioa / public
CODEBUDDY_LOG_LEVELServer log levelINFO
CODEBUDDY_ADMIN_PASSKEY_RP_IDAdmin passkey hostnameexample.com