LoginSignup
10
7

More than 5 years have passed since last update.

capistranoのcurrent_path、shared_path

Posted at

capistranoのcurrent_pathとshared_pathという変数について

結論

current_path: deploy_toのpath/current
shared_path: deploy_toのpath/shared

deploy.rb内で
set :deploy_to, "/var/www/rails/アプリケーション名"
のように設定していれば、current_pathは
/var/www/rails/アプリケーション名/current
になります。

current、sharedとは

capistranoを用いてdeployをするとサーバーのアプリのルートディレクトリに以下のようなディレクトリが作成されます。

├── current (releases内の最新のディレクトリ)
├── releases
│   ├── 20180308145927
│   ├── 20180308151719
│   └── 20180308154610
├── repo
├── revisions.log
└── shared

releases、current

releassesは過去にdeployしたものの積み重ねです。
そしてreleasesの中から最も新しいものがcurrentに反映されます。

ちなみにcurrentの中身は、以下のようにおなじみのrailsです。

├── app
├── bin
├── config
├── 

shared

sharedにはdeploy.rb内でlinked_files、linked_dirsに設定したファイルが含まれます。
deploy時に作成されるディレクトリを見ていただいたら分かるように、releasesやcurrentに影響を受けないので、database.ymlなどあまり変更のないようなファイル、ディレクトリに適用させるのが良いかもしれません。

repo

gitなどのバージョン管理に関するデータが入ってます。

revisions.log

deployやrollbackのlogが記入されています。

参考

Structure - Capistrano
http://capistranorb.com/documentation/getting-started/structure/
Capistrano Variables - Freelancing Digest
https://www.freelancingdigest.com/articles/capistrano-variables/

10
7
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
10
7