On-demand service proxy for resource-constrained servers
Dedinamik is a lightweight TCP/HTTP proxy that starts services on-demand when traffic arrives, and stops or freezes them after a period of inactivity. Perfect for running multiple services on a small dedicated server without wasting resources when they're idle.
sequenceDiagram
participant C as Client
participant D as Dedinamik
participant S as Service
Note over S: Stopped
C->>D: Connect
D->>S: Start
activate S
Note over S: Running
D->>S: Proxy traffic
S-->>D: Response
D-->>C: Response
C--xD: Disconnect
Note over D: Idle timeout...
D->>S: Stop / Pause
deactivate S
Note over S: Stopped / Paused
C->>D: New connection
D->>S: Start / Unpause
activate S
Note over S: Running
| Feature | Description |
|---|---|
| TCP Proxy | Transparent bidirectional TCP forwarding with connection tracking |
| HTTP Reverse Proxy | On-demand HTTP proxy with automatic service startup |
| Child Process | Manage services as child processes with optional SIGSTOP/SIGCONT freezing |
| Systemd | Start/stop systemd units via D-Bus |
| Docker | Single container management with pause/unpause support |
| Docker Compose | Multi-container stack orchestration (start/stop/pause entire stacks) |
| Graceful Shutdown | Clean shutdown on SIGINT/SIGTERM with context propagation |
go build -o dedinamik ./cmd/dedinamik/Drop JSON config files in the configs/ directory. Each file defines one managed service.
./dedinamikSpawns a process directly. Supports freezing via SIGSTOP/SIGCONT.
{
"name": "bungeecord",
"type": "child",
"waitTime": 2,
"await": [
{ "type": "socket", "connection": "tcp", "from": ":25578", "to": "localhost:25577" }
],
"config": {
"command": ["/usr/bin/java", "-jar", "/srv/Bungee/BungeeCord.jar"],
"home": "/srv/Bungee",
"freeze": false
}
}Controls a systemd service via D-Bus.
{
"name": "typhoonlimbo",
"type": "systemd",
"waitTime": 2,
"await": [
{ "type": "socket", "connection": "tcp", "from": ":25566", "to": "localhost:25565" }
],
"config": {
"service": "typhoonlimbo.service",
"mode": "replace"
}
}Manages a Docker container with pause/unpause for sleep.
{
"name": "plex",
"type": "docker",
"waitTime": 30,
"await": [
{ "type": "socket", "connection": "tcp", "from": ":32400", "to": "localhost:32401" }
],
"config": {
"image": "plexinc/pms-docker:latest",
"containerName": "plex",
"env": ["PLEX_CLAIM=claim-xxxx", "TZ=Pacific/Tahiti"],
"volumes": ["/srv/plex/config:/config", "/srv/media:/data"],
"network": "host",
"ports": ["32401:32400"]
}
}Orchestrates a full multi-container stack. Great for media servers.
{
"name": "mediastack",
"type": "compose",
"waitTime": 30,
"await": [
{ "type": "http", "from": ":8080", "to": "http://localhost:32400/web" }
],
"config": {
"composeFile": "/srv/media/docker-compose.yml",
"projectName": "mediastack"
}
}| Field | Type | Description |
|---|---|---|
name |
string | Display name for logging |
type |
string | Plugin type: child, systemd, docker, compose |
waitTime |
int | Minutes of inactivity before sleep/stop |
await |
array | List of activity listeners (triggers) |
config |
object | Plugin-specific configuration |
Socket -- TCP/UDP proxy that tracks connections as activity:
{ "type": "socket", "connection": "tcp", "from": ":8080", "to": "localhost:8081" }HTTP -- HTTP reverse proxy with per-request activity tracking:
{ "type": "http", "from": ":8080", "to": "http://localhost:8081" }dedinamik/
cmd/dedinamik/ Entry point
internal/
activity/ TCP & HTTP proxy listeners
monitor/ Idle timeout watcher
plugin/ Plugin system & config loader
service/ Plugin implementations (child, systemd, docker, compose)
configs/ Service config files (JSON)