setting up capistrano

This commit is contained in:
Helge Rausch
2013-08-25 10:22:15 +02:00
parent 94d2e5082c
commit 5cf8facace
11 changed files with 41 additions and 11 deletions

1
.gitignore vendored
View File

@@ -25,3 +25,4 @@ secret_token
config/app_config.yml
config/newrelic.yml
tmp/
.vagrant

View File

@@ -11,6 +11,7 @@ gem 'rvm-capistrano'
gem 'sanitize'
gem "recaptcha", :require => "recaptcha/rails"
gem 'dynamic_form'
gem 'unicorn'
# apis
gem 'fitgem'

View File

@@ -111,6 +111,7 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
kgio (2.8.0)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
@@ -168,6 +169,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
raindrops (0.11.0)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
@@ -224,6 +226,10 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
unicorn (4.6.2)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
vegas (0.1.11)
rack (>= 1.0.0)
will_paginate (3.0.4)
@@ -269,5 +275,6 @@ DEPENDENCIES
sunspot_rails
sunspot_solr
sunspot_test!
unicorn
vegas
will_paginate

2
Vagrantfile vendored
View File

@@ -29,7 +29,7 @@ Vagrant::Config.run do |config|
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
config.vm.forward_port 3000, 4000
config.vm.forward_port 80, 9000
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the

View File

@@ -1,4 +1,2 @@
require ::File.expand_path('../config/environment', __FILE__)
run Rack::URLMap.new \
"/" => Snpr::Application
run Snpr::Application

View File

@@ -18,4 +18,8 @@ set :rvm_type, :system
after 'deploy:restart', 'unicorn:reload'
after 'deploy:restart', 'unicorn:restart'
load 'lib/capistrano/tasks/helpers'
load 'lib/capistrano/tasks/base'
after 'deploy:update', 'deploy:migrate'
after 'deploy:create_shared_dirs', 'deploy:assets:precompile'

View File

@@ -1,2 +1,5 @@
server "localhost:2222", :app, :web, :db, :primary => true
set :deploy_to, "/srv/www/#{application}"
set :scm, :none
set :repository, "."
set :deploy_via, :copy

View File

@@ -30,7 +30,7 @@ Snpr::Application.configure do
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
#config.serve_static_assets = false
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

View File

@@ -1,17 +1,14 @@
# ------------------------------------------------------------------------------
# Sample rails 3 config
# ------------------------------------------------------------------------------
# Set your full path to application.
app_path = "/srv/www/snpr"
app_path = "/srv/www/snpr/current"
# Set unicorn options
worker_processes 5
preload_app true
timeout 180
#listen "/tmp/snpr_unicorn.sock", :backlog => 64
listen "127.0.0.1:9000"
# Spawn unicorn master worker for user apps (group: apps)
# Spawn unicorn master worker for user snpr (group: snpr)
user 'snpr', 'snpr'
# Fill path to your app

View File

@@ -0,0 +1,12 @@
namespace :deploy do
task :set_symlinks do
ln("#{shared_path}/config/app_config.yml", "#{release_path}/config/app_config.yml")
ln("#{shared_path}/config/database.yml", "#{release_path}/config/database.yml")
end
after "deploy:create_shared_dirs", "deploy:set_symlinks"
task :create_shared_dirs do
mkdir("#{shared_path}/config")
end
after "deploy:update", "deploy:create_shared_dirs"
end

View File

@@ -0,0 +1,7 @@
def ln(src, dst)
run("ln -snf '#{src}' '#{dst}'")
end
def mkdir(path)
run("[ -d '#{path}' ] || mkdir -p '#{path}'")
end