
Your infrastructure, written in Guile.
Manage cloud servers, DNS records and whole operating systems with ordinary Scheme code. No new configuration language to learn.
New to Scheme or Guix? Learn chaudron in 10 minutes, with no cloud account.
- 1
Describe a server
Resources are calls, in an environment called a stage.
deploy.scm (with-stage "dev" (hetzner-server "web" #:type "cx23" #:location "fsn1")) - 2
Run your program
chaudron checks what exists, and creates or updates what you described.
shell $ guile deploy.scm chaudron: create hetzner-server/web - 3
Keep it in sync
Run it again: nothing changes. Change
#:type, and the server is resized.shell $ guile deploy.scm chaudron: update hetzner-server/web (type)
A real-world example
A server at Hetzner, the whole system that runs on it, and its address at Cloudflare: two providers and an operating system, in one program, with no glue code between them.
Run once, about eight minutes later www.example.com serves public/ from a fresh Guix System.
(use-modules (chaudron) (chaudron hetzner)
(chaudron cloudflare))
(with-stage "prod"
(define key
(hetzner-ssh-key "me" #:public-key-file "~/.ssh/id_ed25519.pub"))
;; A server at Hetzner,
(define server
(hetzner-server "web" #:type "cx23" #:location "fsn1"
#:ssh-keys (list key)))
;; running the system of web-os.scm,
(hetzner-guix-system "web" #:server server
#:os "web-os.scm" #:ssh-key key)
;; with its address at Cloudflare.
(cloudflare-dns-record "www" #:zone "example.com"
#:content (output server 'ipv4)))(use-modules (gnu) (gnu machine hetzner))
(use-service-modules web)
(define %base (make-hetzner-os "cx23"))
(operating-system
(inherit %base)
(host-name "web")
(services
(cons (service nginx-service-type
(nginx-configuration
(server-blocks
(list (nginx-server-configuration
(listen '("80" "[::]:80"))
;; public/, copied with the system.
(root (local-file "public" "site"
#:recursive? #t)))))))
(operating-system-user-services %base))))<h1>Hello from chaudron!</h1>One codebase for everything you deploy
Providers talk to each other
A server's address goes to a DNS record, a bucket's file becomes an image: outputs are plain values, passed like any other.
The machines are code too
A Guix System is one declaration, deployed by
guix deploy. The same file gives the same system, and each deployment can be rolled back.Procedures, not templates
A website, its server, its record and its system fit in one procedure: two websites are two calls. Loops and modules do the rest.
Everything pinned
The lock fixes Guix, chaudron and every package on the servers: the same code gives the same infrastructure, a year later.
What a run does
Running the script is the deployment. A stage is one environment, like "prod", and its body is ordinary Guile: loops, procedures and modules all work.
Load the stage
with-stagereads what chaudron knows about the stage from.chaudron/prod/: one small file per resource.Converge each call, in order
Each resource call looks at the real resource, brings it back if it drifted, then creates, updates or replaces it, and saves its state right away. Wrap independent calls in
concurrentlyto run them in parallel.Delete what is gone
When the body returns, resources the script no longer declares are deleted, each before what it depends on. If the body raised an error, nothing is deleted.
Nothing hidden
Everything chaudron knows and does is plain text you can read, diff and commit.
The state is data
One s-expression per resource. It is read, never evaluated.
((kind . hetzner-volume)
(name . "data")
(seq . 4)
(props (name . "data-prod")
(size . 10)
(location . "fsn1")
(format . "ext4")
(labels)
(protected? . #f))
(outputs
(id . 104729301)
(linux-device . "/dev/disk/by-id/scsi-0HC_Volume_104729301"))
(depends-on))Dry runs say what would change
The same script with #:dry-run? #t reads the real resources and changes nothing.
chaudron: create hetzner-volume/data (dry run)
chaudron: update hetzner-server/forge (volumes) (dry run)
chaudron: delete hetzner-firewall/web (dry run)
Drift is reported, then fixed
A change made by hand in the console is undone by the next run, out loud.
chaudron: hetzner-server/forge has drifted: type is "cx33", expected "cx23"
chaudron: update hetzner-server/forge (type)
Providers
- Hetzner Cloud
hetzner-serverhetzner-ssh-keyhetzner-firewallhetzner-primary-iphetzner-volumehetzner-networkhetzner-load-balancerhetzner-snapshot
- Oracle Cloud
oracle-instanceoracle-networkoracle-bucketoracle-objectoracle-image
- Guix System
hetzner-guix-systemoracle-guix-system
- Cloudflare
cloudflare-dns-recordcloudflare-workercloudflare-kv-namespacecloudflare-d1-database
- Livebox experimental
livebox-port-forwardlivebox-dhcp-lease
Write your own
A provider is a module with four procedures, of which only create and delete are required. Props and outputs are association lists. Without update, any change replaces the resource.
(define thing-provider
(register-provider!
(make-provider 'acme-thing
#:create (lambda (name props) ...)
#:read (lambda (outputs) ...)
#:update (lambda (outputs old new) ...)
#:delete (lambda (outputs) ...)
#:replace-on '(region))))Get started
With Guix, a project pins chaudron in its own channels.scm and runs it with guix time-machine: nothing to install. On Debian and Ubuntu, apt has all it needs.
Installation ยท Your first deployment
chaudron is young: its interface may still change.
$ guix time-machine -C channels.scm -- \
describe -f channels > channels.lock.scm
$ guix time-machine -C channels.lock.scm -- \
shell guile chaudron
$ guile deploy.scm