Chef training Day5
Upcoming SlideShare
Loading in...5
×
 

Chef training Day5

on

  • 6,357 views

Presentation for Day5 training held by SmartMe

Presentation for Day5 training held by SmartMe
http://www.smartme.com.ua/courses/nachala-devops-konfiguriruem-server-s-pomoshchyu-opscode-chef

Statistics

Views

Total Views
6,357
Views on SlideShare
6,357
Embed Views
0

Actions

Likes
0
Downloads
19
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Chef training Day5 Chef training Day5 Presentation Transcript

  • Начала DevOps: Opscode Chef Day 5 Andriy Samilyak samilyak@gmail.com skype: samilyaka
  • Goals ● Knife plugins ● Chef with Windows ● Amazon OpsWorks ● Final practice – LARGE one
  • Plugins ● Custom set of knife commands ● Usually in CHEF_REPO/.chef/plugins/knife/
  • [Maybe] Useful knife plugins ● Knife-flip → moving nodes in environment ● Knife-spork → another workflow ● Knife-preflight → check nodes with cookbook ● Knife-ec2 → Amazon EC2 management ● Knife-sshx → easy ssh login
  • Chef on Windows ● /opt/chef/embedded/bin/gem install knife-windows > knife winrm > knife bootstrap windows http://community.opscode.com/cookbooks/iis http://community.opscode.com/cookbooks/sql_server
  • Windows ACL directory 'C:mordor' do rights :read, 'MORDORMinions' rights :full_control, 'MORDORSauron' end
  • Amazon OpsWorks
  • Final practice - Dokuwiki ● Ubuntu official package is toooo old (2012) ● We need to install it from source https://www.dokuwiki.org/install http://download.dokuwiki.org/ ● We'll create new role, new cookbook, new server
  • Dokuwiki - 1 ● Download tarball What resource should we use?
  • Downloading tarball cookbooks/dokuwiki/recipes/default.rb src_file= "http://download.dokuwiki.org/out/dokuwikide06047915ab0d0e8c04d093b4e15099.tgz" tgt_file = "#{Chef::Config[:file_cache_path]}/dokuwiki.tar.gz" remote_file tgt_file do source src_file mode 0644 action :create_if_missing backup false end
  • Dokuwiki - 2 ● Extract tarball tar -xf dokuwiki.tar.gz -C /var/www What resource should we use?
  • Extracting tarball cookbooks/dokuwiki/recipes/default.rb bash "extract_dokuwiki" do code <<-EOH tar -xf #{tgt_file} -C /var/www EOH end
  • Notifications remote_file "somefile" do source "http://somelink.tgz" mode "0644" action :create_if_missing backup false notifies :run, "bash[extract_dokuwiki]", :immediately end bash "extract_dokuwiki" do action :nothing code "tar -xf dokuwiki.tar.gz -C /var/www" end
  • Dokuwiki - 3 ● Enable Apache default site through attributes/default.rb
  • Enable default Apache site dokuwiki/attributes/default.rb default['apache']['default_site_enabled'] = true default['apache']['docroot_dir'] = “/var/www/dokuwiki”
  • Dokuwiki - 4 ● Install PHP ● Install package libapache2-mod-php
  • Install PHP cookbooks/dokuwiki/recipes/default.rb include_recipe "apache2" include_recipe "php" include_recipe "apache2::mod_php5" NB! Use Community cookbook 'PHP' (metadata.rb)
  • File permissions ● Try running http://yoursite/install.php We have file permissions problem ● We need to set up: chmod -R 775 /var/www/dokuwiki/data chown -R www-data /var/www/dokuwiki/data chmod -R 775 /var/www/dokuwiki/conf chown -R www-data /var/www/dokuwiki/conf copy/paste from http://goo.gl/6sEYT5
  • File permissions cookbooks/dokuwiki/recipes/default.rb bash "set_permissions" do code <<-EOH chmod -R 775 #{node['apache']['docroot_dir']}/data chown -R www-data #{node['apache']['docroot_dir']}/data chmod -R 775 #{node['apache']['docroot_dir']}/conf chown -R www-data #{node['apache']['docroot_dir']}/conf EOH end Now you can run install.php!
  • Dokuwiki - 5 ● Save installer-created files in cookbook /var/www/dokuwiki/conf/acl.auth.php /var/www/dokuwiki/conf/local.php /var/www/dokuwiki/conf/plugins.local.php /var/www/dokuwiki/conf/users.auth.php What resource should we use?
  • Copy files in bulk cookbooks/dokuwiki/recipes/default.rb remote_directory "#{node['apache']['docroot_dir']}/dokuwiki/conf" do files_mode 0422 files_backup false end
  • Dokuwiki - 6 ● Remove install.php What resource should we use?
  • Removing file cookbooks/dokuwiki/recipes/default.rb file "#{node['apache']['docroot_dir']}/dokuwiki/install.php" do action :delete end
  • Dokuwiki – 7 ● Security measures, apply virtualhost as described in https://www.dokuwiki.org/security
  • Party time?