first go at capping

This commit is contained in:
Torsten Ruger 2016-04-15 10:43:10 +03:00
parent d664a2b4d2
commit d34bfad008
9 changed files with 51 additions and 151 deletions

3
.gitignore vendored
View File

@ -24,7 +24,8 @@ db/*.sqlite3
/tmp/*
# add /config/database.yml if it contains passwords
# /config/database.yml
/config/database.yml
/config/secrets.yml
# various artifacts
**.war

21
Capfile
View File

@ -1,10 +1,10 @@
# Load DSL and Setup Up Stages
# Load DSL and set up stages
require 'capistrano/setup'
# Includes default deployment tasks
# Include default deployment tasks
require 'capistrano/deploy'
# Includes tasks from other gems included in your Gemfile
# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
@ -12,15 +12,14 @@ require 'capistrano/deploy'
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails/tree/master/assets
# https://github.com/capistrano/rails/tree/master/migrations
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
#require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
require 'capistrano/rails'
require 'capistrano/passenger'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

View File

@ -21,11 +21,11 @@ group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
gem 'better_errors'
gem 'capistrano', '~> 3.0.1'
gem 'capistrano'
gem 'capistrano-bundler'
gem 'capistrano-rails', '~> 1.1.0'
gem 'capistrano-rails'
gem 'capistrano-rails-console'
gem 'capistrano-rvm', '~> 0.1.1'
gem 'capistrano-passenger'
gem 'guard-bundler'
gem 'guard-rails'
gem 'guard-rspec'

View File

@ -73,21 +73,20 @@ GEM
thor (~> 0.19)
builder (3.2.2)
byebug (8.2.2)
capistrano (3.0.1)
capistrano (3.4.1)
i18n
rake (>= 10.0.0)
sshkit (>= 0.0.23)
capistrano-bundler (1.1.2)
capistrano (~> 3.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-rails (1.1.0)
capistrano (>= 3.0.0)
capistrano-bundler (>= 1.0.0)
capistrano-rails-console (0.5.2)
capistrano (>= 3.0.0, < 4.0.0)
capistrano-rvm (0.1.2)
capistrano-passenger (0.2.0)
capistrano (~> 3.0)
sshkit (~> 1.2)
capistrano-rails (1.1.6)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rails-console (1.0.2)
capistrano (>= 3.1.0, < 4.0.0)
capybara (2.6.2)
addressable
mime-types (>= 1.16)
@ -207,7 +206,7 @@ GEM
nenv (0.3.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.1.0)
net-ssh (3.1.1)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
normalize-rails (3.0.3)
@ -252,7 +251,7 @@ GEM
activesupport (= 4.2.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.1.1)
rake (11.1.2)
rb-fchange (0.0.6)
ffi
rb-fsevent (0.9.7)
@ -348,11 +347,11 @@ DEPENDENCIES
better_errors
bootstrap-sass
byebug
capistrano (~> 3.0.1)
capistrano
capistrano-bundler
capistrano-rails (~> 1.1.0)
capistrano-passenger
capistrano-rails
capistrano-rails-console
capistrano-rvm (~> 0.1.1)
capybara
coffee-rails (~> 4.1.0)
database_cleaner

View File

@ -19,11 +19,3 @@ development:
test:
<<: *default
database: db/test.sqlite3
production:
adapter: mysql2
database: web-dev_all
username: web-dev
password: Salasana
encoding: utf8
host: localhost

View File

@ -1,31 +1,25 @@
set :application, 'my_app_name'
set :repo_url, 'git@example.com:me/my_repo.git'
# config valid only for current version of Capistrano
lock '3.4.1'
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :application, 'webdev'
set :repo_url, 'git@github.com:web-dev-camp/web_dev_site.git'
# set :deploy_to, '/var/www/my_app'
# set :scm, :git
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/var/www/vhosts/webdev.camp'
# set :format, :pretty
# set :log_level, :debug
# set :pty, true
# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# set :linked_files, %w{config/database.yml}
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('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" }
# set :keep_releases, 5
set :use_sudo, false
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 :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
@ -35,6 +29,4 @@ namespace :deploy do
end
end
after :finishing, 'deploy:cleanup'
end

View File

@ -1,42 +1,10 @@
set :stage, :production
# 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.
role :app, %w{deploy@example.com}
role :web, %w{deploy@example.com}
role :db, %w{deploy@example.com}
# Extended Server Syntax
# server-based syntax
# ======================
# This can be used to drop a more detailed server
# definition into the server list. The second argument
# something that quacks like a hash can be used to set
# extended properties on the server.
server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:
# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
# set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
# and/or per server
# 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'
# }
# setting per server overrides global ssh_options
server 'webdev.camp', user: 'webdev', roles: %w{app db web}
# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value
# server 'db.example.com', user: 'deploy', roles: %w{db}
# fetch(:default_env).merge!(rails_env: :production)
set :passenger_restart_with_touch, true

View File

@ -1,42 +0,0 @@
set :stage, :staging
# 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.
role :app, %w{deploy@example.com}
role :web, %w{deploy@example.com}
role :db, %w{deploy@example.com}
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server
# definition into the server list. The second argument
# something that quacks like a hash can be used to set
# extended properties on the server.
server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
# set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
# and/or per server
# 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'
# }
# setting per server overrides global ssh_options
# fetch(:default_env).merge!(rails_env: :staging)

View File

@ -18,14 +18,5 @@ development:
secret_key_base: 6fbc7972b587359c086a6c6738dca91a5cd53f635bdfba31c7b23721a27e1d89bf8c490dfc3ebe773bcdb98d2add0946ea924321bad66499b893d88fc827b883
test:
domain_name: example.com
domain_name: example.com
secret_key_base: a0a18747d0172bfadf4187e6c01be490f452539aeaa4d74bada88ef851d7a2dfabcde91552d3689e9eb71caf9062e5d8b28fbeb55c6f429d92d462655c25d60c
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
admin_name: <%= ENV["ADMIN_NAME"] %>
admin_email: <%= ENV["ADMIN_EMAIL"] %>
admin_password: <%= ENV["ADMIN_PASSWORD"] %>
domain_name: <%= ENV["DOMAIN_NAME"] %>
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>