From b2b05246d14bb26762e6f3f9aa589ccdfd6c418f Mon Sep 17 00:00:00 2001 From: Ye Min Date: Wed, 27 Dec 2017 13:11:05 +0630 Subject: [PATCH] Cap setup --- Gemfile | 14 +++++++++----- Gemfile.lock | 38 ++++++++++++++++++++++++++++++++++--- config/deploy.rb | 20 +++++++++++++++++++ config/deploy/production.rb | 9 +++++++++ 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 config/deploy.rb create mode 100644 config/deploy/production.rb diff --git a/Gemfile b/Gemfile index 1432e3af..de22a68c 100755 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' - +ruby '2.4.0' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" @@ -89,10 +89,10 @@ gem 'cancancan', '~> 1.10' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development -group :development, :test do +#group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug', platform: :mri -end +# gem 'byebug', platform: :mri +#end group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. @@ -103,6 +103,10 @@ group :development do gem 'spring-watcher-listen', '~> 2.0.0' gem 'rspec-rails', '~> 3.5' gem 'schema_to_scaffold' + gem 'capistrano' + gem 'capistrano-bundler' + gem 'capistrano-rails' + gem 'capistrano-rbenv', github: "capistrano/rbenv" end group :test do @@ -122,4 +126,4 @@ gem 'momentjs-rails' # for date-range selector # gem 'bootstrap-datepicker-rails' # date picker # gem 'jquery-datetimepicker-rails' # gem 'select2-rails' # for multi-select and auto-complete select box -gem "chartkick" #chart lib \ No newline at end of file +gem "chartkick" #chart lib diff --git a/Gemfile.lock b/Gemfile.lock index d29f4058..b7804803 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: https://github.com/capistrano/rbenv.git + revision: c029e4128e4a8f25adda35795f5729bd4f62e51f + specs: + capistrano-rbenv (2.1.3) + capistrano (~> 3.1) + sshkit (~> 1.3) + GEM remote: https://rubygems.org/ specs: @@ -39,12 +47,24 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) aescrypt (1.0.0) + airbrussh (1.3.0) + sshkit (>= 1.6.1, != 1.7.0) arel (8.0.0) bcrypt (3.1.11) bindex (0.5.0) builder (3.2.3) - byebug (9.1.0) cancancan (1.17.0) + capistrano (3.10.1) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (1.3.0) + capistrano (~> 3.1) + sshkit (~> 1.2) + capistrano-rails (1.3.1) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) carrierwave (1.2.1) activemodel (>= 4.0.0) activesupport (>= 4.0.0) @@ -128,6 +148,9 @@ GEM multi_xml (0.6.0) mysql2 (0.4.9) nested_form (0.3.2) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (4.2.0) nio4r (2.1.0) nokogiri (1.8.1) mini_portile2 (~> 2.3.0) @@ -228,6 +251,9 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + sshkit (1.15.1) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) tether-rails (1.4.0) rails (>= 3.1) thor (0.20.0) @@ -260,8 +286,11 @@ PLATFORMS DEPENDENCIES aescrypt bcrypt (~> 3.1.7) - byebug cancancan (~> 1.10) + capistrano + capistrano-bundler + capistrano-rails + capistrano-rbenv! carrierwave (~> 1.0) chartkick coffee-rails (~> 4.2) @@ -306,5 +335,8 @@ DEPENDENCIES web-console (>= 3.3.0) whenever +RUBY VERSION + ruby 2.4.0p0 + BUNDLED WITH - 1.16.0 + 1.16.1 diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 00000000..a2144cd1 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,20 @@ +lock "3.10.1" + +set :application, "sxrestaurant" +set :repo_url, 'git@bitbucket.org:code2lab/sxrestaurant.git' + +set :deploy_user, 'deploy' + +set :rbenv_type, :global +set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" + +set :rbenv_map_bins, %w{rake gem bundle ruby rails} + +set :keep_releases, 5 + +set :linked_files, %w{config/database.yml config/secrets.yml config/puma.rb config/sidekiq.yml} + +set :linked_dirs, %w{bin log tmp/puma tmp/pids tmp/cache tmp/sockets vendor/bundle public/system pids sockets} + +set :tests, [] +set :pty, true diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 00000000..9a498da8 --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,9 @@ +set :stage, :production +set :server_name, "svr.sxrestaurant.host" + +set :full_app_name, "#{fetch(:application)}_#{fetch(:stage)}" +server '192.168.1.27', user: 'deploy', roles: %w{web app db}, primary: true + +set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}" +set :rbenv_ruby, '2.4.0' +set :rails_env, :production