Deployment
Deploy r8r workflows to various platforms and environments.
Binary deployment
Build optimized release
cargo build --releaseThe binary is at target/release/r8r (~15MB).
Deploy with systemd
Create /etc/systemd/system/r8r.service:
[Unit]Description=r8r workflow serverAfter=network.target
[Service]Type=simpleUser=r8rWorkingDirectory=/opt/r8rExecStart=/usr/local/bin/r8r run --workflows /opt/r8r/workflowsRestart=on-failureEnvironment="R8R_PROFILE=production"Environment="SLACK_TOKEN=xxx"
[Install]WantedBy=multi-user.targetEnable and start:
sudo systemctl enable r8rsudo systemctl start r8rDocker deployment
Dockerfile
FROM debian:bookworm-slim
COPY target/release/r8r /usr/local/bin/r8rCOPY workflows /workflowsCOPY r8r.toml /etc/r8r/
ENV R8R_CONFIG=/etc/r8r/r8r.toml
EXPOSE 3000
CMD ["r8r", "run", "--workflows", "/workflows"]Build and run:
docker build -t my-r8r .docker run -p 3000:3000 my-r8rFly.io deployment
# Install flyctlcurl -L https://fly.io/install.sh | sh
# Launch appfly launch
# Deployfly deployfly.toml:
app = "my-r8r"
[build] dockerfile = "Dockerfile"
[env] R8R_PROFILE = "production"
[[services]] internal_port = 3000 protocol = "tcp"
[[services.ports]] handlers = ["http"] port = 80 force_https = true
[[services.ports]] handlers = ["tls", "http"] port = 443Railway deployment
# Install Railway CLInpm i -g @railway/cli
# Login and linkrailway loginrailway link
# Deployrailway upKubernetes deployment
apiVersion: apps/v1kind: Deploymentmetadata: name: r8rspec: replicas: 2 selector: matchLabels: app: r8r template: metadata: labels: app: r8r spec: containers: - name: r8r image: ghcr.io/r8r/r8r:latest ports: - containerPort: 3000 env: - name: R8R_PROFILE value: production resources: requests: memory: "32Mi" cpu: "100m" limits: memory: "128Mi" cpu: "500m"---apiVersion: v1kind: Servicemetadata: name: r8rspec: selector: app: r8r ports: - port: 80 targetPort: 3000Environment-specific config
# Base config[server]port = 3000
# Production overrides[profile.production][profile.production.server]port = 8080
[profile.production.logging]level = "warn"format = "json"Deploy with profile:
R8R_PROFILE=production r8r runHealth checks
Enable health endpoint:
[server]health_check = trueKubernetes probe:
livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 5 periodSeconds: 10Monitoring
Export metrics:
[metrics]enabled = truepath = "/metrics"Prometheus scraping:
annotations: prometheus.io/scrape: "true" prometheus.io/port: "3000" prometheus.io/path: "/metrics"