vagrant chef

17
Vagrant + Chef Hiroki Nigorinuma 1354日土曜日

Upload: hiroki-nigorinuma

Post on 12-Nov-2014

1.132 views

Category:

Technology


2 download

DESCRIPTION

Vagrant & chef

TRANSCRIPT

Page 1: Vagrant chef

Vagrant + ChefHiroki Nigorinuma

13年5月4日土曜日

Page 2: Vagrant chef

Index

Prepared

Vagrantfile & Commands

Server Standard

Chef Structure

Chef Resources

13年5月4日土曜日

Page 3: Vagrant chef

Prepared

install Virtual Box

https://www.virtualbox.org/wiki/Downloads

install vagrant

gem install vagrant

13年5月4日土曜日

Page 5: Vagrant chef

Vagrant Setting

mkdir [project name]

cd [project name]

vagrant init -> appear Vagrantfile

13年5月4日土曜日

Page 6: Vagrant chef

VagrantfileVagrantfile

vagrant standard setting file

for Example

13年5月4日土曜日

Page 7: Vagrant chef

Vagrantfile detail

config.vm.box = “[box name]”

Select using box

config.vm.network :hostonly, “[address]”

Setting IP address

minimum necessary !!

13年5月4日土曜日

Page 8: Vagrant chef

Vagrant CommnadsVagrant up -> server start

Vagrant reload -> server restart

Vagrant ssh -> ssh to server

Vagrant halt -> server shutdown

Vagrant destroy -> destroy server

Vagrant provision -> efficient chef

13年5月4日土曜日

Page 9: Vagrant chef

Server Standard

minimum necessary set

PHP + MySQL + Apache

Ruby + MySQL + Apache

Ruby + PostgreSQL + Nginx

...etc

13年5月4日土曜日

Page 10: Vagrant chef

Chef Structure 1

[project]/

Vagrantfile

cookbooks/

[setting directory]/

13年5月4日土曜日

Page 11: Vagrant chef

Chef Structure 2[setting directory]/

recipes/

default.rb

templates/

default/

[file name].erb

attributes/

[file name].rb

...etc

minimum necessary !!13年5月4日土曜日

Page 12: Vagrant chef

Setting directory

Opscode git repository

https://github.com/opscode-cookbooks

git clone [repository URL]

standard setting but too many files

13年5月4日土曜日

Page 13: Vagrant chef

Chef Resourcesfor original settingResources

package -> install

template -> read template file

execute -> run command

service -> start, restart, stop ...

directory -> make directory

...etc

13年5月4日土曜日

Page 14: Vagrant chef

Chef Resources Syntax

[resources] [application_name] do action [option], ... [attributes] [option], ...end

General

For examplepackage “mysql” do action :install version “5.5”end

13年5月4日土曜日

Page 15: Vagrant chef

Packageinstall , upgrade, remove, ...

yum_package -> default

yum install ~

rpm_package

gem_package

...etc

13年5月4日土曜日

Page 16: Vagrant chef

Templatestemplate “/etc/mysql/my.cnf” do source “my.cnf.erb” path “/etc/mysql/my.cnf”end

templates/default/

my.cnf.erb

13年5月4日土曜日

Page 17: Vagrant chef

Note

http://docs.opscode.com/search.html

13年5月4日土曜日