mitamae is a fast, simple, and single-binary configuration management tool with a DSL like Chef
mitamae is a fast, simple, and single-binary configuration management tool with a DSL like Chef
mitamae is a tool to automate configuration management using a Chef-like DSL powered by mruby.
It's been used for provisioning servers, e.g. RubyCI servers and Ruby's git server, and setting up local environments with dotfiles.
Fast - mitamae is optimized for local execution. It uses C functions via mruby libraries for core operations where possible, instead of executing commands on a shell or over a SSH connection like other tools, which is very slow.
Simple - Running mitamae doesn't require Chef Server, Berkshelf, Data Bags, or even RubyGems. The mitamae core provides only essential features. You can quickly be a master of mitamae.
Single Binary - mitamae can be deployed by just transferring a single binary to servers. You don't need to rely on slow operations over a SSH connection to workaround deployment problems.
Download a binary for your platform from GitHub Releases.
curl -O -L https://github.com/itamae-kitchen/mitamae/releases/latest/download/mitamae-x86_64-linux
chmod +x ./mitamae-x86_64-linux
./mitamae-x86_64-linux helpCreate a recipe file as recipe.rb:
package 'nginx' do
action :install
end
service 'nginx' do
action [:enable, :start]
endAnd then execute mitamae local command to apply a recipe to a local machine.
$ mv mitamae-x86_64-linux mitamae
$ ./mitamae local recipe.rb
INFO : Starting mitamae...
INFO : Recipe: /home/user/recipe.rb
INFO : package[nginx] installed will change from 'false' to 'true'
INFO : service[nginx] enabled will change from 'false' to 'true'
INFO : service[nginx] running will change from 'false' to 'true'See mitamae help local for available options. --log-level=debug is helpful to inspect what's executed in detail.
mitamae was built as an alternative implementation of Itamae. Therefore you may refer to resources related to Itamae for mitamae as well.
Please refer to Itamae wiki:
They should be ported to Itamae at some point.
not_if / only_if can take a block instead of a commandfile, remote_file, and template resources have atomic_update attributerun_command streams log output with --log-level debug or log_output: true option.Please see PLUGINS.md for how to install or create plugins for mitamae.
Find mitamae plugins and Itamae plugins supporting mitamae on GitHub.
The DSL is based on mruby instead of standard Ruby unlike Chef and Itamae. You may use the following mruby features in mitamae recipes.
MRUBY_VERSION used by mitamae
and Latest News on mruby.org.When you want to use mitamae on remote servers, you need to distribute a mitamae binary and recipes to the servers and run them remotely. There are at least the following ways to do it:
rsync and run them using ssh when you apply recipes to a few servers.
hocho is a convenient tool to do this. While it's over a SSH connection,
it's much faster than other tools which establish a SSH connection for each operation like itamae ssh.The following recipes are open-source usages of mitamae.
While the DSL is inspired by Chef, there are some differences you need to keep in mind when you migrate Chef recipes to mitamae recipes.
| Chef | mitamae |
|---|---|
cookbook_file |
Use remote_file or template, specifying a path with source. |
directory's recursive true |
directory is recursive true by default |
ruby_block |
Use local_ruby_block. |
shell_out! |
Use run_command. Open3.capture3 or system might suffice too. |
Chef::Log.* |
MItamae.logger.* |
Digest::*.hexdigest |
Use *sum command (e.g. sha1sum) as a workaround. |
bash |
Just use execute or specify bash -c ... with it. |
mitamae's --shell=/bin/bash might also help. |
|
cron |
You may use mitamae-plugin-resource-cron. |
deploy_revision |
You may use mitamae-plugin-resource-deploy_revision. |
| See also: mitamae-plugin-resource-deploy_directory | |
runit_service |
You may use mitamae-plugin-resource-runit_service. |
See CHANGELOG.md.
When you develop your local changes, you can write an integration test under spec/ and run it like:
bundle install
bundle exec rake test:integrationThis requires Docker on your local environment.
No open issues yet, or sync has not completed.