- Shell 77.7%
- HCL 9.2%
- Makefile 7.7%
- Python 4%
- Jinja 1.4%
|
All checks were successful
deploy / deploy (push) Successful in 56s
Reviewed-on: #47 Reviewed-by: Minos <noreply+minos@thepit.space> |
||
|---|---|---|
| .forgejo/workflows | ||
| .mise/locks/pypi-ansible-core/2.21.5 | ||
| bao/recipients | ||
| docs | ||
| scripts | ||
| silo | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| env.map | ||
| GLOSSARY.md | ||
| LICENSE | ||
| Makefile | ||
| mise.lock | ||
| mise.toml | ||
| README.md | ||
infra-silo
OpenTofu and Ansible for one self-hosted Silo object store — the guest, the buckets, and the credential an application reaches them with.
It is the declarative replacement for the community-scripts
silo-install.sh
Proxmox VE helper: one OpenTofu Stack creates the LXC guest on the Proxmox node
and owns the store's contents, and Ansible installs the pinned Silo package and
owns its configuration. Use it if you run a Proxmox lab and want the store
rebuilt from the repo rather than by hand from memory. Scope names
what it deliberately leaves out.
Features
- One command for the whole deploy.
make prodsnapshots the Guest, then runs the guest, the service, the store half and the external checks, in that order and stopping at the first failure. It needs a Guest already in the state: a first deploy ismake guest, thenmake prod. - A read-only half.
plan,store-plan,service-check,validateandverifymutate nothing, so the lab can be inspected before anything lands. - Pinned by digest as well as by tag. A re-run installs the same bytes, not whatever the release page serves that day.
- The root password is in the store, not in the repo. It is fetched into the
root
.envat 0600 along with every other credential the Stack reads, instead of being committed as ciphertext for an operator to unlock by hand. - The environment is one command.
make envwrites.envwhole from the store and the sealed Proxmox pair;make env-checkproves the vendored script and the map are the ones this repo pins, and reads no store at all. - The store's contents are declared, not clicked. One bucket, the policy that reaches it, and one application credential — every other bucket, user and policy in the store is Silo's own API and is never touched.
- The state lives in the store it creates, versioned, so an accidental overwrite has a version to come back to.
What replaces what
| Helper script step | Here |
|---|---|
setting_up_container |
silo/guest/ — an unprivileged Debian 13 LXC, bpg/proxmox |
update_os |
the role's first task: apt cache refresh |
fetch_and_deploy_gh_release silo pgsty/silo binary |
get_url of the pinned amd64 .deb, sha256 checked, then apt |
mkdir /opt/silo_data; chown silo:silo |
file:, owner silo:silo, mode 0750 |
a random root password written into /etc/default/silo |
SILO_ROOT_PASSWORD → templated /etc/default/silo, mode 0600 |
systemctl enable --now silo |
systemd:, enabled and started, with a port wait |
motd_ssh, customize, cleanup_lxc |
not applicable — helper-script cosmetics |
Getting Started
Prerequisites
- A Proxmox VE node reachable from the machine that runs OpenTofu, and an API
token for it (
.env, at the repo root). - The public keys of every machine that may reach the guest's root account,
committed under
silo/guest/keys.d/*.pub— they are injected at creation, which is the only account a fresh guest has. A machine is granted access by committing its.pubbefore the Guest is created, and a Guest that already exists keeps its list until it is rebuilt; the rebuild is the procedure runbook 0001 §1 sets out. - The repo's toolchain, installed once with
make deps: it installs mise when the machine lacks it, then the toolsmise.tomldeclares andmise.lockpins — OpenTofu, ansible-core, Python, jq and uv — and the Ansible collections the playbook uses. If it had to install mise, it prints the path to run Targets with until that directory is onPATH.
Installation
Clone from the forge, then once per machine:
git clone <forge-url>/olympus/infra-silo.git
cd infra-silo
make deps
Running
Targets are run through the dependency manager, mise exec -- make <target>,
which puts the declared tools on PATH for make and everything make runs; the
commands below are written make <target> for short.
make deps # the one install step: the manager, the pinned tools, the collections
mise exec -- make # list the Targets (deploys nothing)
mise exec -- make env # write the root .env from the store (Operator or Admin agent)
mise exec -- make env-check # the vendored script and the map against their pin; no store
mise exec -- make check # the credential-free floor: env-check, its tests, the key guards' and the deploy's, fmt-check, validate
mise exec -- make prod # the whole deploy from a Guest already in state: snapshot, guest, service, store, verify
One step at a time, and the read-only half:
make snapshot # predeploy-<date>-<time> on the Guest; the three newest kept
make plan # the Guest half's plan; mutates nothing
make guest # create the LXC: plan to an artifact, confirm, apply that artifact
make service-check # the service layer's --check --diff run; mutates nothing
make service # install and configure Silo on the Guest
make store-plan # the store half's plan; mutates nothing
make store # the buckets, and the credential an application uses
make key-mint # mint one state key the declaration carries, its policy embedded (KEY=<name>)
make key-rotate # rotate one declared state key's secret at the store, keeping its access key, name and policy (KEY=<name>)
make key-audit # compare every state key's stored policy with the file it came from (root credential)
make verify # the S3 API health endpoint and the console, from the LAN
make ssh # a shell on the Guest, at the address read from state
make fmt # tofu fmt, both halves
make fmt-check # what fmt would change, and nothing else
make validate # tofu validate; the state's address and bucket compared
Configuration
No secret is committed, in plaintext or in ciphertext. The .env at the repo
root is written by make env — mode 0600, whole, from the store and from the
sealed ~/.secrets/proxmox/prod.age, under a stamp line naming the actor, the
time and the store — and every Target sources it. .env.example is the
declaration of every name the map sources, whatever actor fills it, never a file
to copy and fill; env.map says which store path fills which name, and every row
names the actors whose policy reads that path, so a fetch reads only the rows it
is named in.
| Variable | Where it comes from |
|---|---|
PROXMOX_VE_ENDPOINT / PROXMOX_VE_API_TOKEN |
the sealed prod.age, never the store, for the Operator and the Admin agent: the token builds the Guest the store runs on, so it is bootstrap material. The runner's token is secret/homelab/proxmox/runner-token, and its endpoint comes from the environment the deploy runs in |
SILO_ROOT_PASSWORD |
secret/silo/root — the object store's root user, templated into /etc/default/silo |
MINIO_USER / MINIO_PASSWORD |
secret/silo/provisioner — the key the store half runs as |
TF_VAR_service_account_secret |
secret/silo/service-account — the credential the Stack creates for an application |
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY |
secret/tofu-state/silo/apply — the pair this Stack's state is read and written with; the plan key and the store's read credential beside it are the plan check's, repository secrets and never .env |
SEMAPHORE_API_TOKEN |
secret/ci/silo/semaphore-api — the silo CI login's token, which the push-to-main trigger starts the deploy task with |
The fetch itself is documented once, for all five repositories, in
infra-secrets' docs/env-fetch.md;
scripts/env.sh here is that file vendored, and env.map is this repo's only
input to it.
Two of those credentials are not the root account and are minted once, by hand,
with their policies taken from the repo: the provisioning key from
silo/store/provisioner-policy.json, and this repository's own state key from
silo/store/state-policy.json. Both need the root credential, once each.
This repository's own plan key is declared with the rest (SL-28), its pair at
secret/tofu-state/silo/plan. The plan holds a second credential, because the
store half's plan reads the store's users, policies and service accounts as well
as a record: silo/store/store-read-policy.json is that reach and no write, its
key is minted by hand as tofu-store-read, and its pair is at
secret/tofu-state/silo/read (SL-29). Both are the plan check's, repository
secrets and never .env (SL-30). The other Stacks' state keys are declared
in the store half, silo/store/state-keys.tf, and applied with the provisioning
key, each against the policy file the repo carries for it — the forge's nine (its
Guest, Edge and runner Stacks, an apply, a plan and a deploy key each), the tracker's six
(two records, an apply, a plan and a deploy key each), the semaphore's seven
(apply, plan, its CI deploy's, its runner's deploy and plan, its
semaphore/projects Stack's deploy and plan) and the OpenBao Guest's three (an
apply, a plan and a deploy key). Every
one of those policies names a single object under prod/ and the .tflock
beside it, so no key can read or write a second record, though every one of them
may still list the bucket, which is a listing and not a read
(runbook 0002, runbook
0003 §7).
A declared key is not created by that apply: a key the Stack creates carries no
policy of its own, and a key's reach implied by the store's own account is the whole
store, which nothing in a plan shows. So make key-mint KEY=<name> creates one —
with its policy file embedded, and imported into the declaration — and make store
refuses a plan that would create a key instead, naming that Target. make key-audit
is what proves every key's stored policy is still its file's, and it fails a key
holding no policy of its own (runbook
0003 §7).
The store and its state hold three credentials between them, and none is a file
in the repo: the provisioning key the store half authenticates as, the secret it
pushes to the store for the application, and the key the state backend reads and
writes through. All three arrive in .env through the fetch; both keys are
minted once by hand, and the application's secret is passed to the Stack as a
write-only value, so it never reaches the state file. The declared keys are not
in this list: the Stack declares them, so they reach neither .env nor the
state's plaintext — only their access key, which the apply prints. Runbook
0002 and
0003 have the commands and the
gates.
Repository overview
silo/ the one Stack — the root, with silo/guest/ and silo/store/ as its
two modules · silo/service/ the service · docs/ the detailed
documentation.
Scope
It stops where the helper script stops: one guest, one service, LAN-reachable by address. It has no Edge entry (no NPM proxy host, no certificate, no DNS name), no PRE rehearsal guest, and no tracker wiring — the task a change belongs to is named in the pull request body, and nothing couples a merge to a task's state. It takes no state backup either, but the state is no longer a file on the machine that applied it: it lives in the store the Stack creates, versioned, so an accidental overwrite has a version to come back to. What that trades is stated in runbook 0003 — the state's home is the thing it describes, so a destroy takes it along unless it is pulled out first.
The object store's contents are in scope exactly where silo/store/ declares
them — one bucket, the policy that reaches it, and one application credential —
and nowhere else. Every other bucket, user and policy in the store is Silo's own
API: the Stack manages what its state holds and reads nothing besides.
For agents
Read AGENTS.md: the working context for this repository.
Contributing
Work on a branch and open a pull request for a human to review — nothing goes
directly to main, and no change is small enough to skip the door. Name the task
the change addresses in the pull request body as SL-<index>; the tracker is
Vikunja, not the forge, and a merge leaves the task as it was.
License
MIT — see LICENSE.