GithubHelp home page GithubHelp logo

lloeki / apply Goto Github PK

View Code? Open in Web Editor NEW
50.0 4.0 4.0 10 KB

Simple zero-dependency tool to provision *nix machines

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.51% Shell 98.49%

apply's Introduction

apply

Lightweight provisioning tool to apply shell scripts on a local or remote machine.

Usage

push pushes bash scripts called units through ssh to execute:

./push -v units/update units/sshd units/ssh_authorized_keys [email protected]

Units are processed on the target machine by the run script. Each unit executes within its own subshell so no variable leak occurs. Each subshell is run with set -euo pipefail. Each subshell also sources the contents of lib which defines a few convenience functions.

By writing those unit scripts to be idempotent you can just run them again and again. Units can be aggregated in groups, which can themselves reference other groups:

./push -v groups/base groups/ruby units/dockerd [email protected]

Finally, you can define hosts, which are like groups, only they save you some typing to apply units to multiple targets:

./apply -v hosts/foo.example.com hosts/bar.example.com

The above can be made to process hosts in parallel:

./apply -v -p hosts/foo.example.com hosts/bar.example.com

Since units/, groups/, and hosts/, are just directories and files, autocompletion works immediately and you could get creative with shell expansion for arguments.

./apply hosts/{foo,bar}.example.com hosts/test.*

Rationale

At some point in a previous company we had a lot of individual VPSes set up basically the same way. I was sick of internal documentation that listed step-by-step commands intertwined with descriptions and manual actions, and any attempt at puppet or ansible just blew up because it was something else to learn by the team (believe me, I tried, it just wouldn't stick with anyone).

So I created apply.

It turned out to be a deceptively simple, down-to-earth experience, immediately accessible, trivially enabled literate coding, and overall extremely useful both to pragmatically set up and maintain those VPSes as well as creating dev environments, or local VMs to test a e.g one-shot unit performing a change or migration.

apply's People

Contributors

lloeki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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