7 releases
Uses new Rust 2024
| 0.4.5 | Jan 21, 2026 |
|---|---|
| 0.4.3 | Jan 15, 2026 |
| 0.4.2 | Dec 19, 2025 |
| 0.4.1 | Nov 22, 2025 |
| 0.3.4 | Nov 13, 2025 |
#956 in Network programming
170KB
2.5K
SLoC
greentic-demo
Thin bootstrap that wires environment variables into greentic-runner-host. All runtime logic (pack resolution, caching, hot reload, telemetry, secrets, routing) happens inside the runner; this crate simply loads .env, builds a stable RunnerConfig, and calls runner_shim::run(cfg) so future runner releases can drop in without churn.
Quickstart
- Copy the defaults and edit as needed:
Make surecp .env.example .env $EDITOR .envPACKS_DIRpoints to a directory where each tenant has abindings.yamlfile. - Start the runner with your packs/index:
make runmake runsources.env, then runscargo +nightly run --locked --bin greentic-demoso you always test the same dependency graph as CI. - Update
.envwhenever you switch pack backends, cache directories, refresh intervals, or tenant routing strategies.dotenvyloads the file automatically at startup.
Docker Image
The multi-stage Dockerfile builds a MUSL binary and copies it into gcr.io/distroless/static:nonroot, keeping the final image around 25–30 MB. Targets cover the common flow:
make docker-build DOCKER_IMAGE=ghcr.io/greentic-ai/greentic-demo:local
make docker-run DOCKER_IMAGE=ghcr.io/greentic-ai/greentic-demo:local
docker-run reads the current .env file and publishes ${PORT:-8080} by default.
Cloudflared Tunnel
Expose a local instance through Cloudflare Tunnel without poking firewall holes:
make tunnel
This target checks for cloudflared, sources .env, and runs cloudflared tunnel --url http://127.0.0.1:$PORT. See Cloudflare's docs for installing the CLI and authenticating your account.
Configuration Surface
cmd/greentic-demo/main.rs converts env vars into a stable RunnerConfig. You can also pass CLI flags to override the environment. The key knobs are:
| Variable | Description | Default |
|---|---|---|
PACKS_DIR |
Directory containing per-tenant bindings.yaml files |
./packs |
PORT |
HTTP listener exposed by the runner host | 8080 |
SECRETS_BACKEND |
Hint for which secrets backend to bootstrap (env, aws, gcp, azure) |
env |
PACK_SOURCE |
Resolver scheme (fs, http, oci, s3, gcs, azblob) |
fs |
PACK_INDEX_URL |
Local path or URL to index.json |
./examples/index.json |
PACK_CACHE_DIR |
Content-addressed cache root | .packs |
PACK_REFRESH_INTERVAL |
Human-friendly interval (e.g. 30s, 5m) for hot-reload polling |
30s |
TENANT_RESOLVER |
Routing strategy: host, header, jwt, or env |
host |
PACK_PUBLIC_KEY |
Optional Ed25519 key to verify signed packs | unset |
Additional runner features (telemetry presets, secrets bootstrap, admin APIs) will be surfaced directly through this config once the corresponding runner PRs land; the shim already has placeholders so the eventual cut-over is a one-liner re-export.
CLI Options
CLI flags override the env vars above when provided:
| Flag | Env var |
|---|---|
--packs-dir |
PACKS_DIR |
--port |
PORT |
--secrets-backend |
SECRETS_BACKEND |
--pack-source |
PACK_SOURCE |
--pack-index-url |
PACK_INDEX_URL |
--pack-cache-dir |
PACK_CACHE_DIR |
--pack-public-key |
PACK_PUBLIC_KEY |
--pack-refresh-interval |
PACK_REFRESH_INTERVAL |
--pack-refresh-interval-secs |
PACK_REFRESH_INTERVAL_SECS |
--tenant-resolver |
TENANT_RESOLVER |
Development Notes
make fmt/make testrun againstcargo +nightlybecause the crate targets Rust 2024 edition..envis ignored by Git;make runautomatically creates it from.env.examplethe first time.- Historical NATS bridge utilities (
config,nats_bridge, etc.) remain available undersrc/for reference, but new demos should run entirely through the runner host via this bootstrap. - See
docs/deploy.mdfor the Terraform + GitHub Actions deployment flow, required OIDC identities, and how to trigger theDeployworkflow.
Deployment Demo Pack
examples/deployment/generic-deploy.gtpack is a provider-agnostic deployment example:
kind: deploymentpack with an events flowdeploy_generic_iacthat hands off to a dummy deployment component (deploy.rendererkind).- Component manifest
greentic.deploy.generic.iacadvertiseshost.iacfor writing IaC templates and importsgreentic:deploy-plan@1.0.0. - Includes a basic configurator flow for the component.
- A compiled stub WASM for
greentic.deploy.generic.iacis included in the pack, generated fromexamples/deployment/stub-deploy-component. Rebuild it if you tweak the stub:cd examples/deployment/stub-deploy-componentcargo build --release --target wasm32-wasip1- copy
target/wasm32-wasip1/release/stub-deploy-component.wasmoverexamples/deployment/generic-deploy.gtpack/components/greentic.deploy.generic.iac.wasm
- Discovery/run: the default
PACK_INDEX_URLin.env.examplealready points to./examples/index.json, which now includes the deployment demo under tenantdeployment-demo. To run it locally, setTENANT_RESOLVER=envandTENANT=deployment-demo(or use a host/header resolver that maps to that tenant) before starting the runner.
Dependencies
~117MB
~2M SLoC