以前といっても既に、3年程前に、Capstranoを設定していたが、既にCapstrano3.xの時代。
久しぶりに設定する機会があったので覚え書き。
Railsの設定
Gemfile にデフォルトでコメントアウトされている下記の記述を有効にして、bundle update 。
# Use Capistrano for deployment
gem 'capistrano-rails', group: :development
$ bundle update
$ capify .
--------------------------------------------------------------------------------
Capistrano 3.x is incompatible with Capistrano 2.x.
This command has become `cap install` in Capistrano 3.x
For more information see http://www.capistranorb.com/
--------------------------------------------------------------------------------
capify . にて設定ファイルを作成しようとしたが、怒られたので、cap install を実行する。
$ cap install
mkdir -p config/deploy
create config/deploy.rb
create config/deploy/staging.rb
create config/deploy/production.rb
mkdir -p lib/capistrano/tasks
create Capfile
Capified
すると、Capfile と、config/deploy.rb、config/deploy/staging.rb、config/deploy/production.rb が作成される。
Gitのサーバ設定
Gitのインストール。
$ yum install git
Git共有リポジトリの作成。
$ mkdir /var/lib/git/public_git/sample.git
$ cd /var/lib/git/public_git/sample.git
$ git init --bare --share
Gitのクライアント設定
$ git init
$ git add .
$ git commit -m "First commit"
$ git remote add sample ssh://User名@Host名:SSHポート番号/var/lib/git/public_git/sample.git
$ git push sample