Docker Compose
Deploy DBCraft with Docker Compose for easy local development and simple production setups.
1. Generate your keys
Create a .env file next to your compose file with a JWT secret and an encryption key. Keep it out of version control.
Terminal
cat > .env <<EOF
DBCRAFT__AUTH__JWT_SECRET=$(openssl rand -base64 48)
DBCRAFT__SECURITY__ENCRYPTION_KEY=$(openssl rand -base64 48)
EOF
chmod 600 .envBack up the encryption key
Stored data source credentials are encrypted with
DBCRAFT__SECURITY__ENCRYPTION_KEY. Lose it and every credential has to be re-entered.2. docker-compose.yml
Create a docker-compose.yml file with the following content:
docker-compose.yml
services:
dbcraft:
image: krishcdbry/dbcraft:v0.8.1-mcp
container_name: dbcraft
restart: unless-stopped
ports:
- "9000:9000"
volumes:
- dbcraft_data:/app/data
env_file:
- .env
environment:
DBCRAFT__SERVER__BASE_URL: http://localhost:9000
DBCRAFT__QUERY__READ_ONLY_MODE: "true"
RUST_LOG: info
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9000/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
dbcraft_data:Pin a version tag rather than latest so you upgrade on purpose. Settings must use the DBCRAFT__ names; see the Docker guide for the full list.
3. Start DBCraft
Terminal
# Start in detached mode
docker compose up -d
# View logs
docker compose logs -f dbcraft
# Stop
docker compose downOpen http://localhost:9000 and register. The first account becomes the organization admin; after that, invite teammates from the Organization page.
No separate metadata database
DBCraft keeps its own metadata in SQLite on the
dbcraft_data volume, and that is the only metadata store. You do not need a Postgres container for DBCraft itself: connect PostgreSQL as a data source instead.