Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/visionmedia/stack
Minimalist provisioning tool written in Go.
https://github.com/visionmedia/stack
Last synced: about 1 hour ago
JSON representation
Minimalist provisioning tool written in Go.
- Host: GitHub
- URL: https://github.com/visionmedia/stack
- Owner: visionmedia
- Created: 2014-08-10T23:04:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-08-25T06:17:43.000Z (over 2 years ago)
- Last Synced: 2025-01-01T12:11:27.842Z (7 days ago)
- Language: Go
- Homepage:
- Size: 205 KB
- Stars: 311
- Watchers: 10
- Forks: 10
- Open Issues: 19
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# Stack
Minimalist provisioning tool written in Go.
![golang provisioning tool stack](https://dl.dropboxusercontent.com/u/6396913/stack/provision.gif)
```sh
# Node
curl -L# http://nodejs.org/dist/v0.10.30/node-v0.10.30-darwin-x64.tar.gz | tar -zx --strip 1 -C /usr/local# Node version manager
npm install -g n# Node releases
n 0.8.28
n 0.10.30
n 0.11.13
```## Installation
Via go-get:
```
$ go get github.com/visionmedia/stack/cmd/stack
```Via binaries:
```
soonnnnn
```## Usage
```
Usage:
stack [--list] [--no-color] [--verbose]
stack -h | --help
stack --versionOptions:
-C, --no-color output with color disabled
-l, --list output commit status
-V, --verbose output command stdio
-h, --help output help information
-v, --version output version
```## About
There are a lot of great provisioning tools out there, but as far as
I know most of them are part of much larger systems, use unfamiliar DSLs,
or rely on the presence of an interpreter for scripting languages such as Ruby or Python.I'm not suggesting this tool is better than any existing solution but I really wanted
something that looked and behaved like a regular shell script. Also since it's written in Go it's very simple to curl the binary on to any existing system.The choice of using shell commands makes this tool less declarative than
some of the alternatives, however I think it's a good fit for the goal
of being a minimalistic solution.## How it works
Stack behaves like shell scripts with `set -e`, as it will exit on failure. Unlike
shell scripts a commit log is used in order to prevent re-execution of previous commands.The log is held at ~/.provision.log (by default), this file keeps
track of commands which have already completed. Once a command is run
and successfully exits, it is considered complete, at which time the
SHA1 of the command is written to this file. Subsequent runs will see
the SHA and ignore the command.The commit log is shared between any number of provision files, this
means the same command run in a different provisioning script will
no-op if it has already been successfully run.If a command line is modified it will result in a different hash,
thus it will be re-run.This gif illustrates how exiting after the initial "commit" will cause it to be ignored
the second time around:![stack commits](https://dl.dropboxusercontent.com/u/6396913/stack/provision-commits.gif)
## Syntax
The syntax has two flavours, the shell-like syntax, and the canonical version which pkg/provisioner consumes. For example here is the shell version of a small node.js provisioning script:
```sh
# Node
curl -L# http://nodejs.org/dist/v0.10.30/node-v0.10.30-darwin-x64.tar.gz | tar -zx --strip 1 -C /usr/local# Node version manager
npm install -g n# Node releases
n 0.8.28
n 0.10.30
n 0.11.13
```Here's the same script after it's rewritten to the canonical syntax:
```sh
LOG Node
RUN curl -L# http://nodejs.org/dist/v0.10.30/node-v0.10.30-darwin-x64.tar.gz | tar -zx --strip 1 -C /usr/localLOG Node version manager
RUN npm install -g nLOG Node releases
RUN n 0.8.28
RUN n 0.10.30
RUN n 0.11.13
```## Commands
Currently only a few commands are supported, however more
may be added in the future to simplify common processes,
provide concurrency, and so on.Open an issue if there's something you'd like to see!
### RUN
`RUN ` executes a command through `/bin/sh`, so shell
features such as globbing, brace expansion and pipelines will
work as expected.If the `` exits > 0 then commit is a failure and will
not be written to the log.Lines without a command are considered to be `RUN` lines.
### LOG
`LOG ` simply outputs a log message to stdio.
Aliased as `#`.
### INCLUDE
`INCLUDE ` reads the file at ``, rewrites it
and injects it into the location of this command in the
pre-processing step.The include `` is relative to the CWD.
Aliased as `.` and `source`.
## Options
### --verbose
By default output is suppressed, however `--verbose` will stream std{err,out}:
![stack provisioning verbose](https://dl.dropboxusercontent.com/u/6396913/stack/provision-verbose.gif)
## Running tests
All tests:
```
$ make test
```Individual tests:
```
$ cd pkg/rewriter
$ go test
```# License
MIT