A boot task that allows you to run a shell script straight from your fileset. It can even do so as root.
This is how my deployment pipeline looks like:
(deftask deploy
[]
(comp
(cljs :optimizations :advanced)
(build)
(runit :env {:http-port 8010
:db-url "link/to/db"
:repl-port 8013}
:restart true)
(shell :password "base64-encoded-string" :script "commit.sh")))
As you may guess, the build
task produces a jar, the runit
task produces a shell script that, when executed, will move everything into place for the runit supervisor, and finally, the shell
task executes the latter. This is effectively a deployment scenario reduced to one command.
In build.boot
:
(set-env! :dependencies ‘[[danielsz/boot-shell "X.X.X"]])
(require '[danielsz.boot-shell :refer [shell]])
Where the current version is:
$ boot shell -h
Runs a shell script, optionally as root
Options:
-h, --help Print this help info.
-s, --script VAL Set the shell script to run to VAL.
-p, --password VAL Set the root password to VAL
If you set a password, the shell script will be executed as root. The password must be encoded in base64. Does that make it safe? Absolutely not! Please don’t commit your build.boot
in a public repo. Pull requests adding security features will be accepted. One idea is to pull the password from an encrypted file.
Copyright © 2015 Daniel Szmulewicz
Distributed under the Eclipse Public License.