[package] name = "witryna" version = "0.2.0" edition = "2024" rust-version = "1.85" authors = ["Dawid Rycerz"] description = "Minimalist Git-based static site deployment orchestrator" homepage = "https://git.craftknight.com/dawid/witryna" repository = "https://git.craftknight.com/dawid/witryna.git" license = "MIT" keywords = ["deploy", "static-site", "git", "webhook", "container"] categories = ["command-line-utilities", "web-programming"] [features] default = [] integration = [] [dependencies] anyhow = "1.0.100" argh = "0.1" tiny_http = "0.12" serde = { version = "1.0.228", features = ["derive"] } serde_yaml_ng = "0.10" tokio = { version = "1.49.0", features = ["rt-multi-thread", "macros", "fs", "process", "signal", "sync", "time", "io-util", "io-std"] } toml = "0.9.11" log = { version = "0.4", features = ["std"] } humantime = "2.3.0" serde_json = "1.0" [dev-dependencies] reqwest = { version = "0.12", features = ["json"] } tempfile = "3" nix = { version = "0.29", features = ["signal"] } serial_test = "3" [profile.release] strip = true lto = true panic = "abort" [package.metadata.deb] maintainer = "Dawid Rycerz" copyright = "2026, Dawid Rycerz" extended-description = """\ Witryna is a minimalist Git-based static site deployment orchestrator. \ It listens for webhook triggers, pulls Git repositories, runs \ containerized build commands, and publishes static assets via atomic \ symlink switching.""" section = "web" priority = "optional" depends = "$auto, adduser, systemd, git, git-lfs" recommends = "podman | docker.io" maintainer-scripts = "debian/" conf-files = ["/etc/witryna/witryna.toml"] assets = [ ["target/release/witryna", "usr/bin/", "755"], ["man/witryna.1", "usr/share/man/man1/witryna.1", "644"], ["man/witryna.toml.5", "usr/share/man/man5/witryna.toml.5", "644"], ["examples/witryna.toml", "etc/witryna/witryna.toml", "644"], ["README.md", "usr/share/doc/witryna/README.md", "644"], ["examples/hooks/caddy-deploy.sh", "usr/share/doc/witryna/examples/hooks/caddy-deploy.sh", "755"], ["examples/caddy/Caddyfile", "usr/share/doc/witryna/examples/caddy/Caddyfile", "644"], ["examples/nginx/witryna.conf", "usr/share/doc/witryna/examples/nginx/witryna.conf", "644"], ["examples/witryna.yaml", "usr/share/doc/witryna/examples/witryna.yaml", "644"], ["examples/systemd/docker.conf", "usr/share/doc/witryna/examples/systemd/docker.conf", "644"], ["examples/systemd/podman.conf", "usr/share/doc/witryna/examples/systemd/podman.conf", "644"], ] [package.metadata.deb.systemd-units] unit-scripts = "debian/" enable = true start = false restart-after-upgrade = true [package.metadata.generate-rpm] summary = "Minimalist Git-based static site deployment orchestrator" description = """\ Witryna is a minimalist Git-based static site deployment orchestrator. \ It listens for webhook triggers, pulls Git repositories, runs \ containerized build commands, and publishes static assets via atomic \ symlink switching.""" group = "Applications/Internet" release = "1" assets = [ { source = "target/release/witryna", dest = "/usr/bin/witryna", mode = "755" }, { source = "man/witryna.1", dest = "/usr/share/man/man1/witryna.1", mode = "644", doc = true }, { source = "man/witryna.toml.5", dest = "/usr/share/man/man5/witryna.toml.5", mode = "644", doc = true }, { source = "examples/witryna.toml", dest = "/etc/witryna/witryna.toml", mode = "644", config = "noreplace" }, { source = "debian/witryna.service", dest = "/usr/lib/systemd/system/witryna.service", mode = "644" }, { source = "README.md", dest = "/usr/share/doc/witryna/README.md", mode = "644", doc = true }, { source = "examples/hooks/caddy-deploy.sh", dest = "/usr/share/doc/witryna/examples/hooks/caddy-deploy.sh", mode = "755", doc = true }, { source = "examples/caddy/Caddyfile", dest = "/usr/share/doc/witryna/examples/caddy/Caddyfile", mode = "644", doc = true }, { source = "examples/nginx/witryna.conf", dest = "/usr/share/doc/witryna/examples/nginx/witryna.conf", mode = "644", doc = true }, { source = "examples/witryna.yaml", dest = "/usr/share/doc/witryna/examples/witryna.yaml", mode = "644", doc = true }, { source = "examples/systemd/docker.conf", dest = "/usr/share/doc/witryna/examples/systemd/docker.conf", mode = "644", doc = true }, { source = "examples/systemd/podman.conf", dest = "/usr/share/doc/witryna/examples/systemd/podman.conf", mode = "644", doc = true }, ] post_install_script = """\ #!/bin/bash set -e # Create system user/group (idempotent) if ! getent group witryna >/dev/null 2>&1; then groupadd --system witryna fi if ! getent passwd witryna >/dev/null 2>&1; then useradd --system --gid witryna --no-create-home \ --home-dir /var/lib/witryna --shell /sbin/nologin witryna fi # Create data + log directories install -d -o witryna -g witryna -m 0755 /var/lib/witryna install -d -o witryna -g witryna -m 0755 /var/lib/witryna/clones install -d -o witryna -g witryna -m 0755 /var/lib/witryna/builds install -d -o witryna -g witryna -m 0755 /var/lib/witryna/cache install -d -o witryna -g witryna -m 0755 /var/log/witryna # Fix config permissions (root owns, witryna group can read) if [ -f /etc/witryna/witryna.toml ]; then chown root:witryna /etc/witryna/witryna.toml chmod 640 /etc/witryna/witryna.toml fi # Auto-detect and configure container runtime if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then if getent group docker >/dev/null; then usermod -aG docker witryna || true fi mkdir -p /etc/systemd/system/witryna.service.d cp /usr/share/doc/witryna/examples/systemd/docker.conf \ /etc/systemd/system/witryna.service.d/10-runtime.conf chmod 644 /etc/systemd/system/witryna.service.d/10-runtime.conf systemctl daemon-reload >/dev/null 2>&1 || true echo "witryna: Docker detected and configured." elif command -v podman >/dev/null 2>&1 && podman info >/dev/null 2>&1; then if ! grep -q "^witryna:" /etc/subuid 2>/dev/null; then usermod --add-subuids 100000-165535 witryna || true fi if ! grep -q "^witryna:" /etc/subgid 2>/dev/null; then usermod --add-subgids 100000-165535 witryna || true fi loginctl enable-linger witryna >/dev/null 2>&1 || true mkdir -p /etc/systemd/system/witryna.service.d cp /usr/share/doc/witryna/examples/systemd/podman.conf \ /etc/systemd/system/witryna.service.d/10-runtime.conf chmod 644 /etc/systemd/system/witryna.service.d/10-runtime.conf systemctl daemon-reload >/dev/null 2>&1 || true echo "witryna: Podman detected and configured." else echo "witryna: WARNING — no container runtime (docker/podman) detected." echo " Install one, then reinstall this package or copy an override from" echo " /usr/share/doc/witryna/examples/systemd/ manually." fi # Reload systemd systemctl daemon-reload >/dev/null 2>&1 || true # Enable (but don't start) on fresh install — matches deb behavior if [ "$1" -eq 1 ]; then systemctl enable witryna.service >/dev/null 2>&1 || true fi""" pre_uninstall_script = """\ #!/bin/bash if [ "$1" -eq 0 ]; then systemctl stop witryna.service >/dev/null 2>&1 || true systemctl disable witryna.service >/dev/null 2>&1 || true fi""" post_uninstall_script = """\ #!/bin/bash if [ "$1" -eq 0 ]; then # Remove user and group userdel witryna >/dev/null 2>&1 || true groupdel witryna >/dev/null 2>&1 || true # Remove config directory and systemd overrides rm -rf /etc/witryna rm -rf /etc/systemd/system/witryna.service.d loginctl disable-linger witryna >/dev/null 2>&1 || true # /var/lib/witryna and /var/log/witryna left for manual cleanup # Reload systemd systemctl daemon-reload >/dev/null 2>&1 || true fi""" [package.metadata.generate-rpm.requires] systemd = "*" shadow-utils = "*" git = "*" git-lfs = "*" [package.metadata.generate-rpm.recommends] podman = "*"