Git Product home page Git Product logo

finglonger's Introduction

finglonger

Finglonger

Finglonger is a small tool that turns an intention log into shell commands that are run by a robot on a server. This means you can use git and code review to poke servers instead of rooters logging in.

setup

You need a repo to hold the log. Make this.

  • Clone finglonger into /opt/git/finglonger (or wherever)
  • virtualenv /opt/git/finglonger/venv
  • /opt/git/finglonger/venv/bin/pip install pyyaml
  • Clone the log repo into /opt/git/finglonger-tasks/
  • Symlink in the finglonger hook: ln -s /opt/git/finglonger/finglonger-hook /opt/git/finglonger-tasks/.git/hooks/post-merge
  • Create /var/run/finglonger.lock and /var/log/finglonger.log such that the user running finglonger can write to them
  • (optional) setup logrotate on the finglonger log file
  • Set some kind of a cron job to run 'git pull' in the log git repo periodically. It will automatically run things from the log.
    • For example, adding the following to the appropriate user's crontab would cause finglonger to run once every five minutes and log to /var/log/finglonger.log:

      ```shell
      */5 * * * * cd /opt/git/finglonger-tasks && flock -n /var/run/finglonger.lock git pull >> /var/log/finglonger.log 2>&1
      ```
      

finglonger-tasks repo

You need a finglonger tasks repo. Start out with:

envs/default/tasks.yaml
files/
scripts/

See https://github.com/nibalizer/finglonger-tasks as an example Tasks will only be run in the environment they are set in.

log format

Start your log(tasks.yaml) out looking like this:

---
task:
  name: job
  shell: echo test +
task:
  name: job
  shell: echo test +

Add one task object per commit or things are gonna break for you.

Config file

Finglonger is controlled by ~/.config/finglonger/finglongerrc

environment=myenv

The default environment is 'default'. If you don't have a finglongerrc, 'default' will be used. Tasks will only be run in the environment they are set in.

Note

Finglonger is super beta, it will probably set your computer on fire. Try it, break it, and lets make it better together.

Examples

Echo some hello world

task:
  name: Hello world job
  shell: echo 'Hello, World!'

Copy a file to a host

(Add config.js to the files directory in your finglonger-tasks)

task:
  name: Copy config.js to /var/www/html/myapp on app-server1.example.com
  shell: scp files/config.js [email protected]:/var/www/html/myapp/config.js

Restart some service on a host

task:
  name: Restart nova-api on compute1
  shell: ssh [email protected] 'service nova-api restart'

finglonger's People

Contributors

mlangbehn avatar nibalizer avatar

Watchers

 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.