Code Monkey home page Code Monkey logo

sup's Introduction

Stack Up

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

Demo using the following Supfile:

Sup

Installation

$ go get -u github.com/pressly/sup/cmd/sup

Usage

$ sup [OPTIONS] NETWORK TARGET/COMMAND [...]

Options

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

Network

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.

Target

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.

Command

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.

Supfile

See example Supfile.

Basic structure

# 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

Default environment variables

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

Development

fork it..

$ make tools
$ make build

License

Licensed under the MIT License.

sup's People

Contributors

eduardonunesp avatar lexa-uw avatar lxfontes avatar stengaard avatar vojtechvitek avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.