This directory provides reusable Terraform infrastructure for deploying Von on OpenStack/Catalyst Cloud.
If you want a plain-language, researcher-focused walkthrough, start with:
docs/engineering/openstack_deployment.mddocs/engineering/environment_minimums.md
The stack composes four modules:
modules/security_group: security group and rule management.modules/compute_instance: primary compute instance and network port.modules/persistent_volume: attachable block storage volume.modules/floating_ip: floating IP allocation and association.
When enable_managed_bootstrap=true (default), the stack also renders cloud-init
bootstrap assets from templates/ to configure a runnable Von host:
- non-root Linux service account (
bootstrap_service_user/bootstrap_service_group) systemdservice unit (von.service) with restart policy and boot-time enablement- NGINX reverse proxy with HTTP->HTTPS redirect and TLS termination
- host-side deployment script with health checks and rollback-on-failure
- Terraform
>= 1.5.0. - OpenStack credentials available at runtime via:
OS_CLOUD+clouds.yaml, or- direct
OS_*environment variables.
- Existing OpenStack network/subnet/image/key pair values for your environment.
Tracked templates live under:
environments/dev/dev.tfvars.exampleenvironments/staging/staging.tfvars.exampleenvironments/prod/prod.tfvars.example
Create real local var files (untracked):
- Copy the template for your environment to
*.tfvarsin the same folder. - Fill in project-specific IDs and CIDRs.
- Keep secrets out of these files. Use runtime OpenStack auth environment variables instead.
Example:
Copy-Item .\infra\openstack\environments\dev\dev.tfvars.example .\infra\openstack\environments\dev\dev.tfvarsUse the repo script for repeatable operations:
scripts/powershell/invoke_openstack_terraform.ps1
Examples:
# Validate dev configuration and guardrails
.\scripts\powershell\invoke_openstack_terraform.ps1 -Action validate -Environment dev
# Generate a plan
.\scripts\powershell\invoke_openstack_terraform.ps1 -Action plan -Environment dev
# Apply (explicit approval flag)
.\scripts\powershell\invoke_openstack_terraform.ps1 -Action apply -Environment dev -AutoApprove
# Destroy
.\scripts\powershell\invoke_openstack_terraform.ps1 -Action destroy -Environment dev -AutoApproveProduction applies and destroys are blocked unless -AllowProdChanges is supplied.
Managed bootstrap uses user_data generated from
templates/cloud-init/von_bootstrap.yaml.tftpl unless you provide explicit
user_data.
Bootstrap behaviour:
- installs runtime dependencies (
python3,python3-venv,git,nginx) - creates and configures service/runtime directories under
/opt/von - writes
/etc/systemd/system/von.serviceand/etc/nginx/sites-available/von.conf - writes
/etc/von/von.envwith secure cookie defaults and OAuth startup controls - enables and starts
nginxandvon - performs first deployment by invoking
/usr/local/bin/deploy_von_release.sh
The generated deploy script executes:
- preflight checks (required tools, user, filesystem)
- release activation +
systemctl restart von - post-restart
GET /healthvalidation - automatic rollback to the previous release if health checks fail
- append a JSON audit event to
/var/log/von/deploy_audit.jsonl
You can trigger later deployments directly on the host:
sudo /usr/local/bin/deploy_von_release.sh --repo-url https://github.com/Strong-AI-Lab/Von.git --repo-ref mainOr deploy a pre-built versioned artefact (for CI/CD pipelines):
sudo /usr/local/bin/deploy_von_release.sh --artifact-path /tmp/von-<commit>.tar.gz --repo-ref mainWorkflow: .github/workflows/openstack-deploy.yml
- Pull requests touching OpenStack deployment files run CI gates:
- lint gate (
terraform fmt -check, deploy script syntax check) - type gate (
terraform validate) - tests (
tests/infra/test_openstack_deploy_templates.py) - versioned release artefact build/upload (
von-<sha>.tar.gz)
- lint gate (
- Manual
workflow_dispatchcan deploy non-interactively to the target host over SSH. - Deployment summary includes release metadata and captured deploy audit payload.
Required environment secrets for workflow-dispatch deploy:
OPENSTACK_DEPLOY_HOSTOPENSTACK_DEPLOY_USEROPENSTACK_DEPLOY_SSH_PRIVATE_KEYOPENSTACK_DEPLOY_PORT(optional, defaults to22)OPENSTACK_DEPLOY_KNOWN_HOSTS(recommended; if omitted, host key checking is disabled for that run)
Managed bootstrap now installs systemd-driven reliability automation:
von-monitor.timer->/usr/local/bin/von_monitor_health.sh- checks service uptime (
von.service) - checks
/healthresponse - checks auth-failure and DB-failure rates from journald window
- checks TLS expiry threshold
- checks service uptime (
von-log-collector.timer->/usr/local/bin/von_collect_logs.sh- consolidates app/service/proxy logs into
/var/log/von/central/
- consolidates app/service/proxy logs into
von-backup.timer->/usr/local/bin/von_backup_snapshot.sh- creates backup archives in
/var/backups/von
- creates backup archives in
von-restore-drill.timer->/usr/local/bin/von_restore_drill.sh- validates latest backup extractability and required artefacts
Audit logs:
- monitoring:
/var/log/von/monitoring_events.jsonl - central-log collection:
/var/log/von/central_log_audit.jsonl - backup:
/var/log/von/backup_audit.jsonl - restore drill:
/var/log/von/restore_drill_audit.jsonl - deploy:
/var/log/von/deploy_audit.jsonl
Optional alert webhook:
- set
bootstrap_alert_webhook_urlto deliver operational alerts. - if unset, alerts are logged locally (no external delivery).
Runbooks:
docs/engineering/openstack_operations_runbooks.md
Managed bootstrap supports production-safe OAuth startup hardening without committing plaintext credentials:
bootstrap_google_oauth_strict_startup=trueenables fail-fast startup checks.bootstrap_google_oauth_redirect_urishould be set to the deployed HTTPS callback URL.- OAuth secret values can be injected via runtime variables
(
TF_VAR_bootstrap_google_oauth_client_id,TF_VAR_bootstrap_google_oauth_client_secret) or by pre-provisioning secret files on host:bootstrap_google_oauth_client_id_file(default/etc/von/secrets/google_oauth_client_id)bootstrap_google_oauth_client_secret_file(default/etc/von/secrets/google_oauth_client_secret)
bootstrap_flask_secret_keyshould be set to a strong value (32+ characters) when strict startup is enabled.
Do not commit real OAuth secrets in tracked tfvars files.
Managed bootstrap also supports MongoDB Atlas startup hardening:
bootstrap_mongo_strict_startup=trueenforces fail-fast startup validation.bootstrap_mongo_require_tls=trueenforces TLS URI policy checks.bootstrap_mongo_allowed_host_suffixesdefaults to[".mongodb.net"].bootstrap_mongo_allow_local_fallbackshould befalsefor hosted staging/prod.bootstrap_mongo_startup_probe=trueruns auth/read/write probe checks at service startup.bootstrap_mongo_uri_filedefaults to/etc/von/secrets/mongo_uri.
Secret handling:
- keep
bootstrap_mongo_uri = nullin committed tfvars. - inject secrets at runtime using
TF_VAR_bootstrap_mongo_uri, or pre-provisionbootstrap_mongo_uri_fileon host.
Operational note:
- Atlas network access should be restricted to approved host/NAT egress addresses.
- after deploy, use
/admin/db/health?probe=rwfor basic DB auth/read/write verification.
- Required input checks (
network_id,subnet_id,image_id,key_pair_name, etc.). - Naming convention check for
name_prefix. - CIDR validation on SSH ingress, app ingress, and egress lists.
- Safety toggle for production change operations in the PowerShell runner.
- HTTPS reverse proxy defaults (HTTP redirect + TLS files), with optional self-signed bootstrap cert generation.
- Deployment health gating with rollback in managed host deploy script.
- Deployment audit logging (
deploy_audit.jsonl) for version/time/outcome traceability. - Monitoring/backup/restore-drill timers with auditable JSONL event logs.
- Strict OAuth startup mode rejects unsafe/missing hosted OAuth configuration.
- Strict Mongo startup mode rejects unsafe/missing hosted Mongo configuration.