mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-26 07:13:36 +01:00
95261c134f2bf9f3ca5148642b158b4e2e86f8f3
For testing purposes this is important
Sablier
Sablier is an API that start containers on demand. It provides an integrations with multiple reverse proxies and different loading strategies.
Sablier is a merge from https://github.com/acouvreur/traefik-ondemand-plugin/ and https://github.com/acouvreur/traefik-ondemand-service/. This repository was renamed to Sablier.
Because Traefik doesn't support go module v2+ yet, this is re-released starting at v1.0.0 instead of my original plans as 2.0.0.
Getting started
Binary
docker run -d --name nginx nginx
docker stop nginx
./sablier start
curl 'http://localhost:10000/?name=nginx&timeout=1m'
Docker
docker run -d --name nginx nginx
docker stop nginx
docker run -v /var/run/docker.sock:/var/run/docker.sock -p 10000:10000 ghcr.io/acouvreur/sablier:latest --swarmode=false
curl 'http://localhost:10000/?name=nginx&timeout=1m'
Features
- Support for Docker containers
- Support for Docker Swarm mode, scale services
- Support for Kubernetes Deployments and Statefulsets
- Start your container/service on the first request
- Automatic scale to zero after configured timeout upon last request the service received
- Dynamic loading page (cloudflare or grafana cloud style)
- Customize dynamic and loading pages
CLI Usage
Usage:
sablier [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
start Start the Sablier server
version Print the version Sablier
Flags:
-h, --help help for sablier
Use "sablier [command] --help" for more information about a command.
Start options
Start the Sablier server
Usage:
sablier start [flags]
Flags:
-h, --help help for start
--provider.name string Provider to use to manage containers [docker swarm kubernetes] (default "docker")
--server.base-path string The base path for the API (default "/")
--server.port int The server port to use (default 10000)
--storage.file string File path to save the state
Configuration
Sablier can be configured in that order:
- command line arguments
- environment variable
- config.yaml file
server:
port: 10000
basePath: /
storage:
file:
provider:
name: docker # available providers are docker, swarm and kubernetes
Reverse proxies integration plugins
Traefik Integration
Kubernetes
see KUBERNETES.md
API
GET <service_url>:10000/?name=<service_name>&timeout=<timeout>
| Query param | Type | Description |
|---|---|---|
name |
string |
The docker container name, or the swarm service name |
timeout |
time.Duration |
The duration after which the container/service will be scaled down to 0 |
| Body | Status code | Description |
|---|---|---|
started |
202 Created | The container/service is available |
starting |
201 Accepted | The container/service has been scheduled for starting but is not yet available |
Credits
Languages
Go
89.4%
HTML
9.9%
Makefile
0.6%
Dockerfile
0.1%
