Skip to content

Commit 145076b

Browse files
masb0ymasSiumauricioclaude
authored
feat: add template for Tera Router AI gateway (#1319)
* feat: add template for Tera Router AI gateway * fix(terarouter): run healthcheck through a shell so '|| exit 1' works Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Mauricio Siu <siumauricio@icloud.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 570815f commit 145076b

4 files changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
services:
2+
terarouter:
3+
image: ghcr.io/montara-project/tera-router:v1.23.0
4+
restart: unless-stopped
5+
expose:
6+
- 8080
7+
environment:
8+
ENV: production
9+
DEBUG: "false"
10+
MACHINE_ID: ${MACHINE_ID}
11+
APP_SECRET: ${APP_SECRET}
12+
APP_NAME: tera-router-server
13+
14+
# For Default Super User
15+
ADMIN_EMAIL: ${ADMIN_EMAIL}
16+
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
17+
18+
# No published port: every request arrives via Dokploy's proxy on the
19+
# internal network, so private ranges are safe to trust for X-Forwarded-For, this forward Real IP using DNS Cloudflare
20+
TRUSTED_PROXIES: ${TRUSTED_PROXIES}
21+
CORS_ALLOWED_ORIGINS: https://${TERA_HOST}
22+
API_URL: https://${TERA_HOST}
23+
24+
# For Database
25+
DATABASE_PATH: /app/data/terarouter.db
26+
MIGRATE_ON_BOOT: "true"
27+
SEED_ON_BOOT: "true"
28+
29+
# Optional for token reduction proxy
30+
HEADROOM_URL: http://headroom:8787
31+
HEADROOM_PROXY_TOKEN: ${HEADROOM_PROXY_TOKEN}
32+
healthcheck:
33+
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/health || exit 1"]
34+
interval: 30s
35+
timeout: 5s
36+
retries: 3
37+
start_period: 10s
38+
volumes:
39+
- terarouter-data:/app/data
40+
depends_on:
41+
- headroom
42+
43+
# Token-reduction proxy the gateway calls through HEADROOM_URL; switch it on
44+
# under Settings > Token Saving. HEADROOM_PROXY_TOKEN is required because the
45+
# sidecar binds beyond loopback on the internal network.
46+
headroom:
47+
image: ghcr.io/headroomlabs-ai/headroom:0.41.0
48+
restart: unless-stopped
49+
environment:
50+
HEADROOM_HOST: "0.0.0.0"
51+
HEADROOM_PORT: "8787"
52+
HEADROOM_COMPRESS_ALLOW_REMOTE: "1"
53+
HEADROOM_PROXY_TOKEN: ${HEADROOM_PROXY_TOKEN}
54+
# Kompress (ModernBERT on CPU) outruns the gateway's 5s Headroom timeout
55+
# on large tool results; the structural compressors stay on.
56+
HEADROOM_DISABLE_KOMPRESS: "1"
57+
HEADROOM_DISABLE_KOMPRESS_FALLBACK: "1"
58+
59+
volumes:
60+
terarouter-data:

‎blueprints/terarouter/meta.json‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"id": "terarouter",
3+
"name": "Tera Router",
4+
"version": "v1.23.0",
5+
"description": "Self-hosted AI router: a single OpenAI/Anthropic-compatible gateway in front of all your providers, with a dashboard for accounts, routing, model catalogs, and cost analytics.",
6+
"logo": "tera.png",
7+
"links": {
8+
"github": "https://github.com/montara-project/tera-router",
9+
"website": "https://terarouter.xyz",
10+
"docs": "https://docs.terarouter.xyz"
11+
},
12+
"tags": [
13+
"ai",
14+
"proxy",
15+
"developer-tools"
16+
]
17+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[variables]
2+
main_domain = "${domain}"
3+
machine_id = "${randomPort}"
4+
app_secret = "${base64:48}"
5+
admin_email = "${email}"
6+
admin_password = "${password:32}"
7+
headroom_proxy_token = "${base64:32}"
8+
9+
[config]
10+
env = [
11+
"TERA_HOST=${main_domain}",
12+
"MACHINE_ID=${machine_id}",
13+
"APP_SECRET=${app_secret}",
14+
"ADMIN_EMAIL=${admin_email}",
15+
"ADMIN_PASSWORD=${admin_password}",
16+
"TRUSTED_PROXIES=10.0.1.0/24,173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22,2400:cb00::/32,2606:4700::/32,2803:f800::/32,2405:b500::/32,2405:8100::/32,2a06:98c0::/29,2c0f:f248::/32",
17+
"SENTRY_DSN=",
18+
"HEADROOM_PROXY_TOKEN=${headroom_proxy_token}",
19+
"OIDC_ISSUER=",
20+
"OIDC_CLIENT_ID=",
21+
"OIDC_CLIENT_SECRET=",
22+
"OIDC_PROVIDER_NAME=",
23+
"OIDC_REDIRECT_URL=",
24+
]
25+
mounts = []
26+
27+
[[config.domains]]
28+
serviceName = "terarouter"
29+
port = 8080
30+
host = "${main_domain}"

‎blueprints/terarouter/tera.png‎

4.2 KB
Loading

0 commit comments

Comments
 (0)