This guide provides detailed instructions for deploying Scittles using Docker.
- Quick Start
- Production Deployment
- Environment Variables
- Volume Management
- Prometheus Integration
- OpenTelemetry Integration
- Troubleshooting
The easiest way to run Scittles is with Docker Compose:
# Start the service
docker-compose up -d
# View logs
docker-compose logs -f scittles
# Stop the service
docker-compose down# Build the image
docker build -t scittles:latest .
# Run the container
docker run -d \
--name scittles \
-p 8000:8000 \
-v $(pwd)/data:/app/data \
-e SCITT_SERVICE_URL=https://your-service-url.example \
scittles:latestFor production deployments, consider the following:
-
Set a proper service URL:
-e SCITT_SERVICE_URL=https://transparency.yourdomain.com
-
Use JSON logging:
-e SCITT_LOG_FORMAT=json
-
Configure OpenTelemetry for monitoring:
-e SCITT_OTEL_EXPORTER=otlp,prometheus -e SCITT_OTEL_ENDPOINT=http://otel-collector:4317
-
Persist database with proper backups:
-v /var/lib/scittles/data:/app/data
-
Use Docker secrets or environment files for sensitive data:
--env-file .env.production
version: '3.8'
services:
scittles:
build:
context: .
dockerfile: Dockerfile
container_name: scittles
ports:
- "8000:8000"
volumes:
- /var/lib/scittles/data:/app/data
environment:
- SCITT_DB_PATH=/app/data/transparency.db
- SCITT_SERVICE_URL=https://transparency.yourdomain.com
- SCITT_LOG_FORMAT=json
- SCITT_LOG_LEVEL=INFO
- SCITT_OTEL_ENABLED=true
- SCITT_OTEL_SERVICE_NAME=scittles
- SCITT_OTEL_EXPORTER=otlp,prometheus
- SCITT_OTEL_ENDPOINT=http://otel-collector:4317
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/.well-known/transparency-configuration').read()"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- monitoring| Variable | Default | Description |
|---|---|---|
SCITT_DB_PATH |
/app/data/transparency.db |
Path to SQLite database file |
SCITT_SERVICE_URL |
https://transparency.example |
Public URL of the service (required for production) |
SCITT_HOST |
0.0.0.0 |
Bind address for the HTTP server |
SCITT_PORT |
8000 |
Port for the HTTP server |
| Variable | Default | Description |
|---|---|---|
SCITT_LOG_LEVEL |
INFO |
Logging level: DEBUG, INFO, WARNING, ERROR |
SCITT_LOG_FORMAT |
json (Docker) |
Log format: json or text |
SCITT_OTEL_ENABLED |
true |
Enable OpenTelemetry instrumentation |
SCITT_OTEL_SERVICE_NAME |
scittles |
Service name for OpenTelemetry traces |
SCITT_OTEL_EXPORTER |
prometheus,console |
Comma-separated list: console, otlp, prometheus |
SCITT_OTEL_ENDPOINT |
- | OTLP endpoint URL (e.g., http://otel-collector:4317) |
SCITT_OTEL_HEADERS |
- | OTLP headers as comma-separated key=value pairs |
SCITT_PROMETHEUS_PORT |
9090 |
Prometheus port configuration (metrics served on main port) |
Create a .env file:
SCITT_SERVICE_URL=https://transparency.yourdomain.com
SCITT_LOG_LEVEL=INFO
SCITT_LOG_FORMAT=json
SCITT_OTEL_ENABLED=true
SCITT_OTEL_EXPORTER=prometheus,otlp
SCITT_OTEL_ENDPOINT=http://otel-collector:4317Then use it with Docker Compose:
docker-compose --env-file .env up -dThe database is stored in /app/data/transparency.db inside the container. Mount a host directory to persist data:
-v /host/path/data:/app/data-
Regular Backups:
# Backup the database docker exec scittles cp /app/data/transparency.db /app/data/transparency.db.backup docker cp scittles:/app/data/transparency.db.backup ./backups/
-
Automated Backups: Use a cron job or scheduled task to backup the mounted volume:
#!/bin/bash BACKUP_DIR=/backups/scittles DATA_DIR=/var/lib/scittles/data DATE=$(date +%Y%m%d_%H%M%S) cp $DATA_DIR/transparency.db $BACKUP_DIR/transparency_$DATE.db
-
Volume Snapshots: If using cloud storage, use volume snapshots for point-in-time recovery.
# Stop the service
docker-compose down
# Restore the database
cp ./backups/transparency.db ./data/transparency.db
# Start the service
docker-compose up -dWhen Prometheus exporter is enabled (default), metrics are available at /metrics:
# prometheus.yml
scrape_configs:
- job_name: 'scittles'
static_configs:
- targets: ['scittles:8000']
metrics_path: '/metrics'
scrape_interval: 15sThe service exposes the following metrics:
-
HTTP Metrics:
http_request_total- Total HTTP requestshttp_request_duration_seconds- Request duration histogramhttp_error_total- HTTP errors by status code
-
Database Metrics:
db_operation_total- Total database operationsdb_operation_duration_seconds- Database operation durationdb_error_total- Database errors
-
Merkle Tree Metrics:
merkle_tree_size- Current tree sizemerkle_operation_duration_seconds- Tree operation durationmerkle_proof_generation_total- Inclusion proofs generated
-
Receipt Metrics:
receipt_generation_total- Receipts generatedreceipt_generation_duration_seconds- Receipt generation durationreceipt_error_total- Receipt generation errors
-
Entry Metrics:
entry_registration_total- Entries registeredentry_registration_duration_seconds- Registration duration
version: '3.8'
services:
scittles:
# ... scittles configuration ...
networks:
- monitoring
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- monitoring
networks:
monitoring:
driver: bridgeConfigure Scittles to export traces and metrics to an OpenTelemetry Collector:
-e SCITT_OTEL_EXPORTER=otlp
-e SCITT_OTEL_ENDPOINT=http://otel-collector:4317version: '3.8'
services:
scittles:
# ... scittles configuration ...
environment:
- SCITT_OTEL_EXPORTER=otlp
- SCITT_OTEL_ENDPOINT=http://otel-collector:4317
networks:
- monitoring
otel-collector:
image: otel/opentelemetry-collector:latest
volumes:
- ./otel-collector-config.yml:/etc/otel-collector-config.yml
command: ["--config=/etc/otel-collector-config.yml"]
ports:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
networks:
- monitoring
networks:
monitoring:
driver: bridge# otel-collector-config.yml
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
batch:
exporters:
logging:
loglevel: info
prometheus:
endpoint: "0.0.0.0:8889"
jaeger:
endpoint: jaeger:14250
tls:
insecure: true
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, jaeger]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [logging, prometheus]-
Check logs:
docker-compose logs scittles
-
Verify environment variables:
docker-compose config
-
Check volume permissions:
ls -la ./data # Ensure the directory is writable
-
Check database file:
docker exec scittles ls -la /app/data/ -
Verify database integrity:
docker exec scittles sqlite3 /app/data/transparency.db "PRAGMA integrity_check;"
-
Reset database (WARNING: deletes all data):
docker-compose down rm -rf ./data/transparency.db docker-compose up -d
-
Verify Prometheus exporter is enabled:
docker exec scittles env | grep SCITT_OTEL_EXPORTER
-
Check metrics endpoint:
curl http://localhost:8000/metrics
-
Check logs for errors:
docker-compose logs scittles | grep -i prometheus
-
Monitor resource usage:
docker stats scittles
-
Check database size:
docker exec scittles du -h /app/data/transparency.db -
Review logs for slow queries:
docker-compose logs scittles | grep -i "duration"
-
Verify port mapping:
docker port scittles
-
Test connectivity:
curl http://localhost:8000/.well-known/transparency-configuration
-
Check firewall rules: Ensure port 8000 is accessible.
version: '3.8'
services:
scittles:
build: .
ports:
- "8000:8000"
volumes:
- ./data:/app/data
environment:
- SCITT_SERVICE_URL=http://localhost:8000
- SCITT_OTEL_EXPORTER=prometheus
networks:
- monitoring
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
ports:
- "9090:9090"
networks:
- monitoring
grafana:
image: grafana/grafana:latest
volumes:
- grafana-data:/var/lib/grafana
ports:
- "3000:3000"
networks:
- monitoring
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
prometheus-data:
grafana-data:
networks:
monitoring:
driver: bridge-
Use non-root user: The Dockerfile already runs as a non-root user (
scittles) -
Limit network exposure: Only expose necessary ports
-
Use secrets management: For production, use Docker secrets or external secret managers
-
Regular updates: Keep the base image and dependencies updated
-
Resource limits: Set appropriate CPU and memory limits:
deploy: resources: limits: cpus: '2' memory: 2G
-
Read-only filesystem: Consider mounting the filesystem as read-only except for data directory