Giter Club home page Giter Club logo

wrap2's Introduction

wrap2

wrap2 is process and configuration manager tailored for Docker with Kubernetes environment.

It supports:

  • Template generation from environ and secrets
  • Managing multiple processes from single declaration file
  • PID1 handling of system events
  • Cron jobs

Template

Format is based of Golang default template parser see:

Extra functions:

  • env > gets value from environment
  • k8s > load value from secret Kubernetes volume mount

CRON

Based of https://godoc.org/github.com/robfig/cron:

Predefined schedules:

Entry                  | Description                                | Equivalent To
-----                  | -----------                                | -------------
@yearly (or @annually) | Run once a year, midnight, Jan. 1st        | 0 0 0 1 1 *
@monthly               | Run once a month, midnight, first of month | 0 0 0 1 * *
@weekly                | Run once a week, midnight between Sat/Sun  | 0 0 0 * * 0
@daily (or @midnight)  | Run once a day, midnight                   | 0 0 0 * * *
@hourly                | Run once an hour, beginning of hour        | 0 0 * * * *

Example:

ENV var example {{env "CUSTOM"}}
Secret var example {{k8s "secret"}}

{{if {{env "DEFINED_ENV_VARIABLE"}}}} 
    {{k8s "special_secret"}}
{{end}}

Configuration

[pre_start]
  cmd = "/bin/bash /pre_start"
  user = "dz0ny"
[post_start]
  cmd = "/bin/bash /post_start"
  user = "dz0ny"

[[process]]
  cmd = "nginx -V -E"
  user = "www-data"
  [process.config]
    src = "source.tmpl"
    out = "target.tmpl"
    [process.config.data]
      domain = "test.tld"

[[process]]
  cmd = "php -v"
  user = "www-data"
  [process.config]
    src = "source.tmpl"
    out = "target.tmpl"
   [process.enabled]
     operator="EnvNotEqual"
     # EnvEqual > env variable matches value
     # EnvNotEqual > env variable does not match value

     # EnvNotEndsWith > env variable does not end with value
     # EnvEndsWith > env variable ends with value

     # EnvNotStartsWith > env variable does not start with value
     # EnvStartsWith > env variable starts with value
     key= "KIND"
     value="scaled"

[[process]]
  cmd = "true -v"

[[cron]]
  schedule = "@every 5s"
  [cron.job]
    cmd = "echo tick"
    user = "www-data"

Usage

$ ./wrap2-Linux-x86_64 -help                                                                                05/09/18 -  1:24 PM
Usage of ./wrap2-Linux-x86_64:
  -config string
        Location of the init file (default "/provision/init.toml")

wrap2's People

Contributors

dz0ny avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

woocart

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.