-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from ToruHirashima/aws-deploy
自動デプロイ機能実装
- Loading branch information
Showing
6 changed files
with
150 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Load DSL and set up stages | ||
require "capistrano/setup" | ||
|
||
# Include default deployment tasks | ||
require "capistrano/deploy" | ||
|
||
# Load the SCM plugin appropriate to your project: | ||
# | ||
# require "capistrano/scm/hg" | ||
# install_plugin Capistrano::SCM::Hg | ||
# or | ||
# require "capistrano/scm/svn" | ||
# install_plugin Capistrano::SCM::Svn | ||
# or | ||
require "capistrano/scm/git" | ||
install_plugin Capistrano::SCM::Git | ||
|
||
# Include tasks from other gems included in your Gemfile | ||
# | ||
# For documentation on these, see for example: | ||
# | ||
# https://github.com/capistrano/rvm | ||
# https://github.com/capistrano/rbenv | ||
# https://github.com/capistrano/chruby | ||
# https://github.com/capistrano/bundler | ||
# https://github.com/capistrano/rails | ||
# https://github.com/capistrano/passenger | ||
# | ||
# require "capistrano/rvm" | ||
# require "capistrano/rbenv" | ||
# require "capistrano/chruby" | ||
# require "capistrano/bundler" | ||
# require "capistrano/rails/assets" | ||
# require "capistrano/rails/migrations" | ||
# require "capistrano/passenger" | ||
|
||
require 'capistrano/rbenv' | ||
require 'capistrano/bundler' | ||
require 'capistrano/rails/assets' | ||
require 'capistrano/rails/migrations' | ||
require 'capistrano3/unicorn' | ||
|
||
# Load custom tasks from `lib/capistrano/tasks` if you have any defined | ||
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Xq5kVC/AkvsJ0RMff9QjHSbdenECqbOkb4arQXxEkx6ESPwladLidt84Ju3jxpi9RAmovSwzuPdLFA0Kbqq7LeIt7NBz09Z9Yw0ajOtLJl0kJbfBQ8HXVVQ8gcLnUAAkEkVZ5UurdVRf7qUTSEH0S1FjwtzAMCFiBogfVXzYRsNd8T5pvTHZOvLNR+fWm8EynonouuWfnb15Sj8iLeTAYKp6qjl25MWfoE9Uj3yv5WE0WyCGK+4rtlG/mN4/aCpQ62KSqhK4bHVGAtrRBNAK77mhpCeDC1CGa08PHiLTDQlraGxf6akc0DxHT2A3qBVnMftGCGiI1RMopoU8UUEBt3xu5jn8eT5CinKDbFRTe95fod//ZQMIO+GmAmb5V4iFrQdEm+wvJtOJCYOclZVsymA7oXUy59hLdXzX--x/EXYxVgrg/QhZF+--XHVaw08P3on7axLhaKDZPw== | ||
N6/q5IsA60SKTXwvQi7w0pzXSWVpgd1xMTOTRvJngqTGUtwNsv78iPmZ+DywtT/3avgH0v1s5EGgW3lriofEty+SDeUm98RKlg65JQGdbFDSKeNQIcqpaOSXf7ETE1mCb2Ni7RVuAIquUmHRoSKFfRMhHYLWyZ7T6O/1NGL1W+3JUC/1bMXjXmDwdQCQFuDE3IFDm0fUCj+p7yhZ6/UAMY+JDZ7E/2IXaZa2/sYmi9Ec1Gd82IRzhdQFmTz0+xe9dTLJQ0VyncridKDAbKoj6zJxqw8FcTltFAGa1aX3S2A/LxP9+d6ZJgrqgRYL1qyiWz7XMMPVFcEvdUNOB1D/bN2BYyVbhzIezx8xh78OwO1j3pi356u3f6cQJzlxPDWTIa+MhkgsHEClmfxkpG1b8U4=--yeS1D2EZpQq2McAG--Jz0OqdZPjjvPpwOR9ugZ2Q== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# config valid only for current version of Capistrano | ||
# capistranoのバージョンを記載。固定のバージョンを利用し続け、バージョン変更によるトラブルを防止する | ||
lock '3.12.0' | ||
|
||
# Capistranoのログの表示に利用する | ||
set :application, 'freemarket_sample_65a' | ||
|
||
# どのリポジトリからアプリをpullするかを指定する | ||
set :repo_url, '[email protected]:ToruHirashima/freemarket_sample_65a.git' | ||
|
||
# バージョンが変わっても共通で参照するディレクトリを指定 | ||
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads') | ||
|
||
set :rbenv_type, :user | ||
set :rbenv_ruby, '2.5.1' #カリキュラム通りに進めた場合、2.5.1か2.3.1です | ||
|
||
# どの公開鍵を利用してデプロイするか | ||
set :ssh_options, auth_methods: ['publickey'], | ||
keys: ['~/.ssh/freemarket_sample_65a.pem'] | ||
|
||
# プロセス番号を記載したファイルの場所 | ||
set :unicorn_pid, -> { "#{shared_path}/tmp/pids/unicorn.pid" } | ||
|
||
# Unicornの設定ファイルの場所 | ||
set :unicorn_config_path, -> { "#{current_path}/config/unicorn.rb" } | ||
set :keep_releases, 5 | ||
|
||
# デプロイ処理が終わった後、Unicornを再起動するための記述 | ||
after 'deploy:publishing', 'deploy:restart' | ||
namespace :deploy do | ||
task :restart do | ||
invoke 'unicorn:restart' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
# server "db.example.com", user: "deploy", roles: %w{db} | ||
server "52.193.148.9", user: "ec2-user", roles: %w{app db web} | ||
|
||
set :rails_env, "production" | ||
set :unicorn_rack_env, "production" | ||
|
||
# role-based syntax | ||
# ================== | ||
# ================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# server-based syntax | ||
# ====================== | ||
# Defines a single server with a list of roles and multiple properties. | ||
# You can define all roles on a single server, or split them: | ||
|
||
# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value | ||
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value | ||
# server "db.example.com", user: "deploy", roles: %w{db} | ||
|
||
|
||
|
||
# role-based syntax | ||
# ================== | ||
|
||
# Defines a role with one or multiple servers. The primary server in each | ||
# group is considered to be the first unless any hosts have the primary | ||
# property set. Specify the username and a domain or IP for the server. | ||
# Don't use `:all`, it's a meta role. | ||
|
||
# role :app, %w{[email protected]}, my_property: :my_value | ||
# role :web, %w{[email protected] [email protected]}, other_property: :other_value | ||
# role :db, %w{[email protected]} | ||
|
||
|
||
|
||
# Configuration | ||
# ============= | ||
# You can set any configuration variable like in config/deploy.rb | ||
# These variables are then only loaded and set in this stage. | ||
# For available Capistrano configuration variables see the documentation page. | ||
# http://capistranorb.com/documentation/getting-started/configuration/ | ||
# Feel free to add new variables to customise your setup. | ||
|
||
|
||
|
||
# Custom SSH Options | ||
# ================== | ||
# You may pass any option but keep in mind that net/ssh understands a | ||
# limited set of options, consult the Net::SSH documentation. | ||
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start | ||
# | ||
# Global options | ||
# -------------- | ||
# set :ssh_options, { | ||
# keys: %w(/home/rlisowski/.ssh/id_rsa), | ||
# forward_agent: false, | ||
# auth_methods: %w(password) | ||
# } | ||
# | ||
# The server-based syntax can be used to override options: | ||
# ------------------------------------ | ||
# server "example.com", | ||
# user: "user_name", | ||
# roles: %w{web app}, | ||
# ssh_options: { | ||
# user: "user_name", # overrides user setting above | ||
# keys: %w(/home/user_name/.ssh/id_rsa), | ||
# forward_agent: false, | ||
# auth_methods: %w(publickey password) | ||
# # password: "please use keys" | ||
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters