Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CIハンズオン@PHPカンファレンス福岡-環境構築

 CIハンズオン@PHPカンファレンス福岡-環境構築

Kaz Watanabe

June 27, 2015
Tweet

More Decks by Kaz Watanabe

Other Decks in Programming

Transcript

  1. WHO? • Θͨͳ΂͔ͣͻΖ(@kaz_29) • ߹ಉձࣾ decr (decr.jp) • PHP(CakePHP)ͰWebΞϓϦ։ൃ •

    Πϯϑϥߏஙɾӡ༻ • iOSΞϓϦ։ൃ #beer #iosdev #cakephp #cat #camp #golf #chef #vagrant
  2. ඞཁͳ΋ͷ • VitrtualBox - https://www.virtualbox.org/ • Vagrant - https://www.vagrantup.com/ •

    (ChefDK - https://downloads.getchef.com/chef-dk/) ग़དྷΔ͚ͩ࠷৽Λ࢖͏
  3. BOXFILE௥Ճ $ vagrant box add handson_develop ~/Desktop/develop.box $ vagrant box

    add handson_ci ~/Desktop/ci.box $ vagrant box add handson_deploy ~/Desktop/deploy.box ͖ͬ͞USB͔Βίϐʔͨ͠΋ͷΛ࢖͍ͬͯͩ͘͞ʂ
  4. ؀ڥઃఆϦϙδτϦΛऔಘ $ git clone https://github.com/kaz29/php_ci_env phpci_handson $ git checkout -b

    handson origin/handson $ cd phpci_handson $ mkdir application $ mkdir -p application/app/webroot $ echo "<?php phpinfo();" > application/app/webroot/index.php
  5. Vagrantfileͷղઆ … config.vm.define :develop do |develop| develop.omnibus.chef_version = :latest develop.vm.hostname

    = "develop" develop.vm.box = "opscode-ubuntu-14.04" develop.vm.box_url = "handson_develop.box" develop.vm.network :private_network, ip: "192.168.33.10" develop.vm.synced_folder "application", "/var/www/application/ current", id: "vagrant-root", :nfs => false, :owner => "vagrant", :group => "www-data", :mount_options => ["dmode=775,fmode=775"] …
  6. Vagrantfileͷղઆ … develop.vm.provision :chef_solo do |chef| chef.log_level = "debug" chef.cookbooks_path

    = "./cookbooks" chef.json = { nginx: { docroot: { owner: "vagrant", group: "vagrant", path: "/var/www/application/current/app/webroot", force_create: true }, default: { fastcgi_params: { CAKE_ENV: "development" } }, test: { available: true, fastcgi_params: { CAKE_ENV: "test" } } } } chef.run_list = %w[ recipe[apt] recipe[phpenv::default] recipe[phpenv::composer] recipe[phpenv::develop] recipe[capistrano] ] end …
  7. 伴Λ࡞ͬͯొ࿥ $ vagrant ssh develop $ ssh-keygen Generating public/private rsa

    key pair. Enter file in which to save the key (/home/vagrant/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: … $ cat ~/.ssh/id_rsa.pub ެ։伴Λίϐʔ
  8. ΞϓϦέʔγϣϯΛॳظԽ $ vagrant ssh develop $ cd /var/www/application/current $ rm

    -rf * $ git clone git://github.com/decr/blogapp.git . (<=υοτ) $ cd /var/www/application/current/app $ composer install --dev