Zum Inhalt springen

gtc start

The gtc start command launches the Greentic runtime server. It starts all necessary services including the HTTP server and flow executor.

Terminal-Fenster
gtc start [OPTIONS] <BUNDLE_PATH>
OptionDescriptionDefault
--bundle <BUNDLE>Bundle path passed to the runtime
--tenant <TENANT>Tenant identifier
--team <TEAM>Team identifier
--locale <LOCALE>UI locale as a BCP-47 tag
--config <CONFIG>Runtime configuration file
--cloudflared <on/off>Enable Cloudflare tunneloff
--ngrok <on/off>Enable ngrok tunneloff
--restart <PART>Restart part of a running stack (all, cloudflared, ngrok, gateway, egress, subscriptions)
--log-dir <DIR>Log directory
--verboseEnable verbose loggingfalse
--quietMinimal outputfalse
--adminEnable the mTLS admin API endpointfalse
--admin-port <PORT>Admin API port8443
--admin-certs-dir <DIR>Directory containing admin TLS certs
--admin-allowed-clients <CNS>Comma-separated allowed admin client CNs

Extensible demo after wizard and setup:

Terminal-Fenster
gtc start ./crates/cloud-deploy-demo/bundle

End-to-end demo after setup from a published bundle:

Terminal-Fenster
gtc start ./cloud-deploy-demo.gtbundle
Terminal-Fenster
gtc start ./my-bundle

This starts:

  • The runtime services for the bundle
  • Any enabled tunnel you select with flags
  • Gateway, egress, and subscription processes as required by the bundle
Terminal-Fenster
# Use ngrok instead of cloudflared
gtc start ./my-bundle --cloudflared off --ngrok on
# With verbose logging
gtc start ./my-bundle --verbose
Terminal-Fenster
# No tunnels
gtc start ./my-bundle --cloudflared off --ngrok off
# External runtime configuration file
gtc start ./my-bundle --config ./runtime.toml --cloudflared off

Cloudflared creates a secure tunnel to Cloudflare’s network:

Terminal-Fenster
gtc start ./my-bundle --cloudflared on
# Output:
# Cloudflare tunnel started: https://random-words.trycloudflare.com
# Webhook URLs will use: https://random-words.trycloudflare.com

Use ngrok for a stable URL during development:

Terminal-Fenster
gtc start ./my-bundle --ngrok on
# Output:
# ngrok tunnel started: https://abc123.ngrok-free.app
# Webhook URLs will use: https://abc123.ngrok-free.app

For production with a public domain:

Terminal-Fenster
gtc start ./my-bundle --cloudflared off --ngrok off
# Make sure your server is publicly accessible
# and update provider webhooks with your domain

Run gtc setup before gtc start when credentials, webhook URLs, or bundle assets need to be configured. Re-run gtc setup after credential or public URL changes, then restart the runtime:

Terminal-Fenster
gtc setup ./my-bundle --answers answers.json
gtc start ./my-bundle

When running, the server exposes:

EndpointPurpose
GET /healthHealth check
GET /readyReadiness probe
POST /webhook/{provider}/{tenant}/{team}Provider webhooks
GET /api/v1/sessionsSession management
POST /api/v1/messagesSend messages
GET /auth/configOAuth configuration endpoint
POST /oauth/token-exchangeServer-side OIDC token exchange proxy
Terminal-Fenster
curl http://localhost:8080/health
# {"status": "healthy"}

The runtime exposes two endpoints for OAuth/OIDC integration with messaging providers that require user authentication (such as WebChat or Teams).

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.

Terminal-Fenster
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"
# }

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.

Terminal-Fenster
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 (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.

Terminal-Fenster
# Debug (most verbose)
GREENTIC_LOG_LEVEL=debug gtc start ./my-bundle
# Info (default)
GREENTIC_LOG_LEVEL=info gtc start ./my-bundle
# Warning
GREENTIC_LOG_LEVEL=warn gtc start ./my-bundle
Terminal-Fenster
gtc start ./my-bundle --verbose
# Equivalent to GREENTIC_LOG_LEVEL=debug
Terminal-Fenster
# JSON format (for production)
GREENTIC_LOG_FORMAT=json gtc start ./my-bundle
# Pretty format (for development, default)
GREENTIC_LOG_FORMAT=pretty gtc start ./my-bundle
SignalBehavior
SIGTERMGraceful shutdown
SIGINT (Ctrl+C)Graceful shutdown
SIGHUPReload configuration
VariableDescription
GREENTIC_HOSTBind address
GREENTIC_PORTHTTP port
GREENTIC_LOG_LEVELLog verbosity
GREENTIC_LOG_FORMATLog format (json/pretty)
GREENTIC_REDIS_URLRedis URL for sessions
Error: Address already in use (os error 48)

Another process is using the configured runtime port. Stop the process or point gtc start at a different runtime configuration:

Terminal-Fenster
gtc start ./my-bundle --config ./runtime.toml
Error: Failed to start cloudflared tunnel

Install cloudflared or use ngrok instead:

Terminal-Fenster
# Install cloudflared
brew install cloudflared
# Or use ngrok
gtc start ./my-bundle --cloudflared off --ngrok on
Error: Setup flow failed for messaging-telegram

Check your credentials in the answers file and ensure the public URL is accessible:

Terminal-Fenster
gtc setup ./my-bundle --answers answers.json --non-interactive --no-ui
gtc start ./my-bundle --verbose
Dockerfile
FROM rust:1.95 as builder
WORKDIR /app
COPY . .
RUN cargo build --release
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/gtc /usr/local/bin/
COPY my-bundle /app/bundle
WORKDIR /app
EXPOSE 8080
CMD ["gtc", "start", "/app/bundle", "--cloudflared", "off"]
Terminal-Fenster
docker build -t my-worker .
docker run -p 8080:8080 my-worker