Skip to content

About

Helper tool meant for personal use

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

Repository files navigation

quadlet-helper (qh)

Things that should probably be part of a script. Involves a good bit of AI-generated code and meant primarily for personal use with quad-bucket.

Motivation

Part of the experiment here is to explore Go as a functional, object-oriented and AOT-compiled alternative to scripting. A largely successful experiment so far.

Features

  • Unit Management: Control quadlet unit files (start, stop, enable, disable, logs, status). Mostly here because I want completions.
  • Cloudflare integration: Automated Cloudflare IP updater.
  • Example files generation: Generate example configurations (currently only traefik) and environment files
  • Backup Management: Create and manage automated backup services using rsync, restic, or rclone. Unnecessarily elaborate, including email notifications. Should have still been just a script.

Quick Start

You probably shouldn't be installing this. If this is somehow exactly what you want, you're probably doing something wrong...

But anyway...

go install github.com/mufeedali/quadlet-helper@latest

Or build from source:

git clone https://github.com/mufeedali/quadlet-helper.git
cd quadlet-helper
go build -ldflags="-s -w" -trimpath -o qh

Usage

# Backup commands
qh backup create <name>      # Create a new backup configuration
qh backup install <name>     # Install backup service and timer
qh backup list               # List all backup configurations
qh backup run <name>         # Run backup immediately
qh backup status <name>      # Check backup status
qh backup logs <name>        # View backup logs
qh backup notify <name> --test       # Send a test notification email
qh backup secret set <name> <KEY>    # Encrypt and store a secret
qh backup secret list <name>         # List declared secrets and whether set
qh backup secret unset <name> <KEY>  # Remove a stored secret

# Unit commands
qh unit list                 # List quadlet units
qh unit start <name>         # Start a unit
qh unit stop <name>          # Stop a unit
qh unit status <name>        # Check unit status
qh unit logs <name>          # View unit logs
qh unit validate <file>      # Validate quadlet file

# Cloudflare commands
qh cloudflare install        # Install Cloudflare IP updater
qh cloudflare run            # Update Cloudflare DNS
qh cloudflare uninstall      # Remove Cloudflare service

# Generate commands
qh generate env       # Generate .env examples
qh generate traefik   # Generate Traefik example

Backup secrets are encrypted with systemd-creds encrypt --user and stored under ~/.config/quadlet-helper/secrets/<name>/. The generated unit loads them with LoadCredentialEncrypted= and qh injects them into the backup tool's environment at run time, so values never appear in the config file or the unit. Requires systemd-creds on the host.

Backup configs live in ~/.config/quadlet-helper/backups/<name>.yaml. The filename is the backup's identity. An optional display_name is used in notifications and qh backup list.

For restic, destination.repository and options.password_file take precedence over an equivalent RESTIC_REPOSITORY / RESTIC_PASSWORD_FILE in environment: or secrets.

Configuration

By default, quadlet-helper looks for container configurations in:

~/.config/containers/systemd

Override with the --containers-path flag:

qh --containers-path /custom/path unit list

Contributing

Don't bother. This one isn't worth it. Unless you think otherwise... In which case, sure, go on.

License

MIT. See LICENSE.

About

Helper tool meant for personal use

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages