diff --git a/.gitignore b/.gitignore index a812f1ce3..f2e8c948b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,8 +27,6 @@ /config/initializers/devise.rb /config/facebook.yml /.idea/ -/config/deploy.rb -/Capfile /config/newrelic.yml @@ -37,7 +35,6 @@ .ruby-version .ruby-env -/config/database.yml /config/puma.rb # Ignore 1337 secrets diff --git a/Capfile b/Capfile new file mode 100644 index 000000000..a204fd415 --- /dev/null +++ b/Capfile @@ -0,0 +1,26 @@ +# Load DSL and Setup Up Stages +require 'capistrano/setup' + +# Includes default deployment tasks +require 'capistrano/deploy' + +# Include bundler related tasks +require 'capistrano/bundler' + +# 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/rails/assets' +require 'capistrano/rails/migrations' +require 'capistrano/puma' + +# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. +Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index b36d983ee..1511234f6 100644 --- a/Gemfile +++ b/Gemfile @@ -110,8 +110,12 @@ gem 'rollbar' # Use unicorn as the app server # gem 'unicorn' -#Deploy with Capistrano +# Deploy with Capistrano gem 'capistrano' +gem 'capistrano-bundler' +gem 'capistrano-rvm' +gem 'capistrano-rails' +gem 'capistrano3-puma' # To use debugger # gem 'debugger' diff --git a/Gemfile.lock b/Gemfile.lock index 8c3069ee9..cccf5282d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,6 +100,18 @@ GEM i18n rake (>= 10.0.0) sshkit (~> 1.3) + capistrano-bundler (1.1.3) + capistrano (~> 3.1) + sshkit (~> 1.2) + capistrano-rails (1.1.3) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) + capistrano-rvm (0.1.2) + capistrano (~> 3.0) + sshkit (~> 1.2) + capistrano3-puma (0.9.0) + capistrano (~> 3.0) + puma (>= 2.6) capybara (2.4.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -450,6 +462,10 @@ DEPENDENCIES bootstrap-wysihtml5-rails! cancancan (~> 1.8) capistrano + capistrano-bundler + capistrano-rails + capistrano-rvm + capistrano3-puma capybara clockwork cocoon diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 000000000..9136bbf7a --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,14 @@ +lock '3.2.1' + +#set :deploy_to, "~/coursemology_deploy" +set :application, 'coursemology' + +set :repo_url, 'git@github.com:coursemology/coursemology.org.git' +set :branch, 'development' +set :deploy_via, :remote_cache + +set :linked_dirs, ['log', 'tmp/cache', 'tmp/sockets', 'tmp/pids'] + +namespace :deploy do + after :finished, 'puma:restart' +end diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 000000000..9784ea412 --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,6 @@ +user = 'raymoond' +hostname = 'coursemology.org' + +server hostname, user: user, roles: %w{web app db}, primary: true + +set :rails_env, 'production'