laravel - Getting started with chef, and running composer install on deploy -


we're looking deploy few laravel4 based php apps on amazon opsworks, requires few things:

  • grab code git
  • download composer.phar getcomposer.com
  • run php composer.phar install
  • change permissions on few specific folders

i'm fresh comes chef, looking place grips basics of chef, , how achieve tasks above, appreciate pointers.

i'm no chef guru (i use puppet) try following:

grab code git

you may want execute wget command (see examples below).

if want more sophisticated see http://docs.opscode.com/resource_deploy.html

deploy_revision "/path/to/application"   repo 'ssh://name-of-git-repo/repos/repo.git'   migrate false   purge_before_symlink %w{one 2 folder/three}   create_dirs_before_symlink []   symlinks(     "one"   => "one",     "two"   => "two",     "three" => "folder/three"   )   before_restart     # ruby code   end   notifies :restart, "service[foo]"   notifies :restart, "service[bar]" end 

download composer.phar getcomposer.com

i execute wget.

i lifted code here: http://cookingclouds.com/2012/06/23/chef-simple-cookbook-example/

it's doing wget in specific folder, extracting contents of tar & updating permissions on new files. if folder doesn't exist.

# run bash shell -  download , extract composer bash "install_composer"      user "root"      cwd "/folder/to/extact/to"      code <<-eoh        wget http://getcomposer.com/composer.tar.gz        tar -xzf composer.tar.gz        chown -r user:group /folder/to/extact/to      eoh      not_if "test -d /folder/to/extact/to" end 

run php composer.phar install

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

execute "composer install"   command "php composer.phar install && touch /var/log/.php_composer_installed"   creates "/var/log/.php_composer_installed"   action :run end 

this run once, otherwise can remove "creates" , run each time.

change permissions on few specific folders

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

directory "/tmp/folder"   owner "root"   group "root"   mode 0755   action :create end 

if directory exists, nothing happen. if directory changed in way, resource marked updated.

finally

i find search handy, browsing stuff on chef site seems hopeless (too stuff dig through). http://docs.opscode.com/search.html


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -