LoginSignup
6
6

More than 5 years have passed since last update.

Capistrano3からVagrantで構築したゲストOSへファイルアップロード

Posted at

環境

MacOS: 10.8.5
Vagrant: 1.5.3
VirtualBox: 4.3.10
GuestOS: CentOS6.3
Capistrano: 3.2

ステージファイル

~/.ssh/configに設定したホスト名をcentosとする。

dev.r
role :app, %w{vagrant@centos}
server 'centos', user: 'vagrant', roles: %w{app}

デプロイスクリプト

例として、tarボールをアップロードし、デプロイする。

deploy.rb
  task :upload do

    app = fetch(:application)
    release_path = fetch(:deploy_to)

    on roles(:app) do
      upload! "#{app}.tgz", "/tmp"
      execute "cd /tmp; tar zxf #{app}.tgz"
      sudo "mv -f /tmp/#{app} #{release_path}"
    end
  end

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6