Commit 0648fa48
Changed files (13)
config
recipes
templates
monit
lib
script
config/recipes/templates/monit/delayed_job.erb
@@ -1,4 +1,3 @@
check process delayed_job with pidfile <%= delayed_job_pid %>
start program = "/etc/init.d/delayed_job_<%= application %> start"
stop program = "/etc/init.d/delayed_job_<%= application %> stop"
- if uptime > 3 minutes then restart
config/recipes/environments.rb
@@ -1,4 +1,3 @@
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
-#require 'capistrano/gitflow'
config/database.production.yml.example
@@ -1,25 +0,0 @@
-staging:
- #adapter: postgresql
- #encoding: unicode
- #host: localhost
- #database: cakeside_production
- #pool: 5
- #username: cakeside
- #password: password
- adapter: postgresql
- encoding: unicode
- pool: 5
- database: d1t8g3ceb67l55
- username: padomwgzfzlkyp
- password: HhEs5xtpF34dwRMTDSA2CWRGnu
- host: ec2-23-21-130-189.compute-1.amazonaws.com
- port: 5432
-
-production:
- adapter: postgresql
- encoding: unicode
- host: localhost
- database: cakeside_production
- pool: 5
- username: cakeside
- password: password
config/nginx.conf
@@ -1,80 +0,0 @@
-worker_processes 4;
-
-events {
- worker_connections 1024;
-}
-
-http {
- passenger_root /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.5;
- passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby;
-
- include mime.types;
- default_type application/octet-stream;
-
- client_body_buffer_size 8K;
- client_header_buffer_size 1k;
- client_max_body_size 10M;
-
- sendfile on;
-
- client_body_timeout 10;
- client_header_timeout 10;
- keepalive_timeout 15;
- send_timeout 10;
-
- gzip on;
- gzip_comp_level 2;
- gzip_min_length 1000;
- gzip_proxied expired no-cache no-store private auth;
- gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
- gzip_disable "MSIE [1-6]\.";
-
- server {
- listen 80;
- server_name localhost;
-
- location / {
- root html;
- index index.html index.htm;
- }
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
- server {
- listen 80;
- server_name staging.cakeside.com;
- root /home/cakeside/apps/www.cakeside.com/current/public;
- passenger_enabled on;
- rails_env staging;
- error_log /var/log/nginx/cakeside.error.log;
- access_log off;
-
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
-
- server {
- listen 443;
- ssl on;
- ssl_certificate /home/cakeside/apps/www.cakeside.com/current/config/staging.crt;
- ssl_certificate_key /home/cakeside/apps/www.cakeside.com/current/config/staging.key;
- server_name staging.cakeside.com;
- root /home/cakeside/apps/www.cakeside.com/current/public;
- passenger_enabled on;
- rails_env staging;
- error_log /var/log/nginx/cakeside.error.log;
- access_log off;
-
- proxy_set_header X_FORWARDED_PROTO https;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- proxy_set_header X-Url-Scheme $scheme;
- proxy_redirect off;
- proxy_max_temp_file_size 0;
- }
-}
config/setup_load_paths.rb
@@ -1,14 +0,0 @@
-#if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
- #begin
- #gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
- #ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
- #require 'rvm'
- #RVM.use_from_path! File.dirname(File.dirname(__FILE__))
- #rescue LoadError
- #raise "RVM gem is currently unavailable."
- #end
-#end
-
-## If you're not using Bundler at all, remove lines bellow
-#ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
-#require 'bundler/setup'
lib/tasks/ci.rake
@@ -2,12 +2,7 @@ task :ci => ['db:migrate', 'db:test:prepare', 'spec', 'teaspoon']
namespace :ci do
namespace :deploy do
- task :staging do
- now = Time.now
- sh "git tag -a 'staging-#{now.strftime('%Y-%m-%d')}-#{now.to_i}-jenkins-continuous-deployment' -m 'just push it'"
- sh "git push --tags"
- Rake::Task['deploy:staging'].invoke
- end
+ task :staging => ['deploy:staging']
task :production => ['deploy:production']
end
end
lib/tasks/database.rake
@@ -7,10 +7,12 @@ namespace :db do
sh "psql #{destination_db} < #{dumpfile}"
#sh "pg_restore --verbose --clean --no-acl --no-owner -h localhost -U #{config[Rails.env]["username"]} -d #{destination_db} #{dumpfile}"
end
+
task :backup do
sh "cap production postgresql:backup"
sh "rm -f latest && ln -s db/backups/`ls -rt db/backups/ | tail -n1` latest"
end
+
task :restore_to_staging => :backup do
sh "cap staging postgresql:restore"
end
lib/tasks/deployment.rake
@@ -1,21 +1,14 @@
namespace :deploy do
-
desc "deploy to staging server"
task :staging do
sh "cap staging deploy:migrations"
- sh "cap staging deploy:cleanup"
sh "curl http://staging.cakeside.com/ > /dev/null"
end
desc "deploy to production server"
- task :production, :tag do |t, args|
- tag_to_deploy = args.tag
- if tag_to_deploy.blank?
- sh "cap production deploy:migrations"
- else
- sh "cap production deploy:migrations -s tag=#{tag_to_deploy}"
- end
- sh "curl http://cakeside.com/ > /dev/null"
+ task :production do
+ sh "cap production deploy:migrations"
+ sh "curl http://www.cakeside.com/ > /dev/null"
end
end
script/test
@@ -1,35 +0,0 @@
-#!/bin/bash
-#
-# From Destroy All Software screencast #10, at:
-# http://destroyallsoftware.com/screencasts/catalog/fast-tests-with-and-without-rails
-#
-# Put this in the script/ directory of your Rails app, then run it with a spec
-# filename. If the spec uses spec_helper, it'll be run inside Bundler.
-# Otherwise, it'll be run directly with whatever `rspec` executable is on the
-# path.
-
-set -e
-
-need_rails=1
-
-if [ $# -gt 0 ]; then # we have args
- filename=$1
- # Remove trailing line numbers from filename, e.g. spec/my_spec.rb:33
- grep_filename=`echo $1 | sed 's/:.*$//g'`
-
- (set +e; grep -r '\bspec_helper\b' $grep_filename) > /dev/null
- if [ $? -eq 1 ]; then # no match; we have a stand-alone spec
- need_rails=''
- fi
-else # we have no args
- filename='spec'
-fi
-
-command='rspec'
-
-if [ $need_rails ]; then
- command="ruby -S bundle exec $command"
-fi
-
-RAILS_ENV=test $command $filename
-
Gemfile
@@ -33,7 +33,6 @@ group :development do
gem 'capistrano'
gem 'capistrano-ext'
gem 'rvm-capistrano'
- gem 'capistrano-gitflow'
gem 'bullet'
gem 'better_errors'
gem 'lol_dba'
Gemfile.lock
@@ -53,9 +53,6 @@ GEM
net-ssh-gateway (>= 1.1.0)
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
- capistrano-gitflow (1.4.3)
- capistrano
- stringex
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@@ -245,7 +242,6 @@ GEM
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.7)
- stringex (2.0.6)
teaspoon (0.7.4)
phantomjs (>= 1.8.1.1)
railties (>= 3.2.5, < 5)
@@ -283,7 +279,6 @@ DEPENDENCIES
bullet
capistrano
capistrano-ext
- capistrano-gitflow
capybara
carrierwave
carrierwave_backgrounder
Rakefile
@@ -2,7 +2,6 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
-#require 'rake'
require 'dotenv/tasks'
Cake::Application.load_tasks
README.md
@@ -43,4 +43,3 @@ Start server
$ cap deploy:update
{% endhighlight %}
-