Apps (serverless containers)¶
An app runs one container image behind an HTTPS URL and scales with request load, down to zero when idle. You bring the image; there is no Kubernetes YAML to write.
Create¶
Apps → Create: name, image, port, environment variables, CPU and memory requests and limits, and scaling bounds.
- Scale to zero (minimum scale 0) is the default: the first request after an idle period waits for a cold start. Set a minimum of 1 to keep one instance warm.
- Private images: add registry credentials under Secrets and select them as the image pull secret. Images in your own registry work the same way.
- Environment variables can be literal values or references to a secret key.
- Persistent storage: mount a volume at a path; without one, files written by the app are lost when an instance stops.
Logs and metrics¶
The app's page shows the logs of its running instances and its CPU and memory use; see Monitoring and logs. An app scaled to zero has no logs until its next request starts an instance.
Deploy from CI¶
A GitHub Action creates or updates an app from a workflow, authenticated by a service account:
- uses: theorigamicorporation/auth@v1
with:
service_account_name: ${{ secrets.RSO_DEV_SERVICE_ACCOUNT_NAME }}
service_account_secret: ${{ secrets.RSO_DEV_SERVICE_ACCOUNT_SECRET }}
- uses: theorigamicorporation/knative-release@v1
with:
service_name: my-app
image: ${{ steps.build.outputs.image }}
From a terminal or any other CI system, the command-line client does the same:
rso app deploy my-app --image registry.example.com/my-app:1.4.0
Metering¶
Apps are metered on what they use, not on what they request: CPU core-hours and memory GB-hours measured every hour. An app scaled to zero uses nothing.
To run a container on a timetable instead of serving requests, use a scheduled job.
Terraform¶
# A serverless app from a public image, always keeping one instance warm.
resource "rso_app" "hello" {
name = "tf-example-hello"
image = "docker.io/nginxinc/nginx-unprivileged:stable"
port = 8080
env = {
TARGET = "Terraform"
}
cpu_request = "50m"
memory_request = "64Mi"
cpu_limit = "250m"
memory_limit = "128Mi"
min_scale = 1
max_scale = 3
}
output "app_url" {
value = rso_app.hello.url
}