Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Vagrant Talk (Drupalcamp NJ & Drupalcamp Ottawa)

Vagrant tutorial

Gist with notes from the BoF this afternoon: https://gist.github.com/4699228

Ruby for Chef

Just enough not to freak out

Methods

def double(num)
  num * 2
end
double 33 # => 66

Ruby Strings

:bob == 'bob'.to_sym
%w{git apache2 mysql} == ['git', 'apache2', 'mysql']
"head #{variable} tail" == "head " +  variable + " tail"

Ruby dictionaries

options = {
  :deploy_drupal => { 
    :apache_group => 'vagrant', 
    :sql_load_file => '/vagrant/db/fga.sql.gz',
    :source =>  "/vagrant/public/fga/www",
  },
  :mysql => {
    :server_root_password => "root",
  },
}

DSL

template "/etc/mysql/drupal-grants.sql" do
  path "/etc/mysql/drupal-grants.sql"
  source "grants.sql.erb"
  owner "root"
  group "root"
  mode "0600"
  notifies :run, "execute[mysql-install-drupal-privileges]", :immediately
end

In javascript:

template("/etc/mysql/drupal-grants.sql", function() {  
  this.path("/etc/mysql/drupal-grants.sql");
  this.source("grants.sql.erb");
  this.owner("root");
  this.group("root");
  this.mode("0600");
  this.notifies('run', "execute[mysql-install-drupal-privileges]", 'immediately');
});

Chef Basics

What can recipes do?

Install a user

user "sam" do
     home "/home/sam"
     shell "/bin/zsh"
     comment "Sam loves DevOps"
     action :create
     password :$1$pfFfDG3M$22vsMsPnn93ZnuodI86Ec0
end

Install a template

template '/var/www/sites/default/settings.php' do
  # action :create
  # action :create_if_missing
  source "settings.php.erb"
  variables ( {
    :user => 'root',
    :pass => node[:mysql]['root_password'],
    :name => 'drupalsite_v1',
  })
end

Install packages

package "tar" do
  action :install
end
package %w{vim git}
php_pear "uploadprogress"
gem_package "syntax"

Execute bash

execute "download drupal" do
  cwd '/var/www'
  command "drush dl drupal-7.20"
  creates '/var/www/drupal-7.20/index.php'
end

Deploy from git

deploy "/my/deploy/dir" do
  repo "git@github.com/mycompany/project"
  user "www-data"
  group "www-data"
  revision "master"
  action :sync # default value, also :checkout
end

defining and controlling service daemons

# runs /etc/init.d/apache2 (start|stop|restart), etc.
service "apache2" do
  supports :status => true, :restart => true, :reload => true
  action [ :enable, :start ]
end

apache cookbook: webapp LWRP

web_app 'drupalcampottawa' do
  template "web_app.conf.erb"
  port 80
  server_name 'drupalcampottawa.com'
  docroot '/var/www/dcampottawa'
  notifies :restart, resources("service[apache2]"), :delayed
end

Cookbook structure

@printers3d

3D Printer teknolojisi ilk ilham kaynağını bir animasyon programından aldı. Bu programda dizayn edilen şekiller, ayrı ayrı katmanlara ayrıldı. Bu katmanları sırasıyla oluşturan 3d Printerlar ile sanal olarak dizayn edilen nesnenin katı cismi üç boyutlu yazıcı tarafından medyana getirildi.Bilgisayar ortamında tasarlanan herhangi bir ürün yazıcılar tarafından katı haline dönüştürülebiliyor.Aynı boyut ve aynı şekilde oluşturulan nesneler 3d printerlar ile yeniden tasarlanıyor.

3D Yazıcılar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.