Skip to content
hazelcaffePublic

About

Infrastructure as code for Linux, Windows, Docker and Proxmox VE: JSON configs or a typed TS/JS SDK, one Rust engine

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Jade

Jade is an infrastructure as code/config system for Linux, Windows, Docker, and Proxmox!

It can manage:

  • existing Linux and Windows machines (over SSH, WinRM, or locally)
  • Proxmox VE VMs and LXC containers (through the API or over SSH to the host)
  • Docker containers, Compose-style (locally or on another machine over SSH)

Configs are JSON (comments allowed), or TS/JS if you'd rather write code.

Install

Grab a prebuilt jade from the releases page (Linux x86_64 and arm64, macOS on Apple silicon, Windows x86_64), or build it yourself. You need Rust for that. Node 18+ is only needed for the JS/TS package.

git clone https://github.com/hazelcaffe/jade
cd jade
cargo install --path crates/jade-cli

Jade runs on Linux and macOS. On Windows it works for remote targets (SSH, WinRM, Proxmox); local mode and local Docker need a Unix shell.

Example

web.jsonc:

{
  "$schema": "https://raw.githubusercontent.com/hazelcaffe/jade/main/schema/jade.schema.json",
  "jade": 1,
  "kind": "host",
  "connection": { "type": "ssh", "host": "192.168.0.10", "user": "root" },
  "os": {
    "family": "linux",
    "packages": { "install": ["nginx"] },
    "users": {
      "hazel": { "admin": true, "sudo_nopasswd": true, "ssh_keys": ["${file:~/.ssh/id_ed25519.pub}"] }
    },
    "services": { "nginx": { "enabled": true, "state": "running" } }
  }
}
jade plan web.jsonc     # show what would change
jade apply web.jsonc    # do it

The $schema line gives you autocomplete and error checking in VS Code and other editors.

Keep passwords and tokens out of your configs with ${env:NAME} (an environment variable) or ${file:path} (a file's contents).

There's an example of each kind in examples/json.

Commands

jade validate <files>   check configs without connecting to anything
jade plan <file>        show what apply would change
jade apply <file>       make the changes (asks first; -y to skip)
jade destroy <file>     delete the VM, container or Docker project
jade unattend <file>    write a Windows answer file (for a USB stick)
jade schema             print the JSON Schema

Add --json to get machine-readable output.

Kinds

host: a machine that already exists. Jade connects and configures the OS: packages, users, SSH keys, files, services, timezone, and commands to run. On Windows it also handles winget/choco, features, the registry and RDP.

pve-vm: a Proxmox VM. Jade can create one by cloning a template, importing a cloud image, or booting an ISO. It can install Windows from the ISO by itself too (no VNC or RDP needed). It updates CPU, memory, disks and networking when the config changes, and can then configure the OS inside (over SSH, WinRM, or the QEMU guest agent).

pve-lxc: a Proxmox container, plus its OS. When Jade talks to the Proxmox host over SSH, it can configure the container with pct exec, so the container doesn't need SSH.

docker: a set of containers, like a Compose file. Services can reach each other by name. If you change a service, its container is replaced. If you remove one, its container is deleted. Named volumes are always kept.

JS / TS

The @jade-iac/sdk package runs the same engine. You can write configs as plain objects:

import { dockerProject, service, plan } from "@jade-iac/sdk/functional";

const blog = dockerProject("blog", {
    db: service("postgres:17", { env: { POSTGRES_PASSWORD: "${env:DB_PASSWORD}" } }),
    web: service("ghost:6", { depends_on: ["db"], ports: [{ container: 2368 }] }),
});

console.log(await plan(blog));

or with classes, if you prefer:

import { Host, ssh } from "@jade-iac/sdk/oop";

const nas = new Host(ssh("192.168.0.2")).linux((os) => os.install("smartmontools").upgrade());
await nas.apply();

Both are fully typed, so mistakes in a config show up in your editor. More examples are in examples/ts and examples/js.

To build it from this repo:

npm install
npm run build

Working on Jade

cargo test          # Rust tests
npm test            # SDK tests (needs `npm run build` first)
npm run check       # lint and format check (Biome)
npm run format      # fix formatting

The JSON Schema and the TypeScript types are generated from the Rust code. If you change the spec, regenerate them:

cargo run -p jade-cli -- schema -o schema/jade.schema.json
cargo run -p jade-cli -- typescript -o packages/jade/src/spec.ts

The tests will tell you if you forget.

See CONTRIBUTING.md for more, and CHANGELOG.md for what changed.

License

MIT. See LICENSE.

About

Infrastructure as code for Linux, Windows, Docker and Proxmox VE: JSON configs or a typed TS/JS SDK, one Rust engine

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages