Professional Documents
Culture Documents
Linecook - A Chef Alternative
Linecook - A Chef Alternative
Linecook - A Chef Alternative
(A Chef Alternative)
Simon Chiang
Community
Community
Hotness
Not dismissing Chef when I say that. The advantages over manually writing setup/maintenance script are not to
be underestimated. But for the most part things you do with Chef are things you would otherwise do with shell
scripts, and there are problems.
Never a quick
Quickstart
“Before installing Chef, you should take a moment to
understand the various "flavors" of chef: client-server,
chef-solo, and the Opscode Platform. Deciding which
one is right for you will impact your installation
process. You may also want to take a quick look at
Chef's architecture to get an idea of what you're
installing before you proceed.”
http://wiki.opscode.com/display/chef/Installation
Fixed options :(
Fixed options :(
http://wiki.opscode.com/display/chef/Architecture
http://wiki.opscode.com/display/chef/Vagrant
http://wiki.opscode.com/display/chef/Architecture
http://wiki.opscode.com/display/chef/Vagrant
http://community.opscode.com/cookbooks
http://wiki.opscode.com/display/chef/Architecture
Just use the existing systems. Some ‘advanced’ techniques but all established, known systems
Prior experience applies any learning will feed back into existing workflow
Start with a Script
End with a Script
Able to bring an existing script to Linecook, then rework to make it more powerful or maintainable. You will work
with scripts directly. Again all prior experience applies.
Pretty quick
Quickstart
Make a server
Make a script
Make a server 1
Make a script
Make a server 1
Make a script
Make a server 1
Make a script 3
Run script on server 2
VirtualBox
Install OS
VirtualBox VirtualBox
Install OS
abox-ubuntu
VirtualBox VirtualBox
Install OS
abox-ubuntu
VirtualBox VirtualBox
Install OS
abox-ubuntu
VBoxManage modifyvm abox
--natpf1 'abox-ssh,tcp,,
2220,,22' VirtualBox
Access VM by ssh to
localhost
localhost
abox-ubuntu
VBoxManage modifyvm bbox
--natpf1 'bbox-ssh,tcp,, bbox-ubuntu
2221,,22' ...
Repeat as needed
localhost
ssh -p 2221 linecook@localhost
ssh -p 2220 linecook@localhost
Cmdline control
Multiple VMs
Snapshots
Host bbox
Port 2221
Host *
User linecook
Hostname localhost
DOC
Host bbox
Port 2221
Host *
User linecook
Hostname localhost
DOC
Host bbox
Port 2221
Host *
User linecook
Hostname localhost
DOC
[config/ssh] [packages/abox/run]
Host abox echo "# $(whoami)@$(hostname): hello
Port 2220 world!"
[packages/bbox/run]
Host bbox
echo "# $(whoami)@$(hostname): Hullo
Port 2221
Wurld!"
Host *
User linecook script: run
Hostname localhost remote dir: ~/linecook
hosts: *
linecook run
# linecook@abox-ubuntu: hello world!
# linecook@bbox-ubuntu: Hullo Wurld!
[packages/abox/test]
if [ $(cat /tmp/message.txt) == "hello world" ]
then echo "# success"
else echo "# fail"
fi
linecook start
linecook run
linecook run --script test
linecook ssh abox
linecook snapshot modified
linecook stop
Multiple VMs
Flexible!
[packages/abox/run]
echo "# I will not manually configure my server"
linecook run
# I will not manually configure my server
[recipes/abox.rb]
target <<"SCRIPT"
echo "# I will not manually configure my server"
SCRIPT
[recipes/abox.rb]
target <<"SCRIPT"
echo "# I will not manually configure my server"
SCRIPT
[recipes/abox.rb]
target <<"SCRIPT"
echo "# I will not manually configure my server"
SCRIPT
linecook build
linecook run
# I will not manually configure my server
require 'erb'
compiler = ERB::Compiler.new("<>")
compiler.put_cmd = "target<<"
compiler.insert_cmd = "target<<"
compiler.compile "got <%= obj %>"
recipe = Recipe.new
recipe.instance_eval(code)
recipe.target
recipe = Recipe.new
recipe.extend Helper
recipe.instance_eval %q{
get "milk"
target << ", "
get "cookies"
}
recipe.target
recipe = Recipe.new
recipe.extend Helper
recipe.instance_eval %q{
get "milk"
target << ", "
get "cookies"
This is a recipe!
}
recipe.target
[recipes/abox.rb]
helpers "example"
echo "# I will not manually configure my server"
[recipes/abox.rb]
helpers "example"
echo "# I will not manually configure my server"
[recipes/abox.rb]
helpers "example"
echo "# I will not manually configure my server"
linecook build
linecook run
# I will not manually configure my server
[recipes/abox.rb]
helpers "example"
msg = "# I will not manually configure my server"
echo _color("blue", msg)
[recipes/abox.rb]
helpers "example"
msg = "# I will not manually configure my server"
echo _color("blue", msg)
[recipes/abox.rb]
helpers "example"
msg = "# I will not manually configure my server"
echo _color("blue", msg)
linecook build
linecook run
# I will not manually configure my server
linecook build
linecook run
# I will not manually configure my server
# I will not manually configure my server
# I will not manually configure my server
Reprocessing of output
unless_ _file?('/tmp/message') do
cat.to('/tmp/message').heredoc do
writeln 'hello world!'
end
end
cat('/tmp/message')
if ! [ -f "/tmp/message" ]
then
cat > /tmp/message << HEREDOC_0
hello world!
HEREDOC_0
fi
cat "/tmp/message"
Attributes
Helpers
Recipes Packages
Files
Templates
Server
pinnacol/linecook.git
pinnacol/linebook.git
Me:
github.com/thinkerbot
@thinkerbot