Stack Up is a simple deployment tool that performs given set of commands on multiple hosts in parallel. It reads Supfile, a YAML configuration file, which defines networks (groups of hosts), commands and targets.
Demo using the following Supfile:
$ go get -u github.com/pressly/sup/cmd/sup
$ sup [OPTIONS] NETWORK TARGET/COMMAND [...]
Option | Description |
---|---|
--help , -h |
Print help/usage |
--version , -v |
Print version |
-f Supfile |
Location of Supfile |
--only REGEXP |
Filter NETWORK hosts using regexp string |
--except REGEXP |
Filter out NETWORK hosts using regexp string |
A group of hosts on which COMMAND will be invoked in parallel.
# Supfile
networks:
production:
hosts:
- api1.example.com
- api2.example.com
- api3.example.com
staging:
hosts:
- stg1.example.com
$ sup production COMMAND
will invoke COMMAND on all production hosts in parallel.
$ sup staging TARGET
will invoke TARGET on the staging host.
An alias to run multiple COMMANDS.
# Supfile
targets:
deploy:
- build
- pull
- migrate-db-up
- stop-rm-run
- health
- slack-notify
- airbrake-notify
$ sup production deploy
will invoke build
, pull
, migrate-db-up
, stop-rm-run
and slack-notify
commands sequentially on all production hosts.
A shell command (or set of commands) to be run remotely.
# Supfile
commands:
restart:
desc: Restart example Docker container
run: sudo docker restart example
tail-logs:
desc: Watch tail of Docker logs from all hosts
run: sudo docker logs --tail=20 -f example
exec:
desc: Exec into Docker container on all hosts
stdin: true
run: sudo docker exec -i example bash
bash:
desc: Interactive Bash on all hosts
stdin: true
run: bash
$ sup production restart
will restart all production example
Docker containers in parallel.
$ sup production tail-logs
will tail Docker logs from all production example
containers in parallel.
$ sup production exec
will Docker Exec into all production Docker containers and run interactive shell.
$ sup production bash
will run interactive shell on all production hosts.
See example Supfile.
# Supfile
---
version: 0.3
# Global environment variables
env:
NAME: api
IMAGE: example/api
networks:
local:
hosts:
- localhost
staging:
hosts:
- stg1.example.com
production:
hosts:
- api1.example.com
- api2.example.com
commands:
echo:
desc: Print some env vars
run: echo $NAME $IMAGE $SUP_NETWORK
date:
desc: Print OS name and current date/time
run: uname -a; date
targets:
all:
- echo
- date
$SUP_NETWORK
- Name of the NETWORK that the command was originally issued against.$SUP_USER
- Name of user who issued the command.$SUP_TIME
- Date and time of the original command line invocation.
fork it..
$ make tools
$ make build
Licensed under the MIT License.