Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
/ bedouin Public archive
forked from dbresson/bedouin

A templating system for Hashicorp's Nomad orchestration

License

Notifications You must be signed in to change notification settings

lavaai/bedouin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bedouin

Bedouin is a tool for templatizing job files for Hashicorp Nomad.

Installation

Add this line to your application's Gemfile:

gem 'bedouin'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bedouin

Usage

Create one or more environment files and one or more ERB job templates, and then execute:

$ bedouin [nomad option ...] [--] <environment file> <template1> <template2> ...

Bedouin will evaluate each template with any attributes from the environment file available as instance variables. Bedouin will then run the results of each with "nomad run".

Environment Files

Environment files should contain any environment-specific information needed to templatize the Nomad job definitions.

In the file myname.rb

environment "myname" do |e|
  e.foo = "bar"
end

This would make an environment file which injects the value "bar" for @foo in any template files. @name is also available with the value "myname".

Environments are also able to inherit from other environments. Simply specify the path of the parent environment file as a second argument to the environment method:

In the file mydir/mychild.rb

environment "mychild", "../myname.rb" do |e|
  e.bar = "baz"
end

As these files are pure ruby, there is a vast amount of possibilities for how to use them. All they must do is return an object which converts to a Hash.

Template Files

Template files are just ERuby files that output a valid nomad job file. For information about ERuby, see https://en.wikipedia.org/wiki/ERuby.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Docker

The Dockerfile in docker/ is used to build an image that is capable of building Nomad for alpine. When run, that image produces a tarball which can be fed back into docker build to produce the final image.

The docker/build.sh script will do this for you.

docker/build.sh <NOMAD VERSION>

docker/build.sh 0.5.5

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/compellon/bedouin.

License

The gem is available as open source under the terms of the MIT License.

About

A templating system for Hashicorp's Nomad orchestration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 90.5%
  • Dockerfile 5.2%
  • Shell 4.3%