Skip to content

Runs a shell script straight from your Boot fileset, as root if needed.

Notifications You must be signed in to change notification settings

danielsz/boot-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

boot-shell

A boot task that allows you to run a shell script straight from your fileset. It can even do so as root.

Motivation

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.

Installation

In build.boot:

(set-env! :dependencies ‘[[danielsz/boot-shell "X.X.X"]])
(require '[danielsz.boot-shell :refer [shell]])

Where the current version is:

http://clojars.org/danielsz/boot-shell/latest-version.svg

Usage

$ 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.

License

Copyright © 2015 Daniel Szmulewicz

Distributed under the Eclipse Public License.

About

Runs a shell script straight from your Boot fileset, as root if needed.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published