Jump to heading Configuration
Configuration on the server side is done using some YAML or TOML files inside the config folder, see below. Blueprints are the exception: they must be YAML.
The cli does not have any configuration. All it needs to know is the URL of the server and the api token to authenticate against the server.
Jump to heading the Cli
Run scottyctl with the follwinng options:
scottyctl --server <SERVER> --access-token <TOKEN>
scottyctl --server https://loclahost:21342 --token my-secret
You can also set the environment variables SCOTTY_SERVER and
SCOTTY_ACCESS_TOKEN to store the server and token for the cli.
To check if the server and access-token works, run the command app:list:
scottyctl --server https://loclahost:21342 --access-token my-secret app:list
Jump to heading the Server
The server has a bunch of configuration files in a folder named config on the
same level as the binary. It supports overring specific configuration entries
via env-vars or by entire files. Best practice is to setup your app in
config/local.yaml and pass sensitive data via env-vars.
We'll describe in this file all sections of the server configuration:o
Jump to heading Global settings
debug: false
telemetry: None
debug: If set to true, the server will log more information. The default is false.telemetry: Which telemetry signals to export. The default isNone. The value is a comma-separated list (case-insensitive, no spaces) oftracesandmetrics, e.g.traces,metricsortraces,metrics. Any other value enables nothing. Please set also the Opentelemetry endpoint via the env-var OTEL_where to deliver the traces or metrics.
The web frontend is embedded in the scotty binary and needs no configuration.
Jump to heading API settings
api:
bind_address: "0.0.0.0:21342"
bearer_tokens:
admin: "placeholder-will-be-overridden"
client-a: "placeholder-will-be-overridden"
deployment: "placeholder-will-be-overridden"
create_app_max_size: "50M"
auth_mode: "bearer" # "dev", "oauth", or "bearer"
base_url: "https://scotty.example.com" # public-facing URL of Scotty itself
dev_user_email: "dev:system:internal"
dev_user_name: "Dev User"
database_path: "data/scotty.sqlite"
# jwt_secret: set via SCOTTY__API__JWT_SECRET (required in oauth mode)
oauth:
oidc_issuer_url: "https://gitlab.com"
client_id: "your_client_id"
client_secret: "your_client_secret"
device_flow_enabled: true
session_lifetime: "12h"
cli_session_lifetime: "30d"
bind_address: The address and port the server listens on.bearer_tokens: Required for bearer authentication. Map of logical token identifiers to secure bearer tokens. Security Note: Never store actual bearer tokens in configuration files - use placeholder values and override with environment variables (see security best practices below).create_app_max_size: The maximum size of the uploaded files. The shippedconfig/default.yamlsets 50M (the built-in default is 10M). The limit applies to the whole request body: as the files are gzip-compressed and then base64-encoded, about 3/4 of the limit is usable as compressed payload. The same limit also caps the decompressed size of each individual file.base_url: Public-facing base URL under which Scotty itself is reachable (e.g."https://scotty.example.com"). Used for post-login OAuth redirects and by the default backend / landing page feature to tell Scotty's own domain apart from app domains and to build the redirect that lets users start a stopped app from its own URL. Set this in any production deployment — when it is missing, OAuth redirects fall back tohttp://localhost:21342, the landing-page redirect for stopped apps is disabled (Scotty serves its frontend instead), and a warning is logged at startup.suisse_fonts_url(optional): Base URL of a server that hosts the SuisseIntl web fonts, e.g."https://config.factorial.io/fonts". When set, the web UI loads SuisseIntl 400/600 and SuisseIntlMono 400 from<url>/<Face>-Web/S/<Face>-WebS.woff2(the server must allow cross-origin font requests). SuisseIntl is proprietary; set this only on installs covered by a licence. Unset (the default), the UI uses its bundled Inter and JetBrains Mono and requests no external font.auth_mode: Authentication mode. Options are:"dev": Development mode with no authentication (uses fixed dev user)"oauth": Native OAuth authentication with OIDC providers (supports optional bearer token fallback for service accounts)"bearer": Traditional token-based authentication (default)
dev_user_email: Email address for the development user (used whenauth_modeis "dev")dev_user_name: Display name for the development user (used whenauth_modeis "dev")jwt_secret: Secret that signs the tokens Scotty issues (HS512). Required whenauth_modeis"oauth", at least 64 bytes (generate it, e.g.openssl rand -base64 48); Scotty does not start without it. Set it throughSCOTTY__API__JWT_SECRET, never in a config file. Changing it logs out every browser, CLI and MCP session, which is the emergency step if it leaks.database_path: SQLite database of the OAuth server (grants, registered clients, codes, refresh tokens). Defaultdata/scotty.sqlite, relative to the working directory (/appin the Docker image). Scotty creates it at startup and uses WAL mode. Put it on a persistent, writable volume; if it is lost, every CLI and MCP session is lost and users must log in again. Only used inoauthmode. See Persistent database.oauth: OAuth configuration section (used whenauth_modeis "oauth")oidc_issuer_url: OIDC provider URL (e.g., "https://gitlab.com", "https://auth0.com", etc.)client_id: OAuth application client ID from your OIDC providerclient_secret: OAuth application client secret from your OIDC providerredirect_url(optional): OAuth callback URL sent to the provider; it must match the redirect URI registered there. When unset, Scotty uses{base_url}/api/oauth/callback(seebase_url). Set it only if the provider must call back on a different URL; a relative value is ignored with a warning at startup.device_flow_enabled: Whetherscottyctl auth:loginworks (defaulttrue). Scotty runs the device login itself and users approve it on Scotty's/devicepage; the provider's device grant is not used. Whenfalse,/oauth/devicereturns 404.session_lifetime: How long a session token (web UI andscottyctlaccess token) is valid. Default"12h". Written as a number followed bys,m,hord.cli_session_lifetime: Absolute lifetime of a login: after it,scottyctlmust runauth:loginagain, however often it refreshed. It bounds web logins too, which are not refreshed and so normally end with their session token. Default"30d", same notation, at most"365d". Must not be shorter thansession_lifetime. Scotty does not start if either value is zero, the CLI lifetime is longer than 365 days or shorter than the session lifetime; this is checked in every auth mode, not onlyoauth. Changes apply to logins after the restart. MCP lifetimes are fixed (15-minute tokens, 30-day connections).frontend_base_url: Deprecated — useapi.base_urlinstead. Post-authentication redirects now useapi.base_url. If this setting is still present it is used as a fallback whenapi.base_urlis unset, and a deprecation warning is logged at startup; if both are set,api.base_urlwins.
Hybrid Authentication: When auth_mode is oauth, you can optionally configure bearer_tokens to enable service account access alongside OAuth for human users. This allows:
- Human users authenticate via OAuth (web UI, CLI device login) and use Scotty-issued session tokens
- Service accounts (CI/CD, monitoring, automation) authenticate via bearer tokens
- Provider tokens (e.g. GitLab access tokens) are not accepted by the API
See OAuth Authentication - Hybrid Mode for complete documentation on hybrid authentication setup, RBAC configuration, and migration guide.
Jump to heading Rate Limiting
Scotty includes comprehensive rate limiting to protect API endpoints from abuse and ensure fair resource usage. Rate limiting is configured per-tier with independent limits for different endpoint types.
Rate limiting is disabled by default and must be explicitly enabled via configuration.
Jump to heading Configuration
Rate limiting is configured in the api.rate_limiting section:
api:
rate_limiting:
enabled: true
public_auth:
requests_per_minute: 60
burst_size: 10
oauth:
requests_per_minute: 120
burst_size: 20
authenticated:
requests_per_minute: 300
burst_size: 50
Jump to heading Configuration Options
enabled: Global toggle for all rate limiting (default:false)public_auth: Rate limits for login endpointsrequests_per_minute: Maximum requests allowed per minuteburst_size: Number of requests allowed in a short burst
oauth: Rate limits for OAuth flow endpoints, and the numbers for MCP client registration (see below)requests_per_minute: Maximum requests allowed per minuteburst_size: Number of requests allowed in a short burst
authenticated: Rate limits for authenticated API endpointsrequests_per_minute: Maximum requests allowed per minuteburst_size: Number of requests allowed per minute
Jump to heading Rate Limiting Tiers
Scotty implements three independent rate limiting tiers:
-
Public Auth (
public_auth) - Protects login endpoints from brute force attacks- Rate limited by client IP address
- Applies to:
/api/v1/login - Recommended: 60 requests/minute with burst of 10
-
OAuth (
oauth) - Prevents OAuth flow abuse and session exhaustion- Rate limited by client IP address
- Applies to:
/oauth/device,/oauth/device/token,/oauth/authorize,/api/oauth/callback,/oauth/exchange - Recommended: 120 requests/minute with burst of 20
-
Authenticated (
authenticated) - Ensures fair resource usage per user- Rate limited by bearer token (per-user limits)
- Applies to: All
/api/v1/authenticated/*endpoints - Recommended: 300 requests/minute with burst of 50
Jump to heading MCP client registration
In oauth mode, POST /oauth/mcp/register is always rate limited, even
when enabled is false. The default is 10 requests per minute with a burst
of 5. If the oauth tier has requests_per_minute above 0, its
requests_per_minute and burst_size are used instead.
This limit keys on the client address: the first entry of X-Forwarded-For,
then X-Real-IP, then the connection's peer address. Scotty must therefore sit
behind a proxy that sets X-Forwarded-For and replaces any value the client
sent (Traefik does this by default). If clients can reach Scotty directly,
they can choose their own key. The rate-limit metrics do not count this limit.
Jump to heading Monitoring
Rate limiting metrics are automatically exported to your observability stack:
scotty.rate_limit.hits.total- Total rate limit hits across all tiersscotty.rate_limit.hits.by_tier{tier="..."}- Hits per tier (authenticated, public_auth, oauth)
These metrics are visualized in the Grafana dashboard under the "Rate Limiting" section.
Jump to heading Behavior
When a client exceeds their rate limit:
- HTTP 429 (Too Many Requests) status code is returned
- Response headers include:
Retry-After: Seconds until the client can retry (RFC 6585)X-RateLimit-After: Same information in alternate format
- Metrics are recorded for monitoring and alerting
Note: The current implementation does not include additional RFC 6585 headers (X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset). These may be added in future versions for enhanced client-side rate limit awareness.
Jump to heading Deployment Considerations
Single Instance Deployments
The current rate limiting implementation uses in-memory token bucket counters. For single-instance deployments, this provides:
- Fast, efficient rate limiting with O(1) lookups
- No external dependencies (Redis, database, etc.)
- Zero latency for rate limit checks
Multi-Instance Deployments
For deployments with multiple Scotty instances (horizontal scaling), be aware:
-
Rate limits are per-instance, not global
- Each instance maintains its own rate limit counters
- Example: With 3 instances and 60 req/min limit, effective limit is ~180 req/min
-
Recommended Solutions for Distributed Deployments:
-
External Load Balancer Rate Limiting (Recommended)
- Use Nginx, Traefik, or cloud load balancer rate limiting
- Provides global rate limits across all instances
- Example: Traefik
RateLimitmiddleware, Nginxlimit_req_zone
-
API Gateway
- Use AWS API Gateway, Kong, or similar
- Centralized rate limiting with additional features
-
Session Affinity / Sticky Sessions
- Route same client IP to same instance
- Provides consistent rate limiting per client
- Less effective for distributed attacks
-
Future Enhancements
For distributed rate limiting support, future versions may add:
- Redis-backed rate limiting for shared state
- Configurable rate limit storage backend
- Rate limit synchronization across instances
Jump to heading IPv6 Support
IP-Based Rate Limiting (Public Auth & OAuth Tiers)
The SmartIpKeyExtractor used for IP-based rate limiting supports both IPv4 and IPv6:
- IPv6 addresses are extracted and used as rate limit keys
- Supports standard IPv6 notation (e.g.,
2001:db8::1) - Handles IPv4-mapped IPv6 addresses (e.g.,
::ffff:192.0.2.1)
Important IPv6 Considerations:
-
Prefix-Based Attacks
- IPv6 allows easy generation of many addresses from single /64 prefix
- Consider implementing prefix-based rate limiting at load balancer level
- Example: Rate limit entire /64 subnet instead of individual addresses
-
Proxy Detection
- Ensure
X-Forwarded-Forheaders are properly handled - Configure trusted proxy addresses in your load balancer
- See Traefik ForwardedHeaders or Nginx real_ip_module
- Ensure
-
Testing
- Test rate limiting with both IPv4 and IPv6 clients
- Verify proxy header forwarding in your deployment
Example Nginx Configuration for IPv6 Rate Limiting:
# Define rate limit zone supporting both IPv4 and IPv6
limit_req_zone $binary_remote_addr zone=scotty_limit:10m rate=60r/m;
server {
listen 80;
listen [::]:80; # IPv6 support
location /api/v1/login {
limit_req zone=scotty_limit burst=10;
proxy_pass http://scotty_backend;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Jump to heading Authorization settings
Scotty includes a scope-based authorization system for controlling access to applications and operations. See the Authorization System documentation for complete details.
Authorization is always active. If config/casbin/policy.yaml is missing, Scotty seeds it from config/casbin/policy.yaml.example; if that is missing too, it uses built-in default roles without any assignments. Bearer tokens need an assignment in policy.yaml even to authenticate.
Jump to heading Configuration Files
Authorization uses one configuration file, policy.yaml, in the config/casbin/ directory (the folder name is historical):
config/
├── casbin/
│ └── policy.yaml # Scopes, roles, and assignments
└── default.yaml # Main configuration
Jump to heading Example Authorization Configuration
Create config/casbin/policy.yaml with your access control setup:
# Scope definitions - organize apps by purpose
scopes:
frontend:
description: "Frontend applications"
created_at: "2023-12-01T00:00:00Z"
backend:
description: "Backend services"
created_at: "2023-12-01T00:00:00Z"
production:
description: "Production environment"
created_at: "2023-12-01T00:00:00Z"
staging:
description: "Staging environment"
created_at: "2023-12-01T00:00:00Z"
# Role definitions with permissions
roles:
admin:
description: "Full administrative access"
permissions: ["*"] # Wildcard for all permissions
created_at: "2023-12-01T00:00:00Z"
developer:
description: "Development access"
permissions: ["view", "manage", "shell", "logs", "create"]
created_at: "2023-12-01T00:00:00Z"
operator:
description: "Operations access without shell"
permissions: ["view", "manage", "logs"]
created_at: "2023-12-01T00:00:00Z"
# User/token assignments to roles within scopes
# Assignment key format depends on authentication mode:
#
# OAuth Mode (auth_mode: "oauth"):
# - Use email addresses directly: "user@example.com"
# - Email is extracted from OIDC token claims during authentication
#
# Bearer Mode (auth_mode: "bearer"):
# - Use identifier prefix: "identifier:token_name"
# - Maps to configured bearer_tokens (api.bearer_tokens.token_name)
#
# Dev Mode (auth_mode: "dev"):
# - Uses fixed dev user from api.dev_user_* configuration
# - Authorization assignments are not applicable
assignments:
# OAuth user assignments (when auth_mode: "oauth")
"alice@example.com":
- role: "admin"
scopes: ["*"] # Global access to all scopes
"stephan@factorial.io":
- role: "admin"
scopes: ["*"] # Global admin access
"bob@example.com":
- role: "developer"
scopes: ["frontend", "backend"]
# Bearer token assignments (when auth_mode: "bearer")
"identifier:deployment": # Maps to bearer_tokens.deployment
- role: "developer"
scopes: ["staging"]
"identifier:admin": # Maps to bearer_tokens.admin
- role: "admin"
scopes: ["*"]
# App scope mappings (managed automatically from .scotty.yml)
apps:
"my-frontend-app": ["frontend"]
"my-backend-api": ["backend"]
Jump to heading App Scope Assignment
Apps declare scope membership in their .scotty.yml configuration:
# Apps can belong to multiple scopes
scopes:
- "frontend"
- "staging"
public_services:
- service: "web"
port: 3000
Jump to heading Available Permissions
view- See app status and informationmanage- Start, stop, restart applicationslogs- View application logsshell- Execute shell commands in containerscreate- Create new apps in scopedestroy- Delete apps from scope
Jump to heading Bearer Token Integration
Bearer tokens are configured using logical identifiers that map to secure tokens:
- Configuration: Define secure tokens in
api.bearer_tokenssection - Authorization: Reference identifiers in policy assignments as
identifier:name - Environment Override: Use
SCOTTY__API__BEARER_TOKENS__NAME=secure_token
Example CLI usage with authorized token:
export SCOTTY_ACCESS_TOKEN="secure-admin-token-abc123"
scottyctl app:list # Shows only apps user has 'view' permission for
Important: The api.access_token configuration is no longer supported. It is still parsed, but has no effect and cannot authenticate anyone. Use api.bearer_tokens instead.
Jump to heading Bearer Token Security Best Practices
🔒 NEVER store actual bearer tokens in configuration files! Follow these security guidelines:
Jump to heading 1. Use Environment Variables for Actual Tokens
Store only placeholder values in configuration files and override with secure environment variables:
# Production deployment - set actual secure tokens via environment variables
export SCOTTY__API__BEARER_TOKENS__ADMIN="$(openssl rand -base64 32)"
export SCOTTY__API__BEARER_TOKENS__DEPLOYMENT="$(openssl rand -base64 32)"
export SCOTTY__API__BEARER_TOKENS__CLIENT_A="$(openssl rand -base64 32)"
# Start Scotty server
./scotty
Jump to heading 2. Generate Strong Tokens
Use cryptographically secure random tokens:
# Generate 32-byte base64-encoded tokens (recommended)
openssl rand -base64 32
# Or use system UUID (less entropy but still secure)
uuidgen
Jump to heading 3. Configuration File Security
In your config/local.yaml or config/default.yaml:
api:
bearer_tokens:
admin: "OVERRIDE_VIA_ENV_VAR" # Will be overridden by SCOTTY__API__BEARER_TOKENS__ADMIN
deployment: "OVERRIDE_VIA_ENV_VAR" # Will be overridden by SCOTTY__API__BEARER_TOKENS__DEPLOYMENT
monitoring: "OVERRIDE_VIA_ENV_VAR" # Will be overridden by SCOTTY__API__BEARER_TOKENS__MONITORING
Jump to heading 4. Token Rotation
Regularly rotate bearer tokens:
- Generate new secure tokens
- Update environment variables
- Restart Scotty server
- Update CLI configurations and automation tools
Jump to heading 5. Access Control
- Principle of Least Privilege: Create different tokens with different permissions via authorization system
- Scope Limitation: Use authorization scopes to limit what each token can access
- Audit Regularly: Review token assignments and remove unused tokens
Example secure deployment setup:
#!/bin/bash
# secure-deploy.sh - Production deployment script
# Generate secure tokens if they don't exist
export SCOTTY__API__BEARER_TOKENS__ADMIN="${ADMIN_TOKEN:-$(openssl rand -base64 32)}"
export SCOTTY__API__BEARER_TOKENS__DEPLOY="${DEPLOY_TOKEN:-$(openssl rand -base64 32)}"
# Set restrictive file permissions
chmod 700 config/
chmod 600 config/*.yaml
# Start server with secure token environment
exec ./scotty
Jump to heading Scheduler settings
scotty is running some tasks in the background on a regular level. Here you can fine tune when certain tasks are executed:
scheduler:
running_app_check: "1m"
ttl_check: "10m"
task_cleanup: "3m"
running_app_checkhow often should the app-folder be traversed and the running apps be checked. The default is 1m.ttl_checkhow often should the ttl of the apps be checked. The default is 10m. This setting describes the frequency of the ttl-check. The actual ttl is configured on a per app basis. An app that has an operation running is skipped and checked again on the next run.task_cleanuphow often should the task-queue be cleaned up. The default is 3m. Everytime a cli or UI is issuing a command, a new task gets created and put into the queue. The task encapsulates the output of the command and other useful information. The higher the setting the longer you can inspect the output of commands in the UI
Jump to heading App settings
apps:
domain_suffix: "ddev.site"
root_folder: "./apps" # Path to the folder where the apps are stored
max_depth: 3
max_operation_duration: "1h"
domain_suffixThe suffix for auto-generated domains. Set this to the domain you want to use for your apps. App-domains are constructed by the service- and the app-name, when a custom domain is not provided.root_folderThe folder where the apps are stored. The default is./apps. If you run scotty in a docker container, and mount the apps-folder into the container, make sure that both paths are the same. Otherwise docker-compose can't run the apps, as there is a mismatch between the local path and the path on the host, where the docker daemon is running.max_depthHow many directory levels belowroot_folderscotty searches for apps. The default is 3.max_operation_durationThe longest an operation (create, run, stop, rebuild, purge, destroy, custom actions) may run on an app. After that, the operation is aborted, its task fails and the app's operation lock is released. The default is1h. Override it withSCOTTY__APPS__MAX_OPERATION_DURATION. See Operations.
Jump to heading Docker settings
Scotty uses docker to inspect running docker apps. For this to work it needs to communicate with the docker daemon
docker:
connection: local # local, socket or http, see bollard docs
registries:
example_registry:
registry: https://registry.example.com
username: "registry"
password: "registry"
example_2_registry:
...
-
connectionThe connection to the docker daemon. The default islocal. Other possible values aresocketandhttp. See the bollard documentation for more information. -
registriesA list of registries to pull images from. The key is the name of the registry, the value is a map with the keysregistry,usernameandpassword. The password is stored in plain text. If you want to use a registry with a token, you need to provide the token as password.The key for the registry is used when creating a new app, so scotty knows where to pull the image from, see the docs for
app:createIf you do not want to store the password in plain text, you can provide the password as an environment variable. Check the override section for more information.
Jump to heading Loadbalancer settings
Scotty can work with different loadbalancers, currently with Traefik (preferred) and Haproxy-config (deprecated).
load_balancer_type: Traefik #HaproxyConfig or Traefik
traefik:
network: "proxy"
container_name: "traefik"
use_tls: true
certresolver: "myresolver"
watch_docker_events: true
haproxy:
use_tls: true
load_balancer_typeThe loadbalancer to use. UseTraefikorHaproxyConfig
Jump to heading Traefik
To avoid Docker DNS name collisions across apps (every app that defines an
nginx service would otherwise publish the same nginx alias onto one shared
network), scotty gives each app its own dedicated proxy network instead of
putting all apps on a single shared network. For an app named myapp and a
base network of proxy, the per-app network is proxy--myapp. Scotty
creates this network before starting the app, connects the Traefik container to
it, and removes it again when the app is destroyed or purged. Public services
are tagged with the traefik.docker.network label so Traefik knows which
network to route over.
That attachment lives in Docker's container state, not in the Traefik compose
file, so recreating the Traefik container would otherwise drop every deployed
app off the load balancer — silently, since the app containers stay up, TLS keeps
terminating, and requests simply hang. Scotty therefore treats the membership as
a reconciled property: every running-app check (see
scheduler.running_app_check) reconnects Traefik to the proxy network of any
running app it is missing, and removes proxy networks belonging to apps that no
longer exist. A network is only removed if Scotty created it and nothing but
Traefik is still attached to it.
Each app's observed connectivity is reported in the app detail data as
load_balancer_connectivity (Connected, Disconnected,
LoadBalancerUnavailable, NotApplicable, or Unknown before the first check
has seen it). The web UI shows it as a pill next to the app status, and
scottyctl app:info prints it as a Load balancer line — but only when there is
something to report, so an app with no public services shows nothing. Two
metrics track it fleet-wide: scotty_traefik_network_drift_apps (apps repaired
in a pass) and scotty_traefik_network_unroutable_apps (apps still unreachable
afterwards — a sustained non-zero value is an outage).
networkThe base name used to derive each app's dedicated proxy network (<network>--<app-name>). The default isproxy. Scotty creates and tears down these per-app networks automatically; you do not need to create them yourself.container_nameThe name (or id) of the running Traefik container that scotty connects to each app's proxy network. The default istraefik. Set this if your Traefik container runs under a different name.use_tlsIf set to true, scotty will create the necessary labels for traefik to use tls. The default is true.certresolverThe certresolver to use for the tls-certificate. The certresolver must be configured in traefik. The default ismyresolvershown also in the examplecompose.ymlfrom the installation-documentationwatch_docker_eventsIf set to true (the default), scotty watches Docker events and reconciles the per-app proxy networks as soon as the Traefik container starts, so adocker compose up -d --force-recreate traefikis repaired within seconds instead of at the next running-app check. Turning it off only widens that window — the periodic check reconciles either way. Override withSCOTTY__TRAEFIK__WATCH_DOCKER_EVENTS=false.
Upgrading from a shared-network version: apps created before this change still have a
docker-compose.override.ymlthat references the old shared network. They keep running and routable on that network until you migrate them — Scotty does not rewrite the override automatically. Runapp:rebuildon each existing app to regenerate the override onto its per-app network and connect Traefik. A plainapp:rundoes not rewrite the override, so rebuild is the migration step.
Default backend: Traefik can also be configured to route the domains of stopped apps to Scotty, which then offers a landing page to start them on demand. See Default backend & landing page.
Jump to heading Haproxy-config
use_tlsIf set to true, scotty will create the necessary environment variables for haproxy-config to use tls.
Jump to heading Blueprints
Blueprints are a way to run certain tasks after specific events happened, like
app:create, app:run or app:rebuild. They are stored in config/blueprints
and can be adopted by apps. They are stored as separate files in the
config/blueprints-folder. Scotty is using the key of the blueprint to associate
the blueprint with an app.
Here's an example blueprint:
apps:
blueprints:
drupal-lagoon:
name: "Drupal using lagoon base images"
description: "A simple Drupal application using lagoon base images (cli, php, nginx)"
required_services:
- cli
- php
- nginx
public_services:
nginx: 8080
actions:
post_create:
description: "Run drush deploy after the application is created"
commands:
cli:
- drush deploy
post_rebuild:
description: "Run drush deploy after the application is rebuilt"
commands:
cli:
- drush deploy
post_run:
description: "Generate a one-time login link after the app started"
commands:
cli:
- drush uli
drush:uli:
description: "Generate a one-time login link"
permission: action_read
commands:
cli:
- drush uli
nameThe name of the blueprintdescriptionA short description of the blueprintrequired_servicesA list of services that are required for the blueprint to work. If one of the services is missing, scotty will throw an error when an app tries to adopt the blueprint.public_servicesA list of services that should be exposed to the public. The key is the service name, the value is the port to expose.actionsA list of actions and their corresponding commands. The following hooks are run automatically:post_createRun after the app was createdpost_rebuildRun after the app was rebuiltpost_runRun after the app was started Any other key defines a custom action that users can run on demand. Each action has:descriptionA short description of the actioncommandsThe key is the service name, the value is a list of commands to run on that service.permissionThe permission needed to run the action on demand, e.g.action_readoraction_write. The default isaction_write.
Jump to heading Environment Variables in Blueprint Actions
When blueprint action scripts are executed, Scotty automatically injects additional environment variables that can be used in your commands:
SCOTTY__APP_NAME- Contains the name of the appSCOTTY__PUBLIC_URL__<SERVICE_NAME>- Contains the public URL for each service that has a public URL configured. The service name is sanitized to be a valid environment variable name (e.g.,my-servicebecomesSCOTTY__PUBLIC_URL__MY_SERVICE)
These variables are available in addition to any environment variables you've
configured for your app via the --env option or in the .scotty.yml file.
Example usage:
apps:
blueprints:
drupal-lagoon:
name: "Drupal using lagoon base images"
description: "A simple Drupal application using lagoon base images"
required_services:
- cli
public_services:
nginx: 8080
actions:
post_run:
cli:
- echo "App name is $SCOTTY__APP_NAME"
- echo "Public URL is $SCOTTY__PUBLIC_URL__NGINX"
- drush uli --uri="$SCOTTY__PUBLIC_URL__NGINX"
If you create a new app via app:create or the REST-API, you can provide the
blueprint to associate with your app.
Jump to heading Templated blueprints
A templated blueprint ships the whole app: its own compose file and config
files. Callers create apps from it with parameters and, optionally, payload
files, without writing compose. Scotty ships two: static-html (serves an
uploaded html/ folder) and atelier (runs the Atelier CMS).
Jump to heading Layout
A templated blueprint is a directory instead of a YAML file:
config/blueprints/static-html/
├── blueprint.yaml # same keys as a YAML blueprint, plus `template`
├── docker-compose.yml # required
└── sws.toml # any other file is copied into the app
blueprint.yaml holds the keys of a blueprint directly, without the
apps.blueprints.<name> wrapping; the directory name is the blueprint's key.
Every file in the directory except blueprint.yaml is copied into the app
directory at creation. Scotty refuses to start when the compose file is
missing, blueprint.yaml doesn't parse, or a YAML blueprint has the same name.
name: Atelier
description: Self-hosted Atelier CMS
required_services: [db, app, edge]
public_services:
edge: 80
actions: {}
template:
images:
- ghcr.io/aincient-labs/atelier-cms:v0.24.0
payload: []
parameters:
type: object
properties:
ADMIN_PASS: {type: string, minLength: 12}
HASH_SALT: {type: string, x-scotty-generate: hex32}
AINCIENT_TRUSTED_HOSTS: {type: string, x-scotty-from: app.domain_pattern}
Jump to heading Parameters
template.parameters is a JSON Schema of type: object whose properties
each declare type: string, number, integer or boolean; Scotty refuses
to start otherwise. Scotty validates the request's parameters against it and
passes each one to compose as an environment variable of the same name, so
the compose file uses them as ${NAME}. Numbers and booleans arrive as their
JSON text (8080, true). Two extension keywords
mark values Scotty fills in; the caller may not send them:
x-scotty-generate: hex32 | hex64 | passwordgenerates a secret once, at creation. It stays the same across rebuilds and is never returned by the API.x-scotty-fromderives a value from the app:app.namethe app's nameapp.domainthe first host the app is served at, e.g.edge.demo.example.com(a custom domain, if one is set)app.domain_patternevery host the app is served at as an anchored, escaped regex, comma-separated, e.g.^edge\.demo\.example\.com$. Use it for settings like Drupal's trusted host patterns.
The blueprint listing (blueprint:info, GET /api/v1/authenticated/blueprints)
returns the schema with the Scotty-filled properties marked readOnly.
Jump to heading Image allowlist
template.images lists the images a caller may choose with --image; the
first is the default. The chosen image reaches compose as ${IMAGE}. Any
other image is rejected.
Jump to heading Payload
template.payload lists glob patterns (e.g. html/**) for the files a caller
may upload with --folder. * and ? match within one directory, so
html/* accepts html/index.html but not html/img/a.png; ** matches
across directories. Matching is case-sensitive. A file outside these patterns, a path with .. or
an absolute path, a compose file, a .env file (Scotty manages the app's
environment itself), or a file that would replace a blueprint
file is rejected. No patterns means no caller files.
template.payload_required lists patterns (same matching rules) that must each
match at least one uploaded file, otherwise the create request is rejected
naming the missing entries. On an update of an existing app, files already in
the app's directory count too, so a TTL change needs no upload. static-html
sets payload_required: ["html/index.html"], so a site without an index page is
refused. At startup, every entry must match a path the payload patterns
accept (for a wildcard entry, a sample path built from it), otherwise Scotty
refuses to start. Leave it out to accept a request without files.
template:
payload: ["html/**"]
payload_required: ["html/index.html"]
scottyctl app:create report-x --app-blueprint static-html --folder ./site
scottyctl app:create cms --app-blueprint atelier --ttl forever \
--param ADMIN_PASS=…
Jump to heading Snapshot
The app directory is the snapshot: rebuilds use the files written at creation,
even after the blueprint changes. .scotty.yml records the blueprint name and
a content hash (blueprint_hash). Actions still come from the live blueprint.
Jump to heading Domain suffix
Apps get domains under, in this order: apps.blueprint_domain_suffixes.<name>,
the blueprint's template.domain_suffix, then apps.domain_suffix.
apps:
blueprint_domain_suffixes:
static-html: artifacts.example.net
Serve untrusted HTML (static-html) from a separate registrable domain, so it
can't set cookies on your other apps. Since every app gets its own subdomain,
use a wildcard certificate for that suffix (DNS-01 challenge in Traefik), or
you will hit the Let's Encrypt rate limits.
Jump to heading Permission
create:<blueprint> lets a role create apps from that blueprint only, see
Authorization.
Jump to heading Data
Destroying an app, including a TTL destroy, removes its volumes. Create apps
that keep data (e.g. atelier) with --ttl forever and without
--destroy-on-ttl.
Jump to heading 1Password settings
Scotty can integrate with 1Password connect and resolve secrets from one or more connect instances when needed. For that to work, scotty can parse a special uri-scheme for envuronment variables, before running any action on an app. Here's the URI-scheme:
op://<connect-instance>/<vault-uuid>/<item-uuid>/<field>
Scotty needs a JWT token to authenticate against a connect instance. The JWT token is stored in the configuration file:
onepassword:
connect-instance-a:
jwt: todo
server: https://connect-a.example.com
connect-instance-b:
jwt: todo
server: https://connect-b.example.com
Then you can inject the actual JWT-tokens via the environment variables:
export SCOTTY__ONEPASSWORD__CONNECT_INSTANCE_A__JWT=todo
export SCOTTY__ONEPASSWORD__CONNECT_INSTANCE_B__JWT=todo
Then, for your app, you can set a environment variable like this:
scottyctl app:create test ... --env "DATABASE_PASSWORD=op://connect-instance-a/vault-uuid/item-uuid/password"
Scotty will resolve the secret from the connect instance and inject the value when running an action on the app. Please note, that it won't resolve secrets from environment variables inside compose.yml files.
Jump to heading Notification settings
Scotty supports issuing notifications via multiple channels. THese notifications are sent on all actions that are run on an app. The following channels are supported and need to be configured:
Jump to heading Mattermost channels
Scotty can send a notification after an action was successfully run on an app to a mattermost channel. Here's an example configuration:
notifications:
mattermost-example:
type: mattermost
host: "https://mattermost.example.com"
hook_id: "some-hook-id"
The hook_id is the id of the incoming webhook in mattermost. You can create a new incoming webhook in the mattermost settings.
Jump to heading Gitlab merge requests
notifications:
gitlab-example:
type: gitlab
host: "https://gitlab.example.com
token: "some-token"
Scotty needs a personal access token to authenticate against the gitlab instance.
The token must have the api-scope. You can create a new personal access token
in the gitlab settings.
Jump to heading Webhooks
notifications:
webhook-example:
type: webhook
method: "POST"
url: "https://webhook.example.com"
Scotty will send a POST-request to the url with the payload of the notification.
Method can be POST or GET.
Jump to heading How to override the configuration
The default configuration is stored in config/default.yaml. You can override
all or parts of the documentation by creating a file config/local.yaml and
replace the values you want to override.
As an alternative you can override the configuration by setting environment variables, this is especiall useful for sensitive data like passwords.
The environment variables must be prefixed with SCOTTY__ and the keys must be
concatenated with double underscores. For example to override bearer tokens
you can set environment variables like SCOTTY__API__BEARER_TOKENS__ADMIN.
Rule of thumb is: If you want to override a key, replace the dots with double
underscores and prefix the key with SCOTTY__.
Jump to heading Using .env files for configuration
Recommended for local development: Scotty automatically loads .env and .env.local files on startup, making it easy to configure the server without managing environment variables manually.
Configuration precedence (highest to lowest priority):
- Environment variables - Always take precedence over .env files
.env.local- Local overrides, not committed to version control.env- Shared defaults, can be committed to version control
Example .env file:
# Development mode configuration
SCOTTY__API__AUTH_MODE=dev
# Docker registry credentials
SCOTTY__DOCKER__REGISTRIES__MYREGISTRY__PASSWORD=secret123
# Bearer tokens (use strong tokens in production!)
SCOTTY__API__BEARER_TOKENS__ADMIN=my-secure-admin-token
Example .env.local file (overrides .env):
# Override for local development only
SCOTTY__API__AUTH_MODE=oauth
SCOTTY__API__OAUTH__CLIENT_ID=my-local-client-id
# Required in oauth mode, at least 64 bytes: openssl rand -base64 48
SCOTTY__API__JWT_SECRET=<generated secret>
Best practices:
- ✅ Use
.envfor shared development defaults (can be committed) - ✅ Use
.env.localfor personal overrides (add to.gitignore) - ✅ Generate strong tokens for production (see security best practices above)
- ❌ Never commit secrets to version control
- ❌ Don't rely on .env files in production (use proper environment variables)
Note: Both .env and .env.local files are optional - if they don't exist, the server will start normally using configuration files and environment variables.
Jump to heading Example
| name of value in the config file | environment variable |
|---|---|
debug |
SCOTTY__DEBUG |
api.bearer_tokens.admin |
SCOTTY__API__BEARER_TOKENS__ADMIN |
api.bearer_tokens.deployment |
SCOTTY__API__BEARER_TOKENS__DEPLOYMENT |
api.bind_address |
SCOTTY__API__BIND_ADDRESS |
api.base_url |
SCOTTY__API__BASE_URL |
api.auth_mode |
SCOTTY__API__AUTH_MODE |
api.dev_user_email |
SCOTTY__API__DEV_USER_EMAIL |
api.dev_user_name |
SCOTTY__API__DEV_USER_NAME |
api.oauth.oidc_issuer_url |
SCOTTY__API__OAUTH__OIDC_ISSUER_URL |
api.oauth.client_id |
SCOTTY__API__OAUTH__CLIENT_ID |
api.oauth.client_secret |
SCOTTY__API__OAUTH__CLIENT_SECRET |
api.oauth.redirect_url |
SCOTTY__API__OAUTH__REDIRECT_URL |
api.oauth.frontend_base_url (deprecated) |
SCOTTY__API__OAUTH__FRONTEND_BASE_URL |
api.oauth.session_lifetime |
SCOTTY__API__OAUTH__SESSION_LIFETIME |
api.oauth.cli_session_lifetime |
SCOTTY__API__OAUTH__CLI_SESSION_LIFETIME |
docker.registries.example_registry.password |
SCOTTY__DOCKER__REGISTRIES__EXAMPLE_REGISTRY__PASSWORD |
apps.domain_suffix |
SCOTTY__APPS__DOMAIN_SUFFIX |
load_balancer_type |
SCOTTY__LOAD_BALANCER_TYPE |
traefik.network |
SCOTTY__TRAEFIK__NETWORK |
Scotty will print out the resolved configuration on startup, so you can check for any errors.