gtc start
Overview
Section titled “Overview”The gtc start command launches the Greentic runtime server. It starts all necessary services including the HTTP server, NATS bus, and flow executor.
gtc start [OPTIONS] <BUNDLE_PATH>Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
--host <HOST> | Bind address | 0.0.0.0 |
--port <PORT> | HTTP port | 8080 |
--cloudflared <on/off> | Enable Cloudflare tunnel | on |
--ngrok <on/off> | Enable ngrok tunnel | off |
--nats <on/off> | Enable embedded NATS | on |
--skip-setup | Skip provider setup flows | false |
--force-setup | Force re-run setup flows | false |
-v, --verbose | Enable verbose/debug logging | false |
-q, --quiet | Minimal output | false |
Basic Usage
Section titled “Basic Usage”Start with Defaults
Section titled “Start with Defaults”gtc start ./my-bundleThis starts:
- HTTP server on
0.0.0.0:8080 - Embedded NATS server
- Cloudflared tunnel (if available)
Start for Development
Section titled “Start for Development”# Use ngrok instead of cloudflaredgtc start ./my-bundle --cloudflared off --ngrok on
# With verbose logginggtc start ./my-bundle --verbose
# Skip setup (if already configured)gtc start ./my-bundle --skip-setupStart for Production
Section titled “Start for Production”# No tunnels, external NATSgtc start ./my-bundle --cloudflared off --ngrok off
# Custom portgtc start ./my-bundle --port 3000 --cloudflared offTunnel Configuration
Section titled “Tunnel Configuration”Cloudflared (Default)
Section titled “Cloudflared (Default)”Cloudflared creates a secure tunnel to Cloudflare’s network:
gtc start ./my-bundle --cloudflared on
# Output:# Cloudflare tunnel started: https://random-words.trycloudflare.com# Webhook URLs will use: https://random-words.trycloudflare.comUse ngrok for a stable URL during development:
gtc start ./my-bundle --ngrok on
# Output:# ngrok tunnel started: https://abc123.ngrok-free.app# Webhook URLs will use: https://abc123.ngrok-free.appNo Tunnel
Section titled “No Tunnel”For production with a public domain:
gtc start ./my-bundle --cloudflared off --ngrok off
# Make sure your server is publicly accessible# and update provider webhooks with your domainNATS Configuration
Section titled “NATS Configuration”Embedded NATS (Default)
Section titled “Embedded NATS (Default)”gtc start ./my-bundle --nats on
# Starts embedded NATS on localhost:4222External NATS
Section titled “External NATS”# Disable embedded, use externalgtc start ./my-bundle --nats off
# Set NATS URL via environmentGREENTIC_NATS_URL=nats://nats.example.com:4222 gtc start ./my-bundle --nats offSetup Flow Behavior
Section titled “Setup Flow Behavior”Normal Behavior
Section titled “Normal Behavior”By default, gtc start runs setup flows if providers are not yet configured:
gtc start ./my-bundle# Runs setup flows for unconfigured providersSkip Setup
Section titled “Skip Setup”Skip setup flows entirely (use existing configuration):
gtc start ./my-bundle --skip-setupForce Setup
Section titled “Force Setup”Force re-run all setup flows (useful after URL changes):
gtc start ./my-bundle --force-setupRuntime Endpoints
Section titled “Runtime Endpoints”When running, the server exposes:
| Endpoint | Purpose |
|---|---|
GET /health | Health check |
GET /ready | Readiness probe |
POST /webhook/{provider}/{tenant}/{team} | Provider webhooks |
GET /api/v1/sessions | Session management |
POST /api/v1/messages | Send messages |
GET /auth/config | OAuth configuration endpoint |
POST /oauth/token-exchange | Server-side OIDC token exchange proxy |
Example Health Check
Section titled “Example Health Check”curl http://localhost:8080/health# {"status": "healthy"}OAuth Support
Section titled “OAuth Support”The runtime exposes two endpoints for OAuth/OIDC integration with messaging providers that require user authentication (such as WebChat or Teams).
GET /auth/config
Section titled “GET /auth/config”Reads the OAuth configuration from the secrets store and returns it to the client. Clients use this endpoint to discover the identity provider settings needed to initiate an authorization flow.
curl http://localhost:8080/auth/config# {# "authority": "https://login.microsoftonline.com/{tenant-id}/v2.0",# "client_id": "your-client-id",# "redirect_uri": "https://your-public-url/auth/callback",# "scope": "openid profile"# }POST /oauth/token-exchange
Section titled “POST /oauth/token-exchange”A server-side token exchange proxy for OIDC authorization code exchange. This endpoint allows clients to exchange an authorization code for tokens without running into browser CORS restrictions that occur when calling identity provider token endpoints directly from the frontend.
curl -X POST http://localhost:8080/oauth/token-exchange \ -H "Content-Type: application/json" \ -d '{"code": "authorization_code_here", "redirect_uri": "https://your-public-url/auth/callback"}'Static Routes
Section titled “Static Routes”Static routes (such as health checks and OAuth endpoints) can be configured without requiring an explicit public base URL. This means these endpoints are available immediately when the server starts, even before a tunnel or public URL is established.
Logging
Section titled “Logging”Log Levels
Section titled “Log Levels”# Debug (most verbose)GREENTIC_LOG_LEVEL=debug gtc start ./my-bundle
# Info (default)GREENTIC_LOG_LEVEL=info gtc start ./my-bundle
# WarningGREENTIC_LOG_LEVEL=warn gtc start ./my-bundleVerbose Mode
Section titled “Verbose Mode”gtc start ./my-bundle --verbose
# Equivalent to GREENTIC_LOG_LEVEL=debugLog Format
Section titled “Log Format”# JSON format (for production)GREENTIC_LOG_FORMAT=json gtc start ./my-bundle
# Pretty format (for development, default)GREENTIC_LOG_FORMAT=pretty gtc start ./my-bundleSignals
Section titled “Signals”| Signal | Behavior |
|---|---|
SIGTERM | Graceful shutdown |
SIGINT (Ctrl+C) | Graceful shutdown |
SIGHUP | Reload configuration |
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
GREENTIC_HOST | Bind address |
GREENTIC_PORT | HTTP port |
GREENTIC_LOG_LEVEL | Log verbosity |
GREENTIC_LOG_FORMAT | Log format (json/pretty) |
GREENTIC_NATS_URL | External NATS URL |
GREENTIC_REDIS_URL | Redis URL for sessions |
Troubleshooting
Section titled “Troubleshooting”Port Already in Use
Section titled “Port Already in Use”Error: Address already in use (os error 48)Another process is using port 8080. Either stop it or use a different port:
gtc start ./my-bundle --port 3000NATS Connection Failed
Section titled “NATS Connection Failed”Error: Failed to connect to NATSIf using external NATS, ensure it’s running and accessible. Otherwise, enable embedded:
gtc start ./my-bundle --nats onTunnel Failed to Start
Section titled “Tunnel Failed to Start”Error: Failed to start cloudflared tunnelInstall cloudflared or use ngrok instead:
# Install cloudflaredbrew install cloudflared
# Or use ngrokgtc start ./my-bundle --cloudflared off --ngrok onProvider Setup Failed
Section titled “Provider Setup Failed”Error: Setup flow failed for messaging-telegramCheck your credentials in the answers file and ensure the public URL is accessible:
# Re-run setupgtc start ./my-bundle --force-setup --verboseDocker Deployment
Section titled “Docker Deployment”FROM rust:1.90 as builderWORKDIR /appCOPY . .RUN cargo build --release
FROM debian:bookworm-slimCOPY --from=builder /app/target/release/gtc /usr/local/bin/COPY my-bundle /app/bundleWORKDIR /appEXPOSE 8080CMD ["gtc", "start", "/app/bundle", "--cloudflared", "off"]docker build -t my-worker .docker run -p 8080:8080 my-workerNext Steps
Section titled “Next Steps”- Building Packs - Create and manage packs
- Configuration Reference - Full config options
- Troubleshooting Guide - Common issues