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

ChatOpsで快適リリース生活

 ChatOpsで快適リリース生活

Takashi Kanemoto

September 07, 2015
Tweet

More Decks by Takashi Kanemoto

Other Decks in Programming

Transcript

  1. ฐࣾͷϦϦʔεϓϩηεͷมભ 1 FTP ࣄނଟൃ / ڪා 2 git pull ໘౗

    / ෆ҆ 3 cap deploy ϩά࢒Βͣ / QAඍົ 4 ŴƅŧŖ ϩά࢒Δ / QA҆৺
  2. Πϯετʔϧ $ gem install capistrano $ cd /path/to/project $ cap

    install # 設定ファイルのひな形を作成
  3. ΠϯετʔϧʢSymfonyͷ৔߹ʣ $ cd /path/to/project $ cap install # 設定ファイルのひな形を作成 $

    gem install capistrano $ gem install capistrano-symfony # 設定ファイルの場所を変更 $ mv config/* app/config/ $ rm -rf config
  4. ઃఆϑΝΠϧ $ tree . ├── Capfile ├── app │ └──

    config │ ├── deploy │ │ ├── production.rb │ │ └── staging.rb │ ├── deploy.rb │ : :
  5. lock '3.4.0' set :repo_url, '[email protected]:your/project.git' set :keep_releases, 3 set :linked_files,

    fetch(:linked_files, []).push('app/config/parameters.yml') set :ssh_options, { # 環境変数CAP_PRIVATE_KEYでssh鍵のパスを受け取る keys: [ENV['CAP_PRIVATE_KEY']], forward_agent: true } # マイグレーションタスクを定義 namespace :deploy do task :migrate do invoke 'symfony:console', 'doctrine:migrations:migrate', '--no-interaction' end end after 'deploy:updated', 'composer:install' after 'composer:install', 'symfony:assetic:dump' after 'composer:install', 'deploy:migrate' after 'deploy:finishing', 'deploy:cleanup' ઃఆྫʢdeploy.rbʣ
  6. circle.yml deployment: production: branch: release commands: - bundle install -

    bundle exec cap production deploy staging: branch: master commands: - bundle install - bundle exec cap staging deploy