Initial deployment setup

This commit is contained in:
Petko Bordjukov 2014-08-31 17:18:10 +03:00
parent dafc44ec0f
commit eb32abb7e2
5 changed files with 145 additions and 0 deletions

28
Capfile Normal file
View File

@ -0,0 +1,28 @@
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Includes 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
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
require 'capistrano/rails'
require 'capistrano/rvm'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

View File

@ -27,6 +27,10 @@ gem 'phony_rails'
# Picture uploads # Picture uploads
gem 'carrierwave' gem 'carrierwave'
gem 'capistrano'
gem 'capistrano-rails'
gem 'capistrano-rvm'
group :development do group :development do
gem 'spring' gem 'spring'
gem 'spring-commands-rspec' gem 'spring-commands-rspec'

View File

@ -30,6 +30,19 @@ GEM
arel (5.0.1.20140414130214) arel (5.0.1.20140414130214)
bcrypt (3.1.7) bcrypt (3.1.7)
builder (3.2.2) builder (3.2.2)
capistrano (3.2.1)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano-rails (1.1.1)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.1)
capistrano (~> 3.0)
sshkit (~> 1.2)
capybara (2.4.1) capybara (2.4.1)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
@ -52,6 +65,7 @@ GEM
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.8.0) coffee-script-source (1.8.0)
colorize (0.7.3)
countries (0.9.3) countries (0.9.3)
currencies (~> 0.4.2) currencies (~> 0.4.2)
currencies (0.4.2) currencies (0.4.2)
@ -103,6 +117,9 @@ GEM
mini_portile (0.6.0) mini_portile (0.6.0)
minitest (5.4.1) minitest (5.4.1)
multi_json (1.10.1) multi_json (1.10.1)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
nokogiri (1.6.3.1) nokogiri (1.6.3.1)
mini_portile (= 0.6.0) mini_portile (= 0.6.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@ -200,6 +217,10 @@ GEM
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (~> 2.8) sprockets (~> 2.8)
sqlite3 (1.3.9) sqlite3 (1.3.9)
sshkit (1.5.1)
colorize
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
temple (0.6.8) temple (0.6.8)
therubyracer (0.12.1) therubyracer (0.12.1)
libv8 (~> 3.16.14.0) libv8 (~> 3.16.14.0)
@ -225,6 +246,9 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
capistrano
capistrano-rails
capistrano-rvm
capybara capybara
carrierwave carrierwave
coffee-rails coffee-rails

48
config/deploy.rb Normal file
View File

@ -0,0 +1,48 @@
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'clarion'
set :repo_url, 'https://github.com/ignisf/clarion.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/home/barf/clarion'
# Default value for :scm is :git
# set :scm, :git
# Default value for :format is :pretty
# set :format, :pretty
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
set :linked_files, %w{config/puma.rb config/database.yml config/secrets.yml}
# Default value for linked_dirs is []
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
end

View File

@ -0,0 +1,41 @@
# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary server in each group
# is considered to be the first unless any hosts have the primary
# property set. Don't declare `role :all`, it's a meta role.
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server 'marla.ludost.net', user: 'barf', roles: %w{web db app}
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult[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)
# }
#
# And/or per server (overrides global)
# ------------------------------------
# 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'
# }