space, → | next slide |
← | previous slide |
d | debug mode |
## <ret> | go to slide # |
c | table of contents (vi) |
f | toggle footer |
r | reload slides |
z | toggle help (this) |
apt-get install gcc
package { "gcc": ensure => installed }
/etc
and /usr/local
.root
access, so use it.$ echo "deb http://packages.devstructure.com lucid main" | sudo tee /etc/apt/sources.list.d/devstructure.list $ sudo wget -O /etc/apt/trusted.gpg.d/devstructure.gpg \ http://packages.devstructure.com/keyring.gpg $ sudo apt-get update ... $ sudo apt-get -y install blueprint ... $ blueprint Usage: blueprint <command> [...] Common commands: list, create, show, diff, apply, destroy, git $
sudo gem install mysql2
bundle install --path vendor/bundle
bundle install --system
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz tar -zxvf ruby-1.9.2-p180.tar.gz cd src/ruby-1.9.2-p180 ./configure --prefix=/usr make make install DESTDIR=/tmp/installdir fpm -s dir -t deb -n ruby -v 1.9.2-p180 -C /tmp/installdir \ -p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \ -d "libc6 (>= 2.6)" -d "libffi5 (>= 3.0.4)" \ -d "libgdbm3 (>= 1.8.3)" -d "libncurses5 (>= 5.7)" \ -d "libreadline6 (>= 6.1)" -d "libssl0.9.8 (>= 0.9.8)" \ -d "zlib1g (>= 1:1.2.2)" \ usr/bin usr/lib usr/share/man usr/include
blueprint create foo
$ sudo blueprint create foo # [blueprint] searching for APT packages to exclude # [blueprint] caching excluded APT packages # [blueprint] searching for Yum packages to exclude # [blueprint] parsing ~/.blueprintignore # [blueprint] searching for Yum packages # [blueprint] searching for APT packages # [blueprint] searching for Python packages # [blueprint] searching for PEAR/PECL packages # [blueprint] searching for Ruby gems # [blueprint] searching for configuration files # [blueprint] searching for software built from source # [blueprint] searching for service dependencies $
/etc
../configure && make && make install
blueprint show foo | less
{ "files": { "/etc/apt/sources.list.d/devstructure.list": { "content": "deb http://packages.devstructure.com natty main\n", "encoding": "plain", "group": "root", "mode": "100644", "owner": "root" } }, "packages": { "apt": { "openssh-server": ["1:5.8p1-1ubuntu3"], } }, "services": { "sysvinit": { "ssh": { "packages": { "apt": ["openssh-server"] } } } } }
{ "packages": { "apt": { "libc6-dev": ["2.13-0ubuntu13"], "libruby1.8": ["1.8.7.302-2"], "libruby1.8-dev": ["1.8.7.302-2"], "ruby1.8": ["1.8.7.302-2"], "ruby1.8-dev": ["1.8.7.302-2"], "ruby": ["4.5"], "ruby-dev": ["4.5"], "rubygems1.8": ["1.3.7-3"] }, "rubygems1.8": { "mysql2": ["0.3.7"], "rack": ["1.3.3"], "sinatra": ["1.2.1", "1.2.6"], "tilt": ["1.3.3"] } }, "sources": { "/usr/local": "0b53de6a4fd7fcc3d029a7c08c0279842c1f1cb3.tar" } }
blueprint show-packages foo
apt libc6-dev 2.13-0ubuntu13 apt libruby1.8 1.8.7.302-2 apt libruby1.8-dev 1.8.7.302-2 apt ruby1.8 1.8.7.302-2 apt ruby1.8-dev 1.8.7.302-2 apt ruby 4.5 apt ruby-dev 4.5 apt rubygems1.8 1.3.7-3 rubygems1.8 mysql2 0.3.7 rubygems1.8 rack 1.3.3 rubygems1.8 sinatra 1.2.1 rubygems1.8 sinatra 1.2.6 rubygems1.8 tilt 1.3.3
blueprint show-sources foo
tar tv
output./usr/local 0b53de6a4fd7fcc3d029a7c08c0279842c1f1cb3.tar drwxr-xr-x root/root 0 2011-08-10 23:20 ./ drwxr-xr-x root/root 0 2011-08-10 21:29 ./share/ -rw-r--r-- root/root 84 2011-08-10 22:48 ./share/foobar
~/.blueprintignore
gitignore
(5)./etc/apt !/etc/apt/sources.list.d !/etc/apt/trusted.gpg.d *.pyc /etc/hosts /etc/nginx/sites-enabled/default /etc/sudoers :package:apt/build-essential !:package:apt/build-essential :package:apt/libopts25 :package:apt/libtspi1 :package:rubygems1.8/tilt :source:/usr/local/share/foobar !:source:/opt
blueprint push foo
blueprint pull foo
$ blueprint push foo # [blueprint] completed - blueprint URL: https://devstructure.com/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcd efghijklmnopqrstuvwxyz_-/foo $ blueprint pull https://devstructure.com/0123456789ABCDEFGHIJKLM NOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-/foo # [blueprint] completed - blueprint stored locally and ready for use $
blueprint apply foo
blueprint show -S foo
foo.sh
without installing Blueprint.mkdir -p "/etc/apt/sources.list.d" cat >"/etc/apt/sources.list.d/devstructure.list" <<EOF deb http://packages.devstructure.com natty main EOF export APT_LISTBUGS_FRONTEND="none" export APT_LISTCHANGES_FRONTEND="none" export DEBIAN_FRONTEND="noninteractive" apt-get -q update [ "$(dpkg-query -f'${Version}\n' -W openssh-server)" \ = "1:5.8p1-1ubuntu3" ] || { apt-get -y -q -o DPkg::Options::=--force-confold install \ openssh-server=1:5.8p1-1ubuntu3 SERVICE_sysvinit_ssh=1 } [ -n "$SERVICE_sysvinit_ssh" ] && /etc/init.d/ssh restart
blueprint show -P foo
blueprint show -C foo
class foo { Class['files'] -> Class['packages'] class files { file { '/etc/apt/sources.list.d/devstructure.list': content => template('foo/etc/apt/sources.list.d/devstructure.list'), ensure => file, group => root, mode => 0644, owner => root; } } include files class packages { class apt { package { 'openssh-server': ensure => '1:5.8p1-1ubuntu3'; } } include apt } include packages class services { class sysvinit { service { 'ssh': enable => true, ensure => running, subscribe => Package['openssh-server'], } } include sysvinit } include services }
cookbook_file('/etc/apt/sources.list.d/devstructure.list') do backup false group 'root' mode '0644' owner 'root' source 'etc/apt/sources.list.d/devstructure.list' end package('openssh-server') { version '1:5.8p1-1ubuntu3' } service('ssh') do action [:enable, :start] subscribes :restart, resources('package[openssh-server]') end
cron
(8).0 * * * * curl https://devstructure.com/secret/foo/foo.sh | sh
#!/bin/sh set -e TMPDIR="$(mktemp -d)" cd "$TMPDIR" trap "rm -rf \"$TMPDIR\"" EXIT wget "http://devstructure.com/secret/foo/foo.sh" sh "$(ls)"
systemd
.