• Stars
    star
    1,269
  • Rank 35,694 (Top 0.8 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created about 12 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easily create full-stack installers for your project across a variety of platforms.

Omnibus Icon Omnibus

Gem Version Build Status

Umbrella Project: Chef Foundation

Project State: Active

Issues Response Time Maximum: 14 days

Pull Request Response Time Maximum: 14 days

Easily create full-stack installers for your project across a variety of platforms.

Seth Chisamore and Christopher Maier of CHEF gave an introductory talk on Omnibus at ChefConf 2013, entitled Eat the Whole Bowl: Building a Full-Stack Installer with Omnibus:

This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the CHEF Release Engineering OSS Management Guide.

Prerequisites

Omnibus is designed to run with a minimal set of prerequisites. You will need the following:

  • Ruby 2.6+

Get Started

Omnibus provides both a DSL for defining Omnibus projects for your software, as well as a command-line tool for generating installer artifacts from that definition.

To get started, install Omnibus locally on your workstation.

$ gem install omnibus

You can now create an Omnibus project in your current directory by using the project generator feature.

$ omnibus new $MY_PROJECT_NAME

This will generate a complete project skeleton in the directory omnibus-$MY_PROJECT_NAME

By default this will make a directory called omnibus-$MY_PROJECT_NAME assuming you're keeping your omnibus config separate from the repo. However, keeping it in your repo is a common practice, so feel to rename this directory to omnibus and place it in the top level of your projects source repo.

$ cd omnibus-$MY_PROJECT_NAME
$ bundle install --binstubs

More details can be found in the generated project's README file.

Omnibus determines the platform for which to build an installer based on the platform it is currently running on. That is, you can only generate a .deb file on a Debian-based system. To alleviate this caveat, the generated project includes a Test Kitchen setup suitable for generating a series of Omnibus projects.

More documentation

Configuration DSL

Though the template project will build, it will not do anything exciting. For that, you need to use the Omnibus DSL to define the specifics of your application.

Config

If present, Omnibus will use a top-level configuration file named omnibus.rb at the root of your repository. This file is loaded at runtime and includes a number of configuration tunables. Here is an example:

# Build locally (instead of /var)
# -------------------------------
base_dir './local'

# Disable git caching
# ------------------------------
use_git_caching false

# Enable S3 asset caching
# ------------------------------
use_s3_caching true
s3_bucket      ENV['S3_BUCKET']

# There are three ways to authenticate to the S3 bucket

# 1. set `s3_access_key` and `s3_secret_key`
s3_access_key  ENV['S3_ACCESS_KEY']
s3_secret_key  ENV['S3_SECRET_KEY']

# 2. set `s3_profile` to use an AWS profile in the Shared Credentials files
#s3_profile    ENV['S3_PROFILE']

# 3. set `s3_iam_role_arn` to use an AWS IAM role
#s3_iam_role_arn    ENV['S3_IAM_ROLE_ARN']

For more information, please see the Config documentation.

You can tell Omnibus to load a different configuration file by passing the --config option to any command:

$ bin/omnibus --config /path/to/config.rb

Finally, you can override a specific configuration option at the command line using the --override flag. This takes ultimate precedence over any configuration file values:

$ bin/omnibus --override use_git_caching:false

Projects

A Project DSL file defines your actual application; this is the thing you are creating a full-stack installer for in the first place. It provides a means to define the dependencies of the project (again, as specified in Software DSL definition files), as well as ways to set installer package metadata.

All project definitions must be in the config/projects directory of your Omnibus repository.

name            "chef-full"
maintainer      "YOUR NAME"
homepage        "http://yoursite.com"

install_dir     "/opt/chef"
build_version   "0.10.8"
build_iteration 4

dependency "chef"

Some DSL methods available include:

DSL Method Description
name The name of the project
install_dir The desired install location of the package
build_version The package version
build_iteration The package iteration number
dependency An Omnibus software-defined component to include in this package
package Invoke a packager-specific DSL
compress Invoke a compressor-specific DSL

By default a timestamp is appended to the build_version. You can turn this behavior off by setting append_timestamp to false in your omnibus.rb or using --override append_timestamp:false at the command line.

For more information, please see the Project documentation.

Software

Omnibus "software" files define individual software components that go into making your overall package. They are the building blocks of your application. The Software DSL provides a way to define where to retrieve the software sources, how to build them, and what dependencies they have. These dependencies are also defined in their own Software DSL files, thus forming the basis for a dependency-aware build ordering.

All Software definitions should go in the config/software directory of your Omnibus project repository.

Here is an example:

name "ruby"
default_version "1.9.2-p290"
source url: "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
       md5: "604da71839a6ae02b5b5b5e1b792d5eb"

dependency "zlib"
dependency "ncurses"
dependency "openssl"

relative_path "ruby-#{version}"

build do
  command "./configure"
  command "make"
  command "make install"
end

Some of the DSL methods available include:

DSL Method Description
name The name of the software component (this should come first)
default_version The version of the software component
source Directions to the location of the source
dependency An Omnibus software-defined component that this software depends on
relative_path The relative path of the extracted tarball
build The build instructions

For more DSL methods, please consult the Software documentation.

Additionally, there are a number of DSL methods available inside the build block:

DSL Method Description
command Execute a single shell command
make Run make (with or without args), using gmake when appropriate
patch Apply a patch from disk
workers The maximum number of builders
windows_safe_path Format the path to be safe for shelling out on Windows
go Execute the code as the embedded Go
ruby Execute the code as the embedded Ruby
gem Execute the code as the embedded Rubygems
bundle Execute the code as the embedded Bundler
rake Execute the code as the embedded Rake gem
block Execute Ruby block at build time
erb Render the given ERB template
mkdir Create the given directory
touch Create the given empty file
delete Remove the given file or directory
strip Strip symbols from binaries on a given file or directory
copy Copy a to b
move Move a to b
link Link a to b
sync Copy all files from a to b, removing any union files

For more DSL methods, please consult the Builder documentation.

You can support building multiple versions of the same software in the same software definition file using the version method and giving a block:

name "ruby"
default_version "1.9.2-p290"

version "1.9.2-p290" do
  source url: "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
         md5: "604da71839a6ae02b5b5b5e1b792d5eb"
end

version "2.1.1" do
  source url: "http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-#{version}.tar.gz",
         md5: "e57fdbb8ed56e70c43f39c79da1654b2"
end

Since the software definitions are simply ruby code, you can conditionally execute anything by wrapping it with pure Ruby that tests for the version number.

Sharing software definitions

The easiest way to share organization-wide software is via bundler and Rubygems. For an example software repository, look at Chef's omnibus-software. For more information, please see the Rubygems documentation.

It is recommended you use bundler to pull down these gems (as bundler also permits pulling software directly from GitHub):

gem 'my-company-omnibus-software'
gem 'omnibus-software', github: 'my-company/omnibus-software'

Then add the name of the software to the list of software_gems in your Omnibus config:

software_gems %w(my-company-omnibus-software omnibus-software)

You may also specify local paths on disk (but be warned this may make sharing the project among teams difficult):

local_software_dirs %w(/path/to/software /other/path/to/software)

For all of these paths, order matters, so it is possible to depend on local software version while still retaining a remote software repo. Given the above example, Omnibus will search for a software definition named foo in this order:

$PWD/config/software/foo.rb
/path/to/software/config/software/foo.rb
/other/path/to/software/config/software/foo.rb
/Users/sethvargo/.gems/.../my-company-omnibus-software/config/software/foo.rb
/Users/sethvargo/.gems/.../omnibus-software/config/software/foo.rb

The first instance of foo.rb that is encountered will be used. Please note that local (vendored) softare definitions take precedence!

Building

Once you've created your package and software definitions you can build with:

./bin/omnibus build $MY_PACKAGE_NAME

However there are several caveats to be aware of:

  1. You will almost certainly want to uncomment the base_dir in omnibus.rb, or at the very least change cache_dir and build_dir as otherwise it'll try to use /var/cache/omnibus and /opt/$MY_PROJECT_NAME, requiring root.
  2. Update software dependencies listed in the project configuration in config/projects/$MY_PROJECT_NAME.rb. You can refer the software .rb files present in the config/software folder.
  3. The install_dir specified in the project file typically requires root privilege at build time. Change it another location such as "/tmp/#{name}" to avoid running as root.
  4. The default configuration created for you references a lot of things that are in the default config that come from the omnibus-software gem. So you want to use those you'll need to either uncomment it in the Gemfile, or fork it, and then reference your own
  5. If this is a ruby project and you want binstubs in /opt/$project/bin, you will either need to use appbundler, or you will need to have a post install step to create those binstubs.
    • Side note, appbundler requires that you include your Gemfile and gemspec in your gem.
    • Also, needs to be in your Gemfile for you to use it, as it also must be in the resulting gem.
  6. If you specify an override of the version of the ruby, you will also need to override rubygems and bundler to match the versions in that version of ruby or you'll get failures around bundler version mismatches.

The build command above will of course build on your local host thus being specific to the OS and base system you are on. But the skeleten setup by omnibus new already setup kitchen for you so that it's easy to build for a variety of OSes, See the README.md in your generated omnibus directory for details.

Version Manifest

Git-based software definitions may specify branches as their default_version. In this case, the exact git revision to use will be determined at build-time unless a project override (see below) or external version manifest is used. To generate a version manifest use the omnibus manifest command:

omnibus manifest PROJECT -l warn

This will output a JSON-formatted manifest containing the resolved version of every software definition.

Whitelisting Libraries

Sometimes a platform has libraries that need to be whitelisted so the healthcheck can pass. The whitelist found in the healthcheck code comprises the minimal required for successful builds on supported platforms.

To add your own whitelisted library, simply add a regex to your software definition in your omnibus project as follows:

whitelist_file /libpcrecpp\.so\..+/

It is typically a good idea to add a conditional to whitelist based on the specific platform that requires it.

Warning: You should only add libraries to the whitelist that are guaranteed to be on the system you install to; if a library comes from a non-default package you should instead build it into the package.

Changelog

STATUS: EXPERIMENTAL

omnibus changelog generate will generate a changelog for an omnibus project. This command currently assumes:

  • A version-manifest.json file is checked into the project root
  • The project is a git repository
  • Each version is tagged with a SemVer compliant annotated tag
  • Any git-based sources are checked out at ../COMPONENT_NAME
  • Any commit message line prepended with ChangeLog-Entry: should be added to the changelog

These assumptions will change as we determine what works best for a number of our projects.

Caveats

Overrides

The project definitions can override specific software dependencies by passing in override to use the correct version:

name "chef-full"
# <snip>

# This will override the default version of "chef"
override :chef, version: "2.1.1"

dependency "chef"

The overridden version must be defined in the associated software!

Debugging

By default, Omnibus will log at the warn level. You can override this by passing the --log-level flag to your Omnibus call:

$ bin/omnibus build <project> --log-level info # or "debug"

Git caching

by default, Omnibus caches compiled software definitions, so n+1 Omnibus project builds are much faster. This functionality can be disabled by adding the following to your omnibus.rb:

use_git_caching false

Contributing

For information on contributing to this project see https://github.com/chef/chef/blob/master/CONTRIBUTING.md

License

Copyright 2012-2016 Chef Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

chef

Chef Infra, a powerful automation platform that transforms infrastructure into code automating how infrastructure is configured, deployed and managed across any environment, at any scale
Ruby
7,442
star
2

bento

Packer templates for building minimal Vagrant baseboxes for multiple platforms
HCL
4,197
star
3

ohai

Ohai profiles your system and emits JSON
Ruby
672
star
4

chef-zero

Simple, easy-run, fast-start in-memory Chef server for testing and solo purposes
Ruby
534
star
5

chef-vault

Securely manage passwords, certs, and other secrets in Chef
Ruby
407
star
6

knife-ec2

Chef knife plug-in for AWS EC2
Ruby
403
star
7

chef-server

Chef Infra Server is a hub for configuration data; storing cookbooks, node policies and metadata of managed nodes.
Erlang
279
star
8

automate

Chef Automate provides a full suite of enterprise capabilities for maintaining continuous visibility into application, infrastructure, and security automation.
Go
220
star
9

supermarket

Chef's community platform
Ruby
210
star
10

knife-vsphere

Chef knife plug-in for VMware vSphere
Ruby
201
star
11

knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Ruby
151
star
12

mixlib-shellout

mixin library for subprocess management, output collection
Ruby
132
star
13

omnibus-software

Open Source Software for use in Omnibus built packages
Ruby
132
star
14

chef-workstation

Chef Workstation gives you everything you need to get started with Chef, so you can automate how you audit, configure, and manage applications end environments.
Go
131
star
15

chef-web-docs

All The Documentation
HTML
127
star
16

mixlib-cli

A mixin for creating command line applications - gives an easy DSL for argument specification and processing
Ruby
123
star
17

knife-openstack

Chef Infra knife plug-in for OpenStack
Ruby
120
star
18

cookstyle

A linting tool that helps you to write better Chef Infra cookbooks and InSpec profiles by detecting and automatically correcting style, syntax, and logic mistakes in your code.
Ruby
107
star
19

chef-oss-practices

Documentation and Practices for Open Source Development at Chef
Ruby
81
star
20

os_release

A repo containing the /etc/os-release file from various Linux distros
73
star
21

knife-azure

Chef knife plug-in for Microsoft Azure
Ruby
72
star
22

artifactory-client

A simple, lightweight Ruby client for interacting with the Artifactory API.
Ruby
68
star
23

knife-google

Chef knife plug-in for Google Compute
Ruby
67
star
24

win32-service

A Ruby library that allows users to inspect, control or create services on MS Windows
Ruby
65
star
25

mixer

Mix in functions from other modules
Erlang
64
star
26

concrete

Concrete enhances your rebar based Erlang project by providing a common Makefile wrapper, a dialyzer make target that caches PLT analysis of your project's dependencies, and a mechanism to specify development only dependencies.
Erlang
55
star
27

mixlib-config

A simple class based Config mechanism, similar to the one found in Chef
Ruby
51
star
28

sqerl

General purpose RDBMS abstraction layer
Erlang
42
star
29

vscode-chef

Chef Infra Extension for Visual Studio Code
TypeScript
40
star
30

cheffish

Resources and tools for testing and interacting with Chef and Chef Server.
Ruby
39
star
31

knife-tidy

Report on stale Chef Server nodes/cookbooks, clean those up and additionally clean data integrity issues from a knife-ec-backup object based backup!
Ruby
36
star
32

homebrew-chef

A homebrew tap for ChefDK, Workstation, and InSpec
Ruby
36
star
33

mixlib-log

A simple class based Log mechanism, similar to Merb and Chef, that you can mix in to your project.
Ruby
34
star
34

effortless

Automated best practices for Chef Infra and Chef InSpec
Shell
33
star
35

knife-ec-backup

Backup and restore Chef Infra Server in a repository-compatible format
Ruby
31
star
36

chef-load

chef-load - a tool for simulating load on a Chef Infra Server and/or a Chef Automate server
Roff
31
star
37

mini_s3

Minimal AWS S3 client for Erlang
Erlang
28
star
38

okta_aws

Tool for accessing the AWS API for an account you normally access via okta
Python
27
star
39

omnitruck

Web service to automate the release of Omnibus artifacts
Ruby
26
star
40

dep-selector

Fast Dependency Solver for Ruby using Gecode
Ruby
25
star
41

win32-process

A Ruby library that adds or redefines several methods for the Process module
Ruby
25
star
42

kitchen-vcenter

A test-kitchen driver for vCenter REST API
Ruby
25
star
43

omnibus-ctl

Provides service control for omnibus packages
Ruby
23
star
44

mixlib-authentication

AuthN signing and verification. Appears in both the client and server
Ruby
22
star
45

knife-cloud

Library for Chef knife cloud plugins
Ruby
18
star
46

win32-taskscheduler

A Ruby interface for the task scheduler on MS Windows
Ruby
17
star
47

mixlib-versioning

General purpose Ruby library that allows you to parse, compare, and manipulate version strings in multiple formats.
Ruby
17
star
48

win32-eventlog

The win32-eventlog library provides a Ruby interface for reading from and writing to the Windows Event Log
Ruby
17
star
49

chefstyle

Version Pinned RuboCop with Chef approved Cop list for linting software - NOT FOR COOKBOOKS
Ruby
15
star
50

chef-cli

The 'chef' command line tool included in Chef Workstation
Ruby
14
star
51

win32-file

Extra methods, and redefined methods, for the File class on MS Windows
Ruby
14
star
52

appbundler

Generate locked binstubs for ruby applications
Ruby
14
star
53

stats_hero

General purpose stats collection
Erlang
13
star
54

knife-vrealize

Plugin for Chef's knife tool to interact with VMware vRealize products
Ruby
13
star
55

anka-buildkite-plugin

Run Buildkite steps inside Veertu Anka Virtual Machines
Shell
13
star
56

chef-apply

The ad-hoc execution tool for the Chef ecosystem.
Ruby
13
star
57

wmi-lite

Lightweight, low-dependency wrapper for basic WMI functionality on Windows.
Ruby
13
star
58

mixlib-install

A library for interacting with Chef Software Inc's software distribution systems.
Ruby
12
star
59

ffi-libarchive

A Ruby FFI binding to libarchive.
Ruby
12
star
60

chef_authn

Erlang API request authentication signing and verification for Chef
Erlang
11
star
61

fixie

Low level manipulation tool for chef in sql
Ruby
10
star
62

ffi-yajl

Ruby FFI gem wrapper around yajl2 library
Ruby
10
star
63

dep-selector-libgecode

Bundled Gecode Libraries for dep-selector
Ruby
10
star
64

win32-certstore

Ruby library for accessing the certificate store on Windows
Ruby
10
star
65

corefoundation

FFI based Ruby bindings for the CoreFoundation frameworks
Ruby
10
star
66

chef-workstation-app

The Chef Workstation desktop application.
TypeScript
10
star
67

knife-vcenter

Chef knife plug-in for VMware REST API
Ruby
9
star
68

win32-security

A Ruby interface for security aspects of MS Windows
Ruby
9
star
69

win32-dir

A series of constants, and extra or redefined methods, for the Dir class on Windows
Ruby
8
star
70

chef_backup

A library to backup an Chef server
Ruby
8
star
71

chef-vault-testfixtures

provides an RSpec shared context for testing Chef cookbooks that use chef-vault
Ruby
7
star
72

opscoderl_httpc

Opscode helper application for being an HTTP client
Erlang
7
star
73

license-acceptance

Chef Software libraries for accepting usage license
Ruby
7
star
74

rubydistros

Dockerfiles for Ruby on various Linux distros
Dockerfile
7
star
75

win32-mmap

A Ruby interface for memory mapped files on MS Windows
Ruby
7
star
76

win32-event

A Ruby interface to Event objects on MS Windows
Ruby
6
star
77

chef-analyze

A CLI to analyze artifacts from a Chef Infra Server
Go
6
star
78

license_scout

Discovers license information of the dependencies of a project.
Ruby
6
star
79

.github

.github files that are inherited by all org repos unless specifically included in a repo
6
star
80

cookbook-omnifetch

Fetch Chef Cookbooks from Various Sources to a Local Cache
Ruby
6
star
81

github-workflows

Github Actions Workflows
5
star
82

win32-ipc

A Ruby abstract base class for synchronization objects on MS Windows
Ruby
5
star
83

appbundle-updater

A little help when you want to update an appbundled project inside of a Chef/ChefDK omnibus package
Ruby
5
star
84

ci-studio-common

Shared helpers for use inside CIs (like Travis) and a Habitat Studio
Go
5
star
85

omnibus-toolchain

Omnibus packaging for Omnibus toolchain
Ruby
5
star
86

chef-web-core

Shared resources for Chef web properties
Ruby
5
star
87

gatherlogs-reporter

Inspec profiles for examining gatherlog output from chef-products for support.
Ruby
5
star
88

architecture-center

Ruby
5
star
89

chocolatey-packages

PowerShell
4
star
90

compliance-workshop-environment

Ruby
4
star
91

inspec-extra-resources

Ruby
4
star
92

folsom_graphite

Send data from folsom automatically to graphite
Erlang
4
star
93

cookstylist

Cookstyle GitHub app
Ruby
4
star
94

chef-powershell-shim

.NET 4.0/COM wrapper around PowerShell host
Ruby
4
star
95

automate-liveness-agent

Agent that sends "keep alive" messages to Chef Automate
Ruby
4
star
96

community_cookbook_releaser

A simple script to aid in version bumps and changelog generation for Chef managed community cookbooks
Ruby
4
star
97

habitat_exporter

Go
4
star
98

mixlib-archive

A very simple gem to create and extract archives.
Ruby
4
star
99

win32-mutex

A Ruby interface for mutexes on MS Windows
Ruby
3
star
100

chef_dictionary

A dictionary file of words in the Chef ecosystem
Ruby
3
star