A simple tool for managing deployment and provisioning.
This is specially made for people who'd rather do things like write their own idempotent shell scripts and do their own configuration management with Git than mess around with YAML configs and multiple layers of DSL abstractions.
If this project is interesting to you, chances are you've written something like this yourself in some ad-hoc way a hundred times. I certainly have! But I got tired of making one-offs, so wrapped this up as a nice reusable tool that does the bare minimum that I need or want.
Deploy -- a simple deployment, provisioning, and setup tool
by Wesley J. Landaker <https://github.com/wjl/deploy>
Version 1.0.0
Usage: deploy <command> <arguments...>
Commands:
local Setup the local machine (from setup.d)
remote <host> Deploy to a remote machine
Options:
-h, --help Display this help message
--version Show detailed version information
In a setup.d directory, put any of the following:
- Scripts with a shebang lines.
- Programs marked executable.
- "Module" directories with a
setupprogram/script inside.
Get a copy of this script and put it in your path or throw it in the current directory.
Run deploy local and it'll run all of the above in alphabetical order (like an improved run-parts).
Same setup as above, but run deploy remote <host> and it will upload the files to a tmp directory, do the deployment remotely, and either return success or drop you into a shell to debug if something fails. Either way when it exits it'll do a best effort to clean up after itself.
To avoid pain you should be able to connect with a ssh key without any prompting.
Both the local and remote machine need to have bash, rsync, and ssh. Sorry, I had a version that was pure POSIX shell and used tar piped over ssh to avoid needing rsync, but it was too annoying to maintain, and the only reason I even needed it was to work with vanilla Alpine. Now I just make sure I apk --no-cache add bash rsync while I'm setting up my SSH key, no big deal.
- Make scripts and modules with an intelligent naming (
010-system-updates) or whatever you want. - Be sure your setup scripts, programs and/or modules are idempotent, it's completely up to you.
- Use
deploy localfor "pull" models (nice for e.g. workstations), anddeploy remotefor "push" (nice for e.g. servers). - Either way, always store your provisioning logic in Git, never do anything by hand that you can automate.
- Like Git for dotfiles but found Yadm and friends too unfocused? https://github.com/wjl/dotfiles-project
- Like GNU Make but hate a lot of the defaults? https://github.com/wjl/config-make
- Eh, I should probably post more things publicly, mostly I make things for my own use or for work. ̇😅