From 1fe36aae29db5c8603fef892525c18759677f4d9 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 20 Apr 2023 15:16:16 +0530 Subject: [PATCH 01/50] capistrano commit --- Capfile | 38 ++++++++++++++++++++ Gemfile | 7 ++++ Gemfile.lock | 24 +++++++++++++ config/deploy.rb | 39 ++++++++++++++++++++ config/deploy/production.rb | 61 +++++++++++++++++++++++++++++++ config/deploy/staging.rb | 71 +++++++++++++++++++++++++++++++++++++ 6 files changed, 240 insertions(+) create mode 100644 Capfile create mode 100644 config/deploy.rb create mode 100644 config/deploy/production.rb create mode 100644 config/deploy/staging.rb diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..e3cf40f5 --- /dev/null +++ b/Capfile @@ -0,0 +1,38 @@ +# Load DSL and set up stages +require "capistrano/setup" + +# Include default deployment tasks +require "capistrano/deploy" + +# Load the SCM plugin appropriate to your project: +# +# require "capistrano/scm/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +require "capistrano/scm/git" +install_plugin Capistrano::SCM::Git + +# Include 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 +# https://github.com/capistrano/passenger +# +# require "capistrano/rvm" +# require "capistrano/rbenv" +# require "capistrano/chruby" +# require "capistrano/bundler" +# require "capistrano/rails/assets" +# require "capistrano/rails/migrations" +# require "capistrano/passenger" +# require 'capistrano/ssh_doctor' +# Load 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 6c9dd88e..72f013f9 100644 --- a/Gemfile +++ b/Gemfile @@ -183,3 +183,10 @@ group :staging, :production do # Performance gem 'bootscale', require: false end + +group :development do + gem 'capistrano', '~> 3.10', require: false + gem 'capistrano-rails', '~> 1.3', require: false + gem 'ed25519', '~> 1.3' + gem 'bcrypt_pbkdf', '~> 1.1' +end diff --git a/Gemfile.lock b/Gemfile.lock index 5903b228..91bdbd9f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,6 +56,8 @@ GEM activerecord (>= 4.0) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) + airbrussh (1.4.1) + sshkit (>= 1.6.1, != 1.7.0) angular-rails-templates (1.0.2) railties (>= 4.2, < 6) sprockets (>= 3.0, < 5) @@ -81,6 +83,7 @@ GEM ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) bcrypt (3.1.12) + bcrypt_pbkdf (1.1.0) better_errors (2.5.0) coderay (>= 1.0.0) erubi (>= 1.0.0) @@ -97,6 +100,16 @@ GEM breadcrumbs_on_rails (3.0.1) builder (3.2.3) byebug (10.0.2) + capistrano (3.17.2) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (2.1.0) + capistrano (~> 3.1) + capistrano-rails (1.6.2) + capistrano (~> 3.1) + capistrano-bundler (>= 1.1, < 3) capybara (3.13.2) addressable mini_mime (>= 0.1.3) @@ -171,6 +184,7 @@ GEM railties (>= 3.2, < 6.0) down (4.8.0) addressable (~> 2.5) + ed25519 (1.3.0) elasticsearch (5.0.5) elasticsearch-api (= 5.0.5) elasticsearch-transport (= 5.0.5) @@ -376,6 +390,9 @@ GEM mustermann-grape (1.0.0) mustermann (~> 1.0.0) nenv (0.3.0) + net-scp (4.0.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-ssh (6.1.0) ng-rails-csrf (0.1.0) ngannotate-rails (1.2.2) execjs @@ -577,6 +594,9 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + sshkit (1.21.4) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) temple (0.8.0) thor (0.19.4) thread_safe (0.3.6) @@ -619,6 +639,7 @@ DEPENDENCIES awesome_nested_set! aws-sdk (~> 2.9) bcrypt (~> 3.1.11) + bcrypt_pbkdf (~> 1.1) better_errors binding_of_caller bootscale @@ -627,6 +648,8 @@ DEPENDENCIES bower-rails (~> 0.11.0) breadcrumbs_on_rails (~> 3.0.1) byebug + capistrano (~> 3.10) + capistrano-rails (~> 1.3) capybara cells (~> 4.1.6) cells-haml (~> 0.0.10) @@ -640,6 +663,7 @@ DEPENDENCIES dialog-polyfill-rails (~> 0.4.5) doorkeeper (~> 4.2) dotenv-rails + ed25519 (~> 1.3) elasticsearch-extensions (~> 0.0.26) elasticsearch-model (~> 5.0) elasticsearch-rails (~> 5.0) diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 00000000..e76cd1fa --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,39 @@ +# config valid for current version and patch releases of Capistrano +lock '~> 3.17.2' + +set :application, 'cortex' +set :repo_url, 'https://github.com/cortex-cms/cortex.git' + +# Default branch is :master +# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp + +# Default deploy_to directory is /var/www/my_app_name +# set :deploy_to, "/var/www/my_app_name" + +# Default value for :format is :airbrussh. +# set :format, :airbrussh + +# You can configure the Airbrussh format using :format_options. +# These are the defaults. +# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto + +# Default value for :pty is false +# set :pty, true + +# Default value for :linked_files is [] +# append :linked_files, "config/database.yml", 'config/master.key' + +# Default value for linked_dirs is [] +# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage" + +# Default value for default_env is {} +# set :default_env, { path: "/opt/ruby/bin:$PATH" } + +# Default value for local_user is ENV['USER'] +# set :local_user, -> { `git config user.name`.chomp } + +# Default value for keep_releases is 5 +set :keep_releases, 5 + +# Uncomment the following to require manually verifying the host key before first deploy. +set :ssh_options, verify_host_key: :secure diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 00000000..0a3f0863 --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,61 @@ +# server-based syntax +# ====================== +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value +# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value +# server "db.example.com", user: "deploy", roles: %w{db} + + + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. + +# role :app, %w{deploy@example.com}, my_property: :my_value +# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value +# role :db, %w{deploy@example.com} + + + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. + + + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start +# +# Global options +# -------------- +# set :ssh_options, { +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# 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" +# } diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb new file mode 100644 index 00000000..d3aacdb8 --- /dev/null +++ b/config/deploy/staging.rb @@ -0,0 +1,71 @@ +# server-based syntax +# ====================== +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value +# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value +# server "db.example.com", user: "deploy", roles: %w{db} + +# set :branch, 'legacy-develop' +set :branch, 'RDP-30318-ec2-downsize' +set :deploy_to, "/var/www/#{fetch :application}" +server ENV.fetch('STAGING_IP'), + user: 'ubuntu', + roles: %w{app db web}, + ssh_options: { + keys: %w(/Users/sausharma/Keys/cortex-stage-saurabh.pem), + forward_agent: false, + auth_methods: %w(publickey) + } + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. + +# role :app, %w{deploy@example.com}, my_property: :my_value +# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value +# role :db, %w{deploy@example.com} + + + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. + + + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start +# +# Global options +# -------------- +# set :ssh_options, { +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# 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" +# } From 32e1608ceb632dd2a0f92d691f49739e3715c8f5 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 20 Apr 2023 15:23:29 +0530 Subject: [PATCH 02/50] mimemagic version update --- Gemfile | 1 + Gemfile.lock | 5 ++++- config/deploy/staging.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 72f013f9..e0bc2170 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,7 @@ gem 'rack-cors', '~> 0.4.1', require: 'rack/cors' gem 'excon', '~> 0.55.0' gem 'hashie', '~> 3.5.5' gem 'hashr', '~> 2.0.1' +gem 'mimemagic', '~> 0.3.9' gem 'mime-types', '~> 3.1.0' gem 'interactor-rails', '~> 2.0' gem 'virtus', '~> 1.0.5' diff --git a/Gemfile.lock b/Gemfile.lock index 91bdbd9f..b97af2e8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -374,7 +374,9 @@ GEM mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2018.0812) - mimemagic (0.3.3) + mimemagic (0.3.10) + nokogiri (~> 1) + rake mini_magick (4.9.2) mini_mime (1.0.1) mini_portile2 (2.4.0) @@ -701,6 +703,7 @@ DEPENDENCIES kaminari (~> 0.17.0) material_design_lite-sass (~> 1.3.0) mime-types (~> 3.1.0) + mimemagic (~> 0.3.9) mini_racer mocha (~> 1.2) ng-rails-csrf (~> 0.1.0) diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index d3aacdb8..73486a1f 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -10,7 +10,7 @@ # set :branch, 'legacy-develop' set :branch, 'RDP-30318-ec2-downsize' set :deploy_to, "/var/www/#{fetch :application}" -server ENV.fetch('STAGING_IP'), +server '52.207.238.7', user: 'ubuntu', roles: %w{app db web}, ssh_options: { From 53c0204fbe0ccae94a90095b39812e79139a150b Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 20 Apr 2023 16:00:26 +0530 Subject: [PATCH 03/50] dotenv gem --- Gemfile | 3 +++ Gemfile.lock | 1 + 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index e0bc2170..9be98fd2 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,9 @@ gem 'puma', '~> 3.8.2' # Rails gem 'rails', '~> 5.0.2' +# Environment variable autoload from .env +gem 'dotenv', '~> 2.6', '>= 2.6.0' + # Cortex-specific gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' diff --git a/Gemfile.lock b/Gemfile.lock index b97af2e8..670ec4d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -664,6 +664,7 @@ DEPENDENCIES devise (~> 4.2.1) dialog-polyfill-rails (~> 0.4.5) doorkeeper (~> 4.2) + dotenv (~> 2.6, >= 2.6.0) dotenv-rails ed25519 (~> 1.3) elasticsearch-extensions (~> 0.0.26) From afced42f08d83bd355faff95c886e13fb636a3e9 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 20 Apr 2023 17:44:48 +0530 Subject: [PATCH 04/50] deploy changes + env init --- config/deploy.rb | 21 ++++++++++++++++++++- config/deploy/staging.rb | 1 - config/initializers/dotenv.rb | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 config/initializers/dotenv.rb diff --git a/config/deploy.rb b/config/deploy.rb index e76cd1fa..29c2b814 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -3,7 +3,9 @@ set :application, 'cortex' set :repo_url, 'https://github.com/cortex-cms/cortex.git' - +set :deploy_to, "/var/www/#{fetch :application}" +set :s3_path_stage, 's3://cortex-env/Stage/.env' +set :s3_path_prod, '' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -37,3 +39,20 @@ # Uncomment the following to require manually verifying the host key before first deploy. set :ssh_options, verify_host_key: :secure + +namespace :remote do + desc "Download env from S3" + task :env_download do + on roles(:all) do |host| + execute "aws s3 cp #{fetch :s3_path_stage} #{fetch :deploy_to}/current/.env" + end + end + + desc 'Terminate existing puma and sidekiq processes' + task :terminate_puma_sidekiq do + on roles(:all) do |host| + execute 'sudo killall puma' + execute 'sudo killall sidekiq' + end + end +end diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 73486a1f..dac68188 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -9,7 +9,6 @@ # set :branch, 'legacy-develop' set :branch, 'RDP-30318-ec2-downsize' -set :deploy_to, "/var/www/#{fetch :application}" server '52.207.238.7', user: 'ubuntu', roles: %w{app db web}, diff --git a/config/initializers/dotenv.rb b/config/initializers/dotenv.rb new file mode 100644 index 00000000..630f4bbb --- /dev/null +++ b/config/initializers/dotenv.rb @@ -0,0 +1 @@ +Dotenv.load Rails.root.join('.env') \ No newline at end of file From 495265edb56c24eb22cb8d911ac7147d7c611817 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 20 Apr 2023 17:50:31 +0530 Subject: [PATCH 05/50] removed tmp dir --- Gemfile | 10 +++++----- config/deploy.rb | 3 +++ config/secrets.yml | 3 +++ tmp/.keep | 0 4 files changed, 11 insertions(+), 5 deletions(-) delete mode 100644 tmp/.keep diff --git a/Gemfile b/Gemfile index 9be98fd2..6d10edd4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' ruby '2.4.5' - +gem 'dotenv', '~> 2.6', '>= 2.6.0' +gem 'dotenv-rails' # Dependency Management gem 'bower-rails', '~> 0.11.0' @@ -10,9 +11,6 @@ gem 'puma', '~> 3.8.2' # Rails gem 'rails', '~> 5.0.2' -# Environment variable autoload from .env -gem 'dotenv', '~> 2.6', '>= 2.6.0' - # Cortex-specific gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' @@ -120,7 +118,7 @@ end group :test, :development do # Environment - gem 'dotenv-rails', :require => 'dotenv/rails-now' + # gem 'dotenv-rails', :require => 'dotenv/rails-now' gem 'foreman' # Cache/Sidekiq @@ -193,4 +191,6 @@ group :development do gem 'capistrano-rails', '~> 1.3', require: false gem 'ed25519', '~> 1.3' gem 'bcrypt_pbkdf', '~> 1.1' + # Environment variable autoload from .env + # gem 'dotenv', '~> 2.6', '>= 2.6.0' end diff --git a/config/deploy.rb b/config/deploy.rb index 29c2b814..76f5ab37 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -6,6 +6,9 @@ set :deploy_to, "/var/www/#{fetch :application}" set :s3_path_stage, 's3://cortex-env/Stage/.env' set :s3_path_prod, '' + +after 'deploy', 'remote:env_download' +after 'deploy', 'remote:terminate_puma_sidekiq' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp diff --git a/config/secrets.yml b/config/secrets.yml index a06374a9..c3807b32 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -13,6 +13,9 @@ development: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> +staging: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> + test: secret_key_base: b32cc035d1b68446fcacf8b7106e92dcfaf538a07865e61b795f912cfa6c9a6e2c87f7f6cc5924b5ea3793c3baad82284a91418ed2e4db0e263c616304cab463 diff --git a/tmp/.keep b/tmp/.keep deleted file mode 100644 index e69de29b..00000000 From 5f9fc7f93733e8a903118362faecbcb517daa07c Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 20 Apr 2023 17:55:24 +0530 Subject: [PATCH 06/50] deploy linked dirs --- config/deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 76f5ab37..028c31dc 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :s3_path_prod, '' after 'deploy', 'remote:env_download' -after 'deploy', 'remote:terminate_puma_sidekiq' +# after 'deploy', 'remote:terminate_puma_sidekiq' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -30,6 +30,7 @@ # Default value for linked_dirs is [] # append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage" +append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/assets' # Default value for default_env is {} # set :default_env, { path: "/opt/ruby/bin:$PATH" } From 268f37aefaad32e66876fb1164aba8ae84f10196 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 21 Apr 2023 13:09:06 +0530 Subject: [PATCH 07/50] added asset directory --- config/application.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/application.rb b/config/application.rb index 2587cfa2..c2986adc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,6 +17,7 @@ class Application < Rails::Application config.active_job.queue_adapter = :sidekiq config.assets.image_optim = false config.assets.paths << Rails.root.join('vendor', 'assets', 'bower_components') + config.assets.paths << Rails.root.join('bower_components') ActsAsTaggableOn.remove_unused_tags = true ActsAsTaggableOn.force_lowercase = true From 2da993613b65080a10d123f704dd00eb59b32f87 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 21 Apr 2023 13:09:22 +0530 Subject: [PATCH 08/50] added application setup commands --- config/deploy.rb | 17 +++++++++++++++-- config/deploy/staging.rb | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 028c31dc..ef41c8d4 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,6 +8,7 @@ set :s3_path_prod, '' after 'deploy', 'remote:env_download' +after 'deploy', 'application_setup' # after 'deploy', 'remote:terminate_puma_sidekiq' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -30,7 +31,7 @@ # Default value for linked_dirs is [] # append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage" -append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/assets' +append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/assets', 'vendor', 'bower_components' # Default value for default_env is {} # set :default_env, { path: "/opt/ruby/bin:$PATH" } @@ -45,13 +46,25 @@ set :ssh_options, verify_host_key: :secure namespace :remote do - desc "Download env from S3" + desc 'Download env from S3' task :env_download do on roles(:all) do |host| execute "aws s3 cp #{fetch :s3_path_stage} #{fetch :deploy_to}/current/.env" end end + desc 'Application setup' + task :application_setup do + on roles(:all) do |host| + execute 'rvm use 2.4.5' + execute 'bundle install' + execute 'npm install' + execute "#{fetch :deploy_to}/current/node_modules/.bin/bower install angular-mocks" + execute 'bundle exec rake assets:clean react_on_rails:assets:clobber cortex:assets:webpack:compile' + execute 'bundle exec rake assets:precompile' + end + end + desc 'Terminate existing puma and sidekiq processes' task :terminate_puma_sidekiq do on roles(:all) do |host| diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index dac68188..f91a31b5 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -9,7 +9,7 @@ # set :branch, 'legacy-develop' set :branch, 'RDP-30318-ec2-downsize' -server '52.207.238.7', +server '54.197.43.128', user: 'ubuntu', roles: %w{app db web}, ssh_options: { From db2797d4e6c81227a7b65f874a59ed2dc4734dc1 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 21 Apr 2023 14:10:54 +0530 Subject: [PATCH 09/50] added capistrano rvm --- Capfile | 3 + Gemfile | 1 + Gemfile.lock | 420 +++++++++++++++++++++------------------ config/deploy.rb | 8 +- config/deploy/staging.rb | 2 +- 5 files changed, 233 insertions(+), 201 deletions(-) diff --git a/Capfile b/Capfile index e3cf40f5..6384b905 100644 --- a/Capfile +++ b/Capfile @@ -15,6 +15,9 @@ require "capistrano/deploy" require "capistrano/scm/git" install_plugin Capistrano::SCM::Git +# Load the RVM plugin +require 'rvm1/capistrano3' + # Include tasks from other gems included in your Gemfile # # For documentation on these, see for example: diff --git a/Gemfile b/Gemfile index 6d10edd4..6ac7cf7a 100644 --- a/Gemfile +++ b/Gemfile @@ -191,6 +191,7 @@ group :development do gem 'capistrano-rails', '~> 1.3', require: false gem 'ed25519', '~> 1.3' gem 'bcrypt_pbkdf', '~> 1.1' + gem 'rvm1-capistrano3', require: false # Environment variable autoload from .env # gem 'dotenv', '~> 2.6', '>= 2.6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 670ec4d4..e638ce03 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,39 +15,39 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.0.7.1) - actionpack (= 5.0.7.1) + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.7.1) - actionpack (= 5.0.7.1) - actionview (= 5.0.7.1) - activejob (= 5.0.7.1) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.7.1) - actionview (= 5.0.7.1) - activesupport (= 5.0.7.1) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.7.1) - activesupport (= 5.0.7.1) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.7.1) - activesupport (= 5.0.7.1) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) globalid (>= 0.3.6) - activemodel (5.0.7.1) - activesupport (= 5.0.7.1) - activerecord (5.0.7.1) - activemodel (= 5.0.7.1) - activesupport (= 5.0.7.1) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) arel (~> 7.0) - activesupport (5.0.7.1) + activesupport (5.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -68,23 +68,25 @@ GEM no_proxy_fix (~> 0.1.2, >= 0.1.2) arel (7.1.4) attr_required (1.0.1) - autoprefixer-rails (9.4.6) - execjs - aws-sdk (2.11.212) - aws-sdk-resources (= 2.11.212) - aws-sdk-core (2.11.212) + autoprefixer-rails (10.4.13.0) + execjs (~> 2) + aws-eventstream (1.2.0) + aws-sdk (2.11.632) + aws-sdk-resources (= 2.11.632) + aws-sdk-core (2.11.632) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-resources (2.11.212) - aws-sdk-core (= 2.11.212) - aws-sigv4 (1.0.3) + aws-sdk-resources (2.11.632) + aws-sdk-core (= 2.11.632) + aws-sigv4 (1.5.2) + aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) - bcrypt (3.1.12) + bcrypt (3.1.18) bcrypt_pbkdf (1.1.0) - better_errors (2.5.0) + better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) @@ -98,8 +100,8 @@ GEM thor (~> 0.19) bower-rails (0.11.0) breadcrumbs_on_rails (3.0.1) - builder (3.2.3) - byebug (10.0.2) + builder (3.2.4) + byebug (11.1.3) capistrano (3.17.2) airbrussh (>= 1.0.0) i18n @@ -110,13 +112,13 @@ GEM capistrano-rails (1.6.2) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) - capybara (3.13.2) + capybara (3.32.2) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.2) + regexp_parser (~> 1.5) xpath (~> 3.2) cells (4.1.7) declarative-builder (< 0.2.0) @@ -138,11 +140,11 @@ GEM climate_control (>= 0.0.3, < 1.0) codeclimate-test-reporter (0.6.0) simplecov (>= 0.7.1, < 1.0.0) - coderay (1.1.2) + coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.1.4) - connection_pool (2.2.2) + concurrent-ruby (1.2.2) + connection_pool (2.2.5) content_disposition (1.0.0) cortex-exceptions (0.0.4) cortex-plugins-core (0.12.4) @@ -157,9 +159,9 @@ GEM rails (>= 4) react_on_rails (~> 6) shrine (~> 2.6) - crass (1.0.4) - database_cleaner (1.7.0) - debug_inspector (0.0.3) + crass (1.0.6) + database_cleaner (1.99.0) + debug_inspector (1.1.0) declarative-builder (0.1.0) declarative-option (< 0.2.0) declarative-option (0.1.0) @@ -174,15 +176,15 @@ GEM responders warden (~> 1.2.3) dialog-polyfill-rails (0.4.5.1) - diff-lcs (1.3) - docile (1.3.1) + diff-lcs (1.5.0) + docile (1.3.5) doorkeeper (4.4.3) railties (>= 4.2) - dotenv (2.6.0) - dotenv-rails (2.6.0) - dotenv (= 2.6.0) - railties (>= 3.2, < 6.0) - down (4.8.0) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) + railties (>= 3.2) + down (5.2.2) addressable (~> 2.5) ed25519 (1.3.0) elasticsearch (5.0.5) @@ -190,7 +192,7 @@ GEM elasticsearch-transport (= 5.0.5) elasticsearch-api (5.0.5) multi_json - elasticsearch-extensions (0.0.30) + elasticsearch-extensions (0.0.33) ansi elasticsearch elasticsearch-model (5.1.0) @@ -201,27 +203,48 @@ GEM elasticsearch-transport (5.0.5) faraday multi_json - email_spec (2.2.0) + email_spec (2.2.1) htmlentities (~> 4.3.3) launchy (~> 2.1) mail (~> 2.7) equalizer (0.0.11) - erubi (1.8.0) + erubi (1.12.0) erubis (2.7.0) excon (0.55.0) - execjs (2.7.0) - exifr (1.3.5) + execjs (2.8.1) + exifr (1.3.10) factory_girl (4.9.0) activesupport (>= 3.0.0) factory_girl_rails (4.9.0) factory_girl (~> 4.9.0) railties (>= 3.0.0) - faker (1.9.1) + faker (1.9.6) i18n (>= 0.7) - faraday (0.15.4) - multipart-post (>= 1.2, < 3) - fastimage (2.1.5) - ffi (1.10.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + fastimage (2.2.6) + ffi (1.15.5) flipper (0.10.2) flipper-active_record (0.10.2) activerecord (>= 3.2, < 6) @@ -239,10 +262,9 @@ GEM fog-core (~> 1.27) font-awesome-sass (4.7.0) sass (>= 3.2) - foreman (0.85.0) - thor (~> 0.19.1) - formatador (0.2.5) - fspath (3.1.0) + foreman (0.87.2) + formatador (0.3.0) + fspath (3.1.2) globalid (0.4.2) activesupport (>= 4.2.0) gon (6.1.0) @@ -271,13 +293,13 @@ GEM grape-swagger-entity (0.2.5) grape-entity (>= 0.5.0) grape-swagger (>= 0.20.4) - guard (2.15.0) + guard (2.18.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) - pry (>= 0.9.12) + pry (>= 0.13.0) shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) @@ -293,7 +315,7 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - haml (5.0.4) + haml (5.2.2) temple (>= 0.8.0) tilt hashie (3.5.7) @@ -302,38 +324,38 @@ GEM hashr (2.0.1) htmlentities (4.3.4) httpclient (2.8.3) - i18n (1.5.3) + i18n (1.12.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - image_optim (0.26.3) + image_optim (0.31.3) exifr (~> 1.2, >= 1.2.2) fspath (~> 3.0) - image_size (>= 1.5, < 3) + image_size (>= 1.5, < 4) in_threads (~> 1.3) progress (~> 3.0, >= 3.0.1) image_optim_pack (0.4.0) fspath (>= 2.1, < 4) image_optim (~> 0.19) image_processing (0.11.2) - image_size (2.0.0) - in_threads (1.5.1) - interactor (3.1.1) - interactor-rails (2.2.0) + image_size (3.2.0) + in_threads (1.6.0) + interactor (3.1.2) + interactor-rails (2.2.1) interactor (~> 3.0) - rails (>= 4.2, < 5.3) + rails (>= 4.2) jasmine (2.99.0) jasmine-core (>= 2.99.0, < 3.0.0) phantomjs rack (>= 1.2.1) rake jasmine-core (2.99.2) - jasmine-rails (0.14.8) - jasmine-core (>= 1.3, < 3.0) + jasmine-rails (0.15.0) + jasmine-core (>= 1.3, < 4.0) phantomjs (>= 1.9) railties (>= 3.2.0) sprockets-rails - jmespath (1.4.0) - jquery-rails (4.3.3) + jmespath (1.6.2) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -342,7 +364,7 @@ GEM turbolinks jquery-ui-rails (6.0.1) railties (>= 3.2.16) - json (2.1.0) + json (2.6.3) json_spec (1.1.5) multi_json (~> 1.0) rspec (>= 2.0, < 4.0) @@ -355,42 +377,40 @@ GEM activesupport (>= 3.0.0) launchy (2.4.3) addressable (~> 2.3) - libv8 (6.7.288.46.1) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.2.3) + libv8-node (15.14.0.1) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.20.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.0.13) + lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) material_design_lite-sass (1.3.0.1) autoprefixer-rails (>= 6.5) sass (>= 3.3) - metaclass (0.0.4) - method_source (0.8.2) + method_source (1.0.0) mime-types (3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2018.0812) + mime-types-data (3.2023.0218.1) mimemagic (0.3.10) nokogiri (~> 1) rake - mini_magick (4.9.2) - mini_mime (1.0.1) + mini_magick (4.12.0) + mini_mime (1.1.2) mini_portile2 (2.4.0) - mini_racer (0.2.4) - libv8 (>= 6.3) - minitest (5.11.3) - mocha (1.8.0) - metaclass (~> 0.0.1) - multi_json (1.13.1) + mini_racer (0.4.0) + libv8-node (~> 15.14.0.0) + minitest (5.15.0) + mocha (1.16.1) + multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.0.0) - mustermann (1.0.3) - mustermann-grape (1.0.0) - mustermann (~> 1.0.0) + multipart-post (2.3.0) + mustermann (1.1.2) + ruby2_keywords (~> 0.0.1) + mustermann-grape (1.0.2) + mustermann (>= 1.0.0) nenv (0.3.0) net-scp (4.0.0) net-ssh (>= 2.6.5, < 8.0.0) @@ -399,13 +419,13 @@ GEM ngannotate-rails (1.2.2) execjs rails (>= 3.1) - nio4r (2.3.1) + nio4r (2.5.9) no_proxy_fix (0.1.2) - nokogiri (1.10.1) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) non-stupid-digest-assets (1.0.9) sprockets (>= 2.0) - notiffany (0.1.1) + notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) orm_adapter (0.5.0) @@ -418,8 +438,8 @@ GEM paperclip-optimizer (2.0.0) image_optim (~> 0.19) paperclip (>= 3.4) - paranoia (2.4.1) - activerecord (>= 4.0, < 5.3) + paranoia (2.4.3) + activerecord (>= 4.0, < 6.2) pg (0.20.0) phantomjs (2.1.1.0) poltergeist (1.18.1) @@ -427,26 +447,25 @@ GEM cliver (~> 0.3.1) websocket-driver (>= 0.2.0) pomona (0.7.0) - progress (3.5.0) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry-nav (0.2.4) - pry (>= 0.9.10, < 0.11.0) + progress (3.6.0) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-nav (1.0.0) + pry (>= 0.9.10, < 0.15) pry-rails (0.3.9) pry (>= 0.10.4) pry-remote (0.1.8) pry (~> 0.9) slop (~> 3.0) - pry-stack_explorer (0.4.9.3) - binding_of_caller (>= 0.7) - pry (>= 0.9.11) - public_suffix (3.0.3) + pry-stack_explorer (0.4.12) + binding_of_caller (~> 0.7) + pry (~> 0.13) + public_suffix (3.1.1) puma (3.8.2) pundit (1.1.0) activesupport (>= 3.0.0) - rack (2.0.6) + rack (2.2.6.4) rack-accept (0.4.5) rack (>= 0.4) rack-cors (0.4.1) @@ -456,43 +475,43 @@ GEM httpclient (>= 2.4) multi_json (>= 1.3.6) rack (>= 1.1) - rack-protection (2.0.5) + rack-protection (2.0.8.1) rack rack-test (0.6.3) rack (>= 1.0) - rails (5.0.7.1) - actioncable (= 5.0.7.1) - actionmailer (= 5.0.7.1) - actionpack (= 5.0.7.1) - actionview (= 5.0.7.1) - activejob (= 5.0.7.1) - activemodel (= 5.0.7.1) - activerecord (= 5.0.7.1) - activesupport (= 5.0.7.1) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) bundler (>= 1.3.0) - railties (= 5.0.7.1) + railties (= 5.0.7.2) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-erd (1.5.2) - activerecord (>= 3.2) - activesupport (>= 3.2) + rails-erd (1.7.2) + activerecord (>= 4.2) + activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (5.0.7.1) - actionpack (= 5.0.7.1) - activesupport (= 5.0.7.1) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.2.2) rake - rake (12.3.2) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rake (13.0.6) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) ffi (~> 1.0) react_on_rails (6.5.1) addressable @@ -500,60 +519,65 @@ GEM execjs (~> 2.5) rails (>= 3.2) rainbow (~> 2.1) - redis (4.1.0) - redis-actionpack (5.0.2) - actionpack (>= 4.0, < 6) - redis-rack (>= 1, < 3) + redis (4.8.1) + redis-actionpack (5.3.0) + actionpack (>= 5, < 8) + redis-rack (>= 2.1.0, < 3) redis-store (>= 1.1.0, < 2) - redis-activesupport (5.0.7) - activesupport (>= 3, < 6) + redis-activesupport (5.3.0) + activesupport (>= 3, < 8) redis-store (>= 1.3, < 2) - redis-namespace (1.6.0) - redis (>= 3.0.4) - redis-rack (2.0.5) - rack (>= 1.5, < 3) + redis-namespace (1.10.0) + redis (>= 4) + redis-rack (2.1.4) + rack (>= 2.0.8, < 3) redis-store (>= 1.2, < 2) redis-rails (5.0.2) redis-actionpack (>= 5.0, < 6) redis-activesupport (>= 5.0, < 6) redis-store (>= 1.2, < 2) - redis-store (1.6.0) - redis (>= 2.2, < 5) - regexp_parser (1.3.0) - request_store (1.4.1) + redis-store (1.9.2) + redis (>= 4, < 6) + regexp_parser (1.8.2) + request_store (1.5.1) rack (>= 1.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - rolify (5.2.0) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rexml (3.2.5) + rolify (5.3.0) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.2) + rspec-support (~> 3.9.0) + rspec-rails (3.9.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-sidekiq (3.0.3) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-support (~> 3.9.0) + rspec-sidekiq (3.1.0) rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) - rspec-support (3.8.0) - ruby-graphviz (1.2.4) - ruby_dep (1.5.0) - rubyzip (1.2.2) - sass (3.7.3) + rspec-support (3.9.4) + ruby-graphviz (1.2.5) + rexml + ruby2_keywords (0.0.5) + rubyzip (1.2.4) + rvm1-capistrano3 (1.4.0) + capistrano (~> 3.0) + sshkit (>= 1.2) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -564,30 +588,29 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sentry-raven (2.9.0) - faraday (>= 0.7.6, < 1.0) + sentry-raven (3.1.2) + faraday (>= 1.0) shellany (0.0.1) - shoulda-matchers (3.1.2) + shoulda-matchers (3.1.3) activesupport (>= 4.0.0) - shrine (2.14.0) + shrine (2.19.4) content_disposition (~> 1.0) - down (~> 4.1) + down (>= 4.1, < 6) sidekiq (5.0.5) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (>= 3.3.4, < 5) - simplecov (0.16.1) + simplecov (0.18.5) docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) - sinatra (2.0.5) + simplecov-html (~> 0.11) + simplecov-html (0.12.3) + sinatra (2.0.8.1) mustermann (~> 1.0) rack (~> 2.0) - rack-protection (= 2.0.5) + rack-protection (= 2.0.8.1) tilt (~> 2.0) - six (0.2.1) + six (0.2.2) slop (3.6.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) @@ -599,16 +622,16 @@ GEM sshkit (1.21.4) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - temple (0.8.0) - thor (0.19.4) + temple (0.8.2) + thor (0.20.3) thread_safe (0.3.6) - tilt (2.0.9) - timecop (0.9.1) - transitions (1.2.1) + tilt (2.1.0) + timecop (0.9.6) + transitions (1.3.0) turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.2.0) - tzinfo (1.2.5) + tzinfo (1.2.11) thread_safe (~> 0.1) uber (0.1.0) uglifier (3.2.0) @@ -618,11 +641,11 @@ GEM coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) equalizer (~> 0.0, >= 0.0.9) - warden (1.2.8) - rack (>= 2.0.6) + warden (1.2.9) + rack (>= 2.0.9) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) yt (0.30.1) @@ -736,6 +759,7 @@ DEPENDENCIES rspec-rails (~> 3.5) rspec-sidekiq (~> 3.0) rubyzip (~> 1.2.1) + rvm1-capistrano3 sass-rails (~> 5.0) sentry-raven shoulda-matchers (~> 3.1) @@ -756,4 +780,4 @@ RUBY VERSION ruby 2.4.5p335 BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/config/deploy.rb b/config/deploy.rb index ef41c8d4..34cf727b 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -6,7 +6,12 @@ set :deploy_to, "/var/www/#{fetch :application}" set :s3_path_stage, 's3://cortex-env/Stage/.env' set :s3_path_prod, '' +set :rvm1_ruby_version, "2.4.5" +set :rvm_type, :user +before 'deploy', 'rvm1:install:rvm' +before 'deploy', 'rvm1:install:ruby' +before 'deploy', 'rvm1:install:gems' after 'deploy', 'remote:env_download' after 'deploy', 'application_setup' # after 'deploy', 'remote:terminate_puma_sidekiq' @@ -56,8 +61,7 @@ desc 'Application setup' task :application_setup do on roles(:all) do |host| - execute 'rvm use 2.4.5' - execute 'bundle install' + execute "cd #{fetch :deploy_to}/current/" execute 'npm install' execute "#{fetch :deploy_to}/current/node_modules/.bin/bower install angular-mocks" execute 'bundle exec rake assets:clean react_on_rails:assets:clobber cortex:assets:webpack:compile' diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index f91a31b5..bb5cbd6b 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -9,7 +9,7 @@ # set :branch, 'legacy-develop' set :branch, 'RDP-30318-ec2-downsize' -server '54.197.43.128', +server '54.172.199.120', user: 'ubuntu', roles: %w{app db web}, ssh_options: { From 8014543d2c33cb2a1c9165ec568212ca902335af Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 21 Apr 2023 14:48:33 +0530 Subject: [PATCH 10/50] added bundler to gemfile --- Gemfile | 2 ++ Gemfile.lock | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 6ac7cf7a..8da2d494 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ source 'https://rubygems.org' ruby '2.4.5' +gem 'bundler', '=2.3.26' + gem 'dotenv', '~> 2.6', '>= 2.6.0' gem 'dotenv-rails' # Dependency Management diff --git a/Gemfile.lock b/Gemfile.lock index e638ce03..dc5de0ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -377,7 +377,7 @@ GEM activesupport (>= 3.0.0) launchy (2.4.3) addressable (~> 2.3) - libv8-node (15.14.0.1) + libv8-node (15.14.0.1-x86_64-darwin-18) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -654,7 +654,7 @@ GEM yt-support (0.1.3) PLATFORMS - ruby + x86_64-darwin-18 DEPENDENCIES acts-as-taggable-on (~> 4.0) @@ -672,6 +672,7 @@ DEPENDENCIES bourbon (~> 4.3) bower-rails (~> 0.11.0) breadcrumbs_on_rails (~> 3.0.1) + bundler (= 2.3.26) byebug capistrano (~> 3.10) capistrano-rails (~> 1.3) @@ -780,4 +781,4 @@ RUBY VERSION ruby 2.4.5p335 BUNDLED WITH - 2.1.4 + 2.3.26 From a93ec551ffcf88d7f56decbec055e3cb8ff360cc Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 25 Apr 2023 17:30:23 +0530 Subject: [PATCH 11/50] added bowerrc --- .bowerrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .bowerrc diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 00000000..e7a90cf8 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "./bower_components" +} From 58cc09fcb93cfa89a1699c9f3f43887dd9f7c561 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 25 Apr 2023 17:40:26 +0530 Subject: [PATCH 12/50] deleted bowerrc --- .bowerrc | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .bowerrc diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index e7a90cf8..00000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "./bower_components" -} From 6a17b3f94f27fcd724b3de1d1aeada35918a95b6 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 11:21:24 +0530 Subject: [PATCH 13/50] Capistrano npm plugin --- Capfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Capfile b/Capfile index 6384b905..f1cec3a0 100644 --- a/Capfile +++ b/Capfile @@ -17,6 +17,8 @@ install_plugin Capistrano::SCM::Git # Load the RVM plugin require 'rvm1/capistrano3' +# Load NPM plugin +require 'capistrano/npm' # Include tasks from other gems included in your Gemfile # From 6b6e250e269141e4a5eec1d9f3a6b04a9dfca479 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 11:21:40 +0530 Subject: [PATCH 14/50] Capistrano npm plugin --- Gemfile | 1 + Gemfile.lock | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index 8da2d494..a01355f9 100644 --- a/Gemfile +++ b/Gemfile @@ -194,6 +194,7 @@ group :development do gem 'ed25519', '~> 1.3' gem 'bcrypt_pbkdf', '~> 1.1' gem 'rvm1-capistrano3', require: false + gem 'capistrano-npm' # Environment variable autoload from .env # gem 'dotenv', '~> 2.6', '>= 2.6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index dc5de0ed..6268403f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,6 +109,8 @@ GEM sshkit (>= 1.9.0) capistrano-bundler (2.1.0) capistrano (~> 3.1) + capistrano-npm (1.0.3) + capistrano (>= 3.0.0) capistrano-rails (1.6.2) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) @@ -675,6 +677,7 @@ DEPENDENCIES bundler (= 2.3.26) byebug capistrano (~> 3.10) + capistrano-npm capistrano-rails (~> 1.3) capybara cells (~> 4.1.6) From 467f27050d1a60977950b468cdef3e55915dac9c Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 11:22:09 +0530 Subject: [PATCH 15/50] Deploy scripts: npm changes + rake changes --- config/deploy.rb | 34 +++++++++++++++++++++++++--------- config/deploy/staging.rb | 2 +- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 34cf727b..033a4b21 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -6,14 +6,21 @@ set :deploy_to, "/var/www/#{fetch :application}" set :s3_path_stage, 's3://cortex-env/Stage/.env' set :s3_path_prod, '' + +# RVM options set :rvm1_ruby_version, "2.4.5" set :rvm_type, :user +set :default_env, { rvm_bin_path: '~/.rvm/bin' } + +# NPM options +set :npm_flags, '--silent --no-progress' # default +set :npm_roles, :all # default +set :npm_env_variables, {} # default +set :npm_method, 'ci' # default before 'deploy', 'rvm1:install:rvm' before 'deploy', 'rvm1:install:ruby' -before 'deploy', 'rvm1:install:gems' -after 'deploy', 'remote:env_download' -after 'deploy', 'application_setup' +after 'npm:install', 'remote:application_setup' # after 'deploy', 'remote:terminate_puma_sidekiq' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -54,20 +61,29 @@ desc 'Download env from S3' task :env_download do on roles(:all) do |host| - execute "aws s3 cp #{fetch :s3_path_stage} #{fetch :deploy_to}/current/.env" + execute "aws s3 cp #{fetch :s3_path_stage} #{fetch :release_path}/.env" end end desc 'Application setup' task :application_setup do on roles(:all) do |host| - execute "cd #{fetch :deploy_to}/current/" - execute 'npm install' - execute "#{fetch :deploy_to}/current/node_modules/.bin/bower install angular-mocks" - execute 'bundle exec rake assets:clean react_on_rails:assets:clobber cortex:assets:webpack:compile' - execute 'bundle exec rake assets:precompile' + within release_path do + execute :gem, "update --system 3.2.3" + execute :bundle, 'install' + execute :npm, 'install' + execute "source #{fetch :release_path}/.env" + execute :bundle, 'exec rake assets:clean' + execute :bundle, 'exec rake react_on_rails:assets:clobber' + execute "cd #{fetch :release_path}; #{fetch :release_path}/node_modules/.bin/bower install angular-mocks#1.2" + execute :bundle, 'exec rake cortex:assets:webpack:compile' + execute :bundle, 'exec rake assets:precompile' + end + execute "cd #{fetch :release_path}" end end + before :application_setup, 'rvm1:hook' + before :application_setup, 'env_download' desc 'Terminate existing puma and sidekiq processes' task :terminate_puma_sidekiq do diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index bb5cbd6b..e2b28ddc 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -9,7 +9,7 @@ # set :branch, 'legacy-develop' set :branch, 'RDP-30318-ec2-downsize' -server '54.172.199.120', +server '54.236.172.29', user: 'ubuntu', roles: %w{app db web}, ssh_options: { From 76cacf151122756d4bfc7a5176ca3f43fd7397d1 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 20:46:04 +0530 Subject: [PATCH 16/50] server kill scripts --- config/deploy.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 033a4b21..0002c8c1 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -21,6 +21,7 @@ before 'deploy', 'rvm1:install:rvm' before 'deploy', 'rvm1:install:ruby' after 'npm:install', 'remote:application_setup' +after 'deploy:symlink:release', 'remote:server_startup' # after 'deploy', 'remote:terminate_puma_sidekiq' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -85,11 +86,22 @@ before :application_setup, 'rvm1:hook' before :application_setup, 'env_download' + task :server_startup do + on roles(:all) do |host| + within current_path do + execute "cd #{fetch :release_path}; nohup foreman start -f Procfile &" + execute "cd #{fetch :release_path}; nohup bundle exec sidekiq -e staging --config ./config/sidekiq.yml &" + end + end + end + before :server_startup, 'rvm1:hook' + before :server_startup, 'terminate_puma_sidekiq' + desc 'Terminate existing puma and sidekiq processes' task :terminate_puma_sidekiq do on roles(:all) do |host| - execute 'sudo killall puma' - execute 'sudo killall sidekiq' + execute 'sudo killall puma &' + execute 'sudo killall sidekiq &' end end end From d0415ec902f0ee9adda297fa638ab3b546f04761 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 22:38:00 +0530 Subject: [PATCH 17/50] thin config --- Capfile | 1 + Gemfile | 4 +++- Gemfile.lock | 11 +++++++++++ config/deploy.rb | 40 +++++++++++++++++++++------------------- config/thin.yml | 12 ++++++++++++ 5 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 config/thin.yml diff --git a/Capfile b/Capfile index f1cec3a0..4b5c9ace 100644 --- a/Capfile +++ b/Capfile @@ -19,6 +19,7 @@ install_plugin Capistrano::SCM::Git require 'rvm1/capistrano3' # Load NPM plugin require 'capistrano/npm' +require 'capistrano/thin' # Include tasks from other gems included in your Gemfile # diff --git a/Gemfile b/Gemfile index a01355f9..64c22609 100644 --- a/Gemfile +++ b/Gemfile @@ -112,6 +112,8 @@ gem 'dialog-polyfill-rails', '~> 0.4.5' gem 'flipper', '< 0.11' gem 'flipper-ui', '< 0.11' gem 'flipper-active_record', '< 0.11' +gem 'foreman' +gem 'thin' group :tasks do # Parsing @@ -121,7 +123,6 @@ end group :test, :development do # Environment # gem 'dotenv-rails', :require => 'dotenv/rails-now' - gem 'foreman' # Cache/Sidekiq gem 'redis-namespace' @@ -195,6 +196,7 @@ group :development do gem 'bcrypt_pbkdf', '~> 1.1' gem 'rvm1-capistrano3', require: false gem 'capistrano-npm' + gem 'capistrano-thin', '~> 2.0.0' # Environment variable autoload from .env # gem 'dotenv', '~> 2.6', '>= 2.6.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 6268403f..254a644c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -114,6 +114,9 @@ GEM capistrano-rails (1.6.2) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) + capistrano-thin (2.0.1) + capistrano (~> 3.0) + thin (~> 1.6) capybara (3.32.2) addressable mini_mime (>= 0.1.3) @@ -162,6 +165,7 @@ GEM react_on_rails (~> 6) shrine (~> 2.6) crass (1.0.6) + daemons (1.4.1) database_cleaner (1.99.0) debug_inspector (1.1.0) declarative-builder (0.1.0) @@ -212,6 +216,7 @@ GEM equalizer (0.0.11) erubi (1.12.0) erubis (2.7.0) + eventmachine (1.2.7) excon (0.55.0) execjs (2.8.1) exifr (1.3.10) @@ -625,6 +630,10 @@ GEM net-scp (>= 1.1.2) net-ssh (>= 2.8.0) temple (0.8.2) + thin (1.8.2) + daemons (~> 1.0, >= 1.0.9) + eventmachine (~> 1.0, >= 1.0.4) + rack (>= 1, < 3) thor (0.20.3) thread_safe (0.3.6) tilt (2.1.0) @@ -679,6 +688,7 @@ DEPENDENCIES capistrano (~> 3.10) capistrano-npm capistrano-rails (~> 1.3) + capistrano-thin (~> 2.0.0) capybara cells (~> 4.1.6) cells-haml (~> 0.0.10) @@ -773,6 +783,7 @@ DEPENDENCIES six (~> 0.2.0) sprockets (= 3.7.1) sprockets-rails (= 3.2.0) + thin timecop (~> 0.8) transitions (~> 1.2) turbolinks (~> 5.0.1) diff --git a/config/deploy.rb b/config/deploy.rb index 0002c8c1..75980d44 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -21,7 +21,8 @@ before 'deploy', 'rvm1:install:rvm' before 'deploy', 'rvm1:install:ruby' after 'npm:install', 'remote:application_setup' -after 'deploy:symlink:release', 'remote:server_startup' +# after 'deploy:symlink:release', 'remote:server_startup' +after 'deploy:publishing', 'thin:restart' # after 'deploy', 'remote:terminate_puma_sidekiq' # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -41,6 +42,7 @@ # Default value for :linked_files is [] # append :linked_files, "config/database.yml", 'config/master.key' +# append :linked_files, 'start.sh' # Default value for linked_dirs is [] # append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage" @@ -86,22 +88,22 @@ before :application_setup, 'rvm1:hook' before :application_setup, 'env_download' - task :server_startup do - on roles(:all) do |host| - within current_path do - execute "cd #{fetch :release_path}; nohup foreman start -f Procfile &" - execute "cd #{fetch :release_path}; nohup bundle exec sidekiq -e staging --config ./config/sidekiq.yml &" - end - end - end - before :server_startup, 'rvm1:hook' - before :server_startup, 'terminate_puma_sidekiq' - - desc 'Terminate existing puma and sidekiq processes' - task :terminate_puma_sidekiq do - on roles(:all) do |host| - execute 'sudo killall puma &' - execute 'sudo killall sidekiq &' - end - end +# task :server_startup do +# on roles(:all) do |host| +# within current_path do +# execute "cd #{fetch :release_path}; nohup foreman start -f Procfile &" +# execute "cd #{fetch :release_path}; nohup bundle exec sidekiq -e staging --config ./config/sidekiq.yml &" +# end +# end +# end +# before :server_startup, 'rvm1:hook' +# before :server_startup, 'terminate_puma_sidekiq' + +# desc 'Terminate existing puma and sidekiq processes' +# task :terminate_puma_sidekiq do +# on roles(:all) do |host| +# execute 'sudo killall puma &' +# execute 'sudo killall sidekiq &' +# end +# end end diff --git a/config/thin.yml b/config/thin.yml new file mode 100644 index 00000000..6549358f --- /dev/null +++ b/config/thin.yml @@ -0,0 +1,12 @@ +pid: tmp/pids/thin.pid +timeout: 30 +wait: 30 +log: log/thin.log +max_conns: 1024 +require: [] +max_persistent_conns: 512 +servers: 1 +threaded: true +no-epoll: true +daemonize: true +socket: tmp/web_server.sock \ No newline at end of file From 866bfe3ceb96b81aa548d55885b8a2f47da85093 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 22:42:02 +0530 Subject: [PATCH 18/50] thin staging config --- config/thin/staging.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 config/thin/staging.yml diff --git a/config/thin/staging.yml b/config/thin/staging.yml new file mode 100644 index 00000000..a04f5ba4 --- /dev/null +++ b/config/thin/staging.yml @@ -0,0 +1,13 @@ +pid: tmp/pids/thin.pid +timeout: 30 +wait: 30 +log: log/thin.log +max_conns: 1024 +require: [] +environment: staging +max_persistent_conns: 512 +servers: 1 +threaded: true +no-epoll: true +daemonize: true +socket: tmp/web_server.sock \ No newline at end of file From eaae0bd1216bde6aa1edf9359dd33f2e3858ddf4 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 26 Apr 2023 22:48:26 +0530 Subject: [PATCH 19/50] socket location fix --- config/thin/staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/thin/staging.yml b/config/thin/staging.yml index a04f5ba4..4eab1e3b 100644 --- a/config/thin/staging.yml +++ b/config/thin/staging.yml @@ -10,4 +10,4 @@ servers: 1 threaded: true no-epoll: true daemonize: true -socket: tmp/web_server.sock \ No newline at end of file +socket: /tmp/web_server.sock \ No newline at end of file From 53b2fa49e7712d8bcf7ca804844bfd56d6fe07ad Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 27 Apr 2023 17:59:22 +0530 Subject: [PATCH 20/50] deploy scripts: server + sidekiq config --- config/deploy.rb | 51 ++++++++++++++++++++++++---------------- config/deploy/staging.rb | 2 +- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 75980d44..bf6719f2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -18,12 +18,18 @@ set :npm_env_variables, {} # default set :npm_method, 'ci' # default +# Sidekiq options +set :sidekiq_roles, :all +set :sidekiq_config_path, './config/sidekiq.yml' +set :sidekiq_log_path, './log/sidekiq.log' +set :sidekiq_pid_path, './tmp/sidekiq.pid' + before 'deploy', 'rvm1:install:rvm' before 'deploy', 'rvm1:install:ruby' after 'npm:install', 'remote:application_setup' -# after 'deploy:symlink:release', 'remote:server_startup' after 'deploy:publishing', 'thin:restart' -# after 'deploy', 'remote:terminate_puma_sidekiq' +after 'deploy:publishing', 'sidekiq:restart' + # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -87,23 +93,28 @@ end before :application_setup, 'rvm1:hook' before :application_setup, 'env_download' +end -# task :server_startup do -# on roles(:all) do |host| -# within current_path do -# execute "cd #{fetch :release_path}; nohup foreman start -f Procfile &" -# execute "cd #{fetch :release_path}; nohup bundle exec sidekiq -e staging --config ./config/sidekiq.yml &" -# end -# end -# end -# before :server_startup, 'rvm1:hook' -# before :server_startup, 'terminate_puma_sidekiq' - -# desc 'Terminate existing puma and sidekiq processes' -# task :terminate_puma_sidekiq do -# on roles(:all) do |host| -# execute 'sudo killall puma &' -# execute 'sudo killall sidekiq &' -# end -# end +namespace :sidekiq do + commands = [:start, :stop, :restart] + + commands.each do |command| + desc "sidekiq #{command}" + task command do + on roles(fetch(:sidekiq_roles, :app)), in: :sequence, wait: 5 do + within current_path do + config_file = fetch(:sidekiq_config_path) + log_file = fetch(:sidekiq_log_path) + pid_path = fetch(:sidekiq_pid_path) + if [:stop, :restart].include? command + execute :bundle, "exec sidekiqctl stop #{pid_path} 0" + end + if [:start, :restart].include? command + execute :bundle, "exec sidekiq -d --config #{config_file} --log #{log_file} -P #{pid_path}" + end + end + end + end + before command, 'rvm1:hook' + end end diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index e2b28ddc..abcfb09e 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -9,7 +9,7 @@ # set :branch, 'legacy-develop' set :branch, 'RDP-30318-ec2-downsize' -server '54.236.172.29', +server '52.201.217.194', user: 'ubuntu', roles: %w{app db web}, ssh_options: { From c2b5bc5b0cb2160a1918b62f6eff71cbab93fece Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 27 Apr 2023 22:23:32 +0530 Subject: [PATCH 21/50] flush assets directory --- config/deploy.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/deploy.rb b/config/deploy.rb index bf6719f2..b1c3339d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -82,6 +82,7 @@ execute :bundle, 'install' execute :npm, 'install' execute "source #{fetch :release_path}/.env" + execute "rm -Rf #{fetch :release_path}/public/assets/*.*" execute :bundle, 'exec rake assets:clean' execute :bundle, 'exec rake react_on_rails:assets:clobber' execute "cd #{fetch :release_path}; #{fetch :release_path}/node_modules/.bin/bower install angular-mocks#1.2" From 144d98f640d0c66811d224ea4290fd80331885e2 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 28 Apr 2023 11:38:05 +0530 Subject: [PATCH 22/50] gem grape upgrade --- Gemfile | 8 ++++---- Gemfile.lock | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 64c22609..b8b7901c 100644 --- a/Gemfile +++ b/Gemfile @@ -18,10 +18,10 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', '~> 0.19.2' -gem 'grape-entity', '~> 0.6.1' -gem 'grape-swagger', '~> 0.27.3' -gem 'grape-swagger-entity', '~> 0.2.1' +gem 'grape', '~> 1.5', '>= 1.5.3' +gem 'grape-entity' +gem 'grape-swagger' +gem 'grape-swagger-entity' # Authorization gem 'six', '~> 0.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 254a644c..daddcc16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -192,6 +192,28 @@ GEM railties (>= 3.2) down (5.2.2) addressable (~> 2.5) + dry-configurable (0.11.6) + concurrent-ruby (~> 1.0) + dry-core (~> 0.4, >= 0.4.7) + dry-equalizer (~> 0.2) + dry-container (0.7.2) + concurrent-ruby (~> 1.0) + dry-configurable (~> 0.1, >= 0.1.3) + dry-core (0.4.9) + concurrent-ruby (~> 1.0) + dry-equalizer (0.3.0) + dry-inflector (0.2.0) + dry-logic (1.0.8) + concurrent-ruby (~> 1.0) + dry-core (~> 0.2) + dry-equalizer (~> 0.2) + dry-types (1.4.0) + concurrent-ruby (~> 1.0) + dry-container (~> 0.3) + dry-core (~> 0.4, >= 0.4.4) + dry-equalizer (~> 0.3) + dry-inflector (~> 0.1, >= 0.1.2) + dry-logic (~> 1.0, >= 1.0.2) ed25519 (1.3.0) elasticsearch (5.0.5) elasticsearch-api (= 5.0.5) @@ -279,16 +301,13 @@ GEM json multi_json request_store (>= 1.0) - grape (0.19.2) + grape (1.5.3) activesupport builder - hashie (>= 2.1.0) - multi_json (>= 1.3.2) - multi_xml (>= 0.5.2) + dry-types (>= 1.1) mustermann-grape (~> 1.0.0) rack (>= 1.3.0) rack-accept - virtus (>= 1.0.0) grape-entity (0.6.1) activesupport (>= 5.0.0) multi_json (>= 1.3.2) @@ -412,7 +431,6 @@ GEM minitest (5.15.0) mocha (1.16.1) multi_json (1.15.0) - multi_xml (0.6.0) multipart-post (2.3.0) mustermann (1.1.2) ruby2_keywords (~> 0.0.1) @@ -718,11 +736,11 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 0.19.2) - grape-entity (~> 0.6.1) + grape (~> 1.5, >= 1.5.3) + grape-entity grape-kaminari (~> 0.1.9) - grape-swagger (~> 0.27.3) - grape-swagger-entity (~> 0.2.1) + grape-swagger + grape-swagger-entity guard-jasmine (~> 2.1) guard-rspec (~> 4.7) haml (~> 5.0) From 5e3b7c5c076a26198d098a40d1d88b2ffbafbe84 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 28 Apr 2023 15:52:49 +0530 Subject: [PATCH 23/50] rollback setting --- config/deploy.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index b1c3339d..eee67237 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -20,9 +20,9 @@ # Sidekiq options set :sidekiq_roles, :all -set :sidekiq_config_path, './config/sidekiq.yml' -set :sidekiq_log_path, './log/sidekiq.log' -set :sidekiq_pid_path, './tmp/sidekiq.pid' +set :sidekiq_config_path, 'config/sidekiq.yml' +set :sidekiq_log_path, 'log/sidekiq.log' +set :sidekiq_pid_path, 'tmp/pids/sidekiq.pid' before 'deploy', 'rvm1:install:rvm' before 'deploy', 'rvm1:install:ruby' @@ -30,6 +30,9 @@ after 'deploy:publishing', 'thin:restart' after 'deploy:publishing', 'sidekiq:restart' +# Rollback specific hooks +after 'deploy:reverting', 'remote:application_setup' + # Default branch is :master # ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp @@ -108,7 +111,8 @@ log_file = fetch(:sidekiq_log_path) pid_path = fetch(:sidekiq_pid_path) if [:stop, :restart].include? command - execute :bundle, "exec sidekiqctl stop #{pid_path} 0" + deploy_path = fetch(:deploy_to) + execute :bundle, "exec sidekiqctl stop #{deploy_path}/shared/#{pid_path} 0" end if [:start, :restart].include? command execute :bundle, "exec sidekiq -d --config #{config_file} --log #{log_file} -P #{pid_path}" From 05d872500eeeb917d0200808558fe9c4852bd90d Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 28 Apr 2023 15:55:33 +0530 Subject: [PATCH 24/50] bundle update --- Gemfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index daddcc16..ef097d73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -308,17 +308,17 @@ GEM mustermann-grape (~> 1.0.0) rack (>= 1.3.0) rack-accept - grape-entity (0.6.1) - activesupport (>= 5.0.0) + grape-entity (0.8.2) + activesupport (>= 3.0.0) multi_json (>= 1.3.2) grape-kaminari (0.1.9) grape kaminari - grape-swagger (0.27.3) - grape (>= 0.16.2) - grape-swagger-entity (0.2.5) - grape-entity (>= 0.5.0) - grape-swagger (>= 0.20.4) + grape-swagger (1.3.1) + grape (~> 1.3) + grape-swagger-entity (0.5.1) + grape-entity (>= 0.6.0) + grape-swagger (>= 1.2.0) guard (2.18.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) @@ -350,7 +350,7 @@ GEM hashr (2.0.1) htmlentities (4.3.4) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.13.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) image_optim (0.31.3) @@ -490,7 +490,7 @@ GEM puma (3.8.2) pundit (1.1.0) activesupport (>= 3.0.0) - rack (2.2.6.4) + rack (2.2.7) rack-accept (0.4.5) rack (>= 0.4) rack-cors (0.4.1) From 8d295416b1d428d5438c30f67791a38ac3d4c498 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Fri, 28 Apr 2023 18:17:22 +0530 Subject: [PATCH 25/50] finalized changes --- Capfile | 1 + config/deploy.rb | 2 +- config/deploy/staging.rb | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Capfile b/Capfile index 4b5c9ace..60628f5d 100644 --- a/Capfile +++ b/Capfile @@ -19,6 +19,7 @@ install_plugin Capistrano::SCM::Git require 'rvm1/capistrano3' # Load NPM plugin require 'capistrano/npm' +# Load thin server plugin require 'capistrano/thin' # Include tasks from other gems included in your Gemfile diff --git a/config/deploy.rb b/config/deploy.rb index eee67237..484cda07 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -67,7 +67,7 @@ set :keep_releases, 5 # Uncomment the following to require manually verifying the host key before first deploy. -set :ssh_options, verify_host_key: :secure +set :ssh_options, verify_host_key: :always namespace :remote do desc 'Download env from S3' diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index abcfb09e..ffd287f1 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -7,13 +7,14 @@ # server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value # server "db.example.com", user: "deploy", roles: %w{db} -# set :branch, 'legacy-develop' -set :branch, 'RDP-30318-ec2-downsize' -server '52.201.217.194', +set :branch, 'legacy-develop' +set :staging_ip, '' +set :staging_key_path, '' +server fetch(:staging_ip), user: 'ubuntu', roles: %w{app db web}, ssh_options: { - keys: %w(/Users/sausharma/Keys/cortex-stage-saurabh.pem), + keys: %w( fetch(:staging_key_path) ), forward_agent: false, auth_methods: %w(publickey) } From c1c9cdce4b10da35e6a08ba8aaae7d94f3038fe2 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 3 May 2023 10:56:33 +0530 Subject: [PATCH 26/50] font-awesome update --- Gemfile | 2 +- Gemfile.lock | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index b8b7901c..62e1a8d7 100644 --- a/Gemfile +++ b/Gemfile @@ -93,7 +93,7 @@ gem 'breadcrumbs_on_rails', '~> 3.0.1' # Style gem 'sass-rails', '~> 5.0' gem 'bourbon', '~> 4.3' -gem 'font-awesome-sass', '~> 4.7.0' +gem 'font-awesome-sass', '~> 6.4' gem 'material_design_lite-sass', '~> 1.3.0' # JavaScript diff --git a/Gemfile.lock b/Gemfile.lock index ef097d73..494eeeb2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -289,8 +289,8 @@ GEM formatador (~> 0.2) fog-local (0.3.1) fog-core (~> 1.27) - font-awesome-sass (4.7.0) - sass (>= 3.2) + font-awesome-sass (6.4.0) + sassc (~> 2.0) foreman (0.87.2) formatador (0.3.0) fspath (3.1.2) @@ -613,6 +613,8 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + sassc (2.4.0) + ffi (~> 1.9) sentry-raven (3.1.2) faraday (>= 1.0) shellany (0.0.1) @@ -733,7 +735,7 @@ DEPENDENCIES flipper-active_record (< 0.11) flipper-ui (< 0.11) fog-local (~> 0.3.1) - font-awesome-sass (~> 4.7.0) + font-awesome-sass (~> 6.4) foreman gon (~> 6.1.0) grape (~> 1.5, >= 1.5.3) From 643f5a589f1eb7f6d6389b55b874401b6919a601 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 3 May 2023 11:51:37 +0530 Subject: [PATCH 27/50] Revert "font-awesome update" This reverts commit c1c9cdce4b10da35e6a08ba8aaae7d94f3038fe2. --- Gemfile | 2 +- Gemfile.lock | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 62e1a8d7..b8b7901c 100644 --- a/Gemfile +++ b/Gemfile @@ -93,7 +93,7 @@ gem 'breadcrumbs_on_rails', '~> 3.0.1' # Style gem 'sass-rails', '~> 5.0' gem 'bourbon', '~> 4.3' -gem 'font-awesome-sass', '~> 6.4' +gem 'font-awesome-sass', '~> 4.7.0' gem 'material_design_lite-sass', '~> 1.3.0' # JavaScript diff --git a/Gemfile.lock b/Gemfile.lock index 494eeeb2..ef097d73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -289,8 +289,8 @@ GEM formatador (~> 0.2) fog-local (0.3.1) fog-core (~> 1.27) - font-awesome-sass (6.4.0) - sassc (~> 2.0) + font-awesome-sass (4.7.0) + sass (>= 3.2) foreman (0.87.2) formatador (0.3.0) fspath (3.1.2) @@ -613,8 +613,6 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.4.0) - ffi (~> 1.9) sentry-raven (3.1.2) faraday (>= 1.0) shellany (0.0.1) @@ -735,7 +733,7 @@ DEPENDENCIES flipper-active_record (< 0.11) flipper-ui (< 0.11) fog-local (~> 0.3.1) - font-awesome-sass (~> 6.4) + font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) grape (~> 1.5, >= 1.5.3) From dcadde5ddd40afa3578f2ffe272ebfb11c580cd3 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 8 May 2023 21:38:59 +0530 Subject: [PATCH 28/50] Gems update --- Gemfile | 8 ++++---- Gemfile.lock | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index b8b7901c..91424cd3 100644 --- a/Gemfile +++ b/Gemfile @@ -19,15 +19,15 @@ gem 'cortex-plugins-core', '= 0.12.4' # API gem 'grape', '~> 1.5', '>= 1.5.3' -gem 'grape-entity' -gem 'grape-swagger' -gem 'grape-swagger-entity' +gem 'grape-entity', '~> 0.8.2' +gem 'grape-swagger', '~> 1.3.1' +gem 'grape-swagger-entity', '~> 0.5.1' # Authorization gem 'six', '~> 0.2.0' gem 'devise', '~> 4.2.1' gem 'rack-oauth2', '~> 1.6.1' -gem 'doorkeeper', '~> 4.2' +gem 'doorkeeper', '~> 5.2' gem 'rolify', '~> 5.1' gem 'pundit', '~> 1.1' diff --git a/Gemfile.lock b/Gemfile.lock index ef097d73..bb8f656b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,8 +184,8 @@ GEM dialog-polyfill-rails (0.4.5.1) diff-lcs (1.5.0) docile (1.3.5) - doorkeeper (4.4.3) - railties (>= 4.2) + doorkeeper (5.5.1) + railties (>= 5) dotenv (2.8.1) dotenv-rails (2.8.1) dotenv (= 2.8.1) @@ -718,7 +718,7 @@ DEPENDENCIES deep_cloneable (~> 2.2.2) devise (~> 4.2.1) dialog-polyfill-rails (~> 0.4.5) - doorkeeper (~> 4.2) + doorkeeper (~> 5.2) dotenv (~> 2.6, >= 2.6.0) dotenv-rails ed25519 (~> 1.3) @@ -737,10 +737,10 @@ DEPENDENCIES foreman gon (~> 6.1.0) grape (~> 1.5, >= 1.5.3) - grape-entity + grape-entity (~> 0.8.2) grape-kaminari (~> 0.1.9) - grape-swagger - grape-swagger-entity + grape-swagger (~> 1.3.1) + grape-swagger-entity (~> 0.5.1) guard-jasmine (~> 2.1) guard-rspec (~> 4.7) haml (~> 5.0) From 5e3d09e522f47f7dfacd8f7654f220fdc38349e7 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 8 May 2023 22:13:03 +0530 Subject: [PATCH 29/50] Revert "Gems update" This reverts commit dcadde5ddd40afa3578f2ffe272ebfb11c580cd3. --- Gemfile | 8 ++++---- Gemfile.lock | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 91424cd3..b8b7901c 100644 --- a/Gemfile +++ b/Gemfile @@ -19,15 +19,15 @@ gem 'cortex-plugins-core', '= 0.12.4' # API gem 'grape', '~> 1.5', '>= 1.5.3' -gem 'grape-entity', '~> 0.8.2' -gem 'grape-swagger', '~> 1.3.1' -gem 'grape-swagger-entity', '~> 0.5.1' +gem 'grape-entity' +gem 'grape-swagger' +gem 'grape-swagger-entity' # Authorization gem 'six', '~> 0.2.0' gem 'devise', '~> 4.2.1' gem 'rack-oauth2', '~> 1.6.1' -gem 'doorkeeper', '~> 5.2' +gem 'doorkeeper', '~> 4.2' gem 'rolify', '~> 5.1' gem 'pundit', '~> 1.1' diff --git a/Gemfile.lock b/Gemfile.lock index bb8f656b..ef097d73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -184,8 +184,8 @@ GEM dialog-polyfill-rails (0.4.5.1) diff-lcs (1.5.0) docile (1.3.5) - doorkeeper (5.5.1) - railties (>= 5) + doorkeeper (4.4.3) + railties (>= 4.2) dotenv (2.8.1) dotenv-rails (2.8.1) dotenv (= 2.8.1) @@ -718,7 +718,7 @@ DEPENDENCIES deep_cloneable (~> 2.2.2) devise (~> 4.2.1) dialog-polyfill-rails (~> 0.4.5) - doorkeeper (~> 5.2) + doorkeeper (~> 4.2) dotenv (~> 2.6, >= 2.6.0) dotenv-rails ed25519 (~> 1.3) @@ -737,10 +737,10 @@ DEPENDENCIES foreman gon (~> 6.1.0) grape (~> 1.5, >= 1.5.3) - grape-entity (~> 0.8.2) + grape-entity grape-kaminari (~> 0.1.9) - grape-swagger (~> 1.3.1) - grape-swagger-entity (~> 0.5.1) + grape-swagger + grape-swagger-entity guard-jasmine (~> 2.1) guard-rspec (~> 4.7) haml (~> 5.0) From 319922bdccb283f27a221f9404dfb8123a232df2 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 8 May 2023 22:16:24 +0530 Subject: [PATCH 30/50] grape version change --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index b8b7901c..042493b0 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', '~> 1.5', '>= 1.5.3' +gem 'grape', '~> 1.0', '>= 1.0.0' gem 'grape-entity' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index ef097d73..04bc0cd7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -736,7 +736,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 1.5, >= 1.5.3) + grape (~> 1.0, >= 1.0.0) grape-entity grape-kaminari (~> 0.1.9) grape-swagger From ad74050ba7aace7212cd1031100f7a0c285da18a Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 8 May 2023 22:25:01 +0530 Subject: [PATCH 31/50] Grape version change --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 042493b0..b8b7901c 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', '~> 1.0', '>= 1.0.0' +gem 'grape', '~> 1.5', '>= 1.5.3' gem 'grape-entity' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 04bc0cd7..ef097d73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -736,7 +736,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 1.0, >= 1.0.0) + grape (~> 1.5, >= 1.5.3) grape-entity grape-kaminari (~> 0.1.9) grape-swagger From 18343cbb71acc7040bc069ae214f583a7cd36451 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 9 May 2023 16:22:35 +0530 Subject: [PATCH 32/50] removed public/assets from shared folders, due to fontawesome issue --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 484cda07..a4124ddd 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -55,7 +55,7 @@ # Default value for linked_dirs is [] # append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "tmp/webpacker", "public/system", "vendor", "storage" -append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/assets', 'vendor', 'bower_components' +append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor', 'bower_components' # Default value for default_env is {} # set :default_env, { path: "/opt/ruby/bin:$PATH" } From f2a904c5188f698217e5648bf7e6c9dfe7316c8f Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 16:45:57 +0530 Subject: [PATCH 33/50] Ruby upgrade to 2.5.0 --- Gemfile | 4 ++-- Gemfile.lock | 24 ++++++++++-------------- config/deploy.rb | 2 +- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Gemfile b/Gemfile index b8b7901c..d15997f1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '2.4.5' +ruby '2.5.0' gem 'bundler', '=2.3.26' gem 'dotenv', '~> 2.6', '>= 2.6.0' @@ -18,7 +18,7 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', '~> 1.5', '>= 1.5.3' +gem 'grape', '~> 1.6', '>= 1.6.0' gem 'grape-entity' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index ef097d73..00151b0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -192,26 +192,22 @@ GEM railties (>= 3.2) down (5.2.2) addressable (~> 2.5) - dry-configurable (0.11.6) + dry-configurable (0.12.1) concurrent-ruby (~> 1.0) - dry-core (~> 0.4, >= 0.4.7) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5.0) dry-container (0.7.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.9) + dry-core (0.6.0) concurrent-ruby (~> 1.0) - dry-equalizer (0.3.0) dry-inflector (0.2.0) - dry-logic (1.0.8) + dry-logic (1.2.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) - dry-types (1.4.0) + dry-core (~> 0.5, >= 0.5) + dry-types (1.5.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.3) + dry-core (~> 0.5, >= 0.5) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) ed25519 (1.3.0) @@ -301,7 +297,7 @@ GEM json multi_json request_store (>= 1.0) - grape (1.5.3) + grape (1.7.0) activesupport builder dry-types (>= 1.1) @@ -736,7 +732,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 1.5, >= 1.5.3) + grape (~> 1.6, >= 1.6.0) grape-entity grape-kaminari (~> 0.1.9) grape-swagger @@ -810,7 +806,7 @@ DEPENDENCIES yt (~> 0.30.1) RUBY VERSION - ruby 2.4.5p335 + ruby 2.5.0p0 BUNDLED WITH 2.3.26 diff --git a/config/deploy.rb b/config/deploy.rb index a4124ddd..25464d70 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :s3_path_prod, '' # RVM options -set :rvm1_ruby_version, "2.4.5" +set :rvm1_ruby_version, "2.5.0" set :rvm_type, :user set :default_env, { rvm_bin_path: '~/.rvm/bin' } From 3e5afb88f43b91903eec828f416a3eadfb37ab81 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 17:00:51 +0530 Subject: [PATCH 34/50] Devise update + deploy add gem installer --- Gemfile | 2 +- Gemfile.lock | 6 +++--- config/deploy.rb | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index d15997f1..a32510aa 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ gem 'grape-swagger-entity' # Authorization gem 'six', '~> 0.2.0' -gem 'devise', '~> 4.2.1' +gem 'devise', '~> 4.8.1' gem 'rack-oauth2', '~> 1.6.1' gem 'doorkeeper', '~> 4.2' gem 'rolify', '~> 5.1' diff --git a/Gemfile.lock b/Gemfile.lock index 00151b0b..1974b5db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -175,10 +175,10 @@ GEM activerecord (>= 3.1.0, < 5.2.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.2.1) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.1) + railties (>= 4.1.0) responders warden (~> 1.2.3) dialog-polyfill-rails (0.4.5.1) @@ -712,7 +712,7 @@ DEPENDENCIES cortex-plugins-core (= 0.12.4) database_cleaner (~> 1.5) deep_cloneable (~> 2.2.2) - devise (~> 4.2.1) + devise (~> 4.8.1) dialog-polyfill-rails (~> 0.4.5) doorkeeper (~> 4.2) dotenv (~> 2.6, >= 2.6.0) diff --git a/config/deploy.rb b/config/deploy.rb index 25464d70..62fe460d 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -81,7 +81,8 @@ task :application_setup do on roles(:all) do |host| within release_path do - execute :gem, "update --system 3.2.3" + execute :gem, 'update --system 3.2.3' + execute :gem, 'install bundler -v 2.3.26' execute :bundle, 'install' execute :npm, 'install' execute "source #{fetch :release_path}/.env" From ec5c267993266e4178546e78e178d35c824ed493 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 17:12:37 +0530 Subject: [PATCH 35/50] Grape entity update --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index a32510aa..f138fcdb 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'cortex-plugins-core', '= 0.12.4' # API gem 'grape', '~> 1.6', '>= 1.6.0' -gem 'grape-entity' +gem 'grape-entity', '~> 0.10.2' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 1974b5db..329b937b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -304,7 +304,7 @@ GEM mustermann-grape (~> 1.0.0) rack (>= 1.3.0) rack-accept - grape-entity (0.8.2) + grape-entity (0.10.2) activesupport (>= 3.0.0) multi_json (>= 1.3.2) grape-kaminari (0.1.9) @@ -733,7 +733,7 @@ DEPENDENCIES foreman gon (~> 6.1.0) grape (~> 1.6, >= 1.6.0) - grape-entity + grape-entity (~> 0.10.2) grape-kaminari (~> 0.1.9) grape-swagger grape-swagger-entity From f5bde0f1d94f0e812999611fbe54a27a8e4ee82f Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 17:33:34 +0530 Subject: [PATCH 36/50] Gems update --- Gemfile | 2 +- Gemfile.lock | 61 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index f138fcdb..fac7b491 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', '~> 1.6', '>= 1.6.0' +gem 'grape', '~> 1.5', '>= 1.5.3' gem 'grape-entity', '~> 0.10.2' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 329b937b..50554b8e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,10 +86,10 @@ GEM thread_safe (~> 0.3, >= 0.3.1) bcrypt (3.1.18) bcrypt_pbkdf (1.1.0) - better_errors (2.9.1) - coderay (>= 1.0.0) + better_errors (2.10.0) erubi (>= 1.0.0) rack (>= 0.9.0) + rouge (>= 1.0.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) bootscale (0.7.0) @@ -117,13 +117,13 @@ GEM capistrano-thin (2.0.1) capistrano (~> 3.0) thin (~> 1.6) - capybara (3.32.2) + capybara (3.35.3) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) cells (4.1.7) declarative-builder (< 0.2.0) @@ -149,7 +149,7 @@ GEM coercible (1.0.0) descendants_tracker (~> 0.0.1) concurrent-ruby (1.2.2) - connection_pool (2.2.5) + connection_pool (2.4.0) content_disposition (1.0.0) cortex-exceptions (0.0.4) cortex-plugins-core (0.12.4) @@ -183,7 +183,8 @@ GEM warden (~> 1.2.3) dialog-polyfill-rails (0.4.5.1) diff-lcs (1.5.0) - docile (1.3.5) + digest (3.1.1) + docile (1.4.0) doorkeeper (4.4.3) railties (>= 4.2) dotenv (2.8.1) @@ -290,8 +291,8 @@ GEM foreman (0.87.2) formatador (0.3.0) fspath (3.1.2) - globalid (0.4.2) - activesupport (>= 4.2.0) + globalid (1.1.0) + activesupport (>= 5.0) gon (6.1.0) actionpack (>= 3.0) json @@ -310,7 +311,7 @@ GEM grape-kaminari (0.1.9) grape kaminari - grape-swagger (1.3.1) + grape-swagger (1.4.2) grape (~> 1.3) grape-swagger-entity (0.5.1) grape-entity (>= 0.6.0) @@ -365,6 +366,7 @@ GEM interactor-rails (2.2.1) interactor (~> 3.0) rails (>= 4.2) + io-wait (0.3.0) jasmine (2.99.0) jasmine-core (>= 2.99.0, < 3.0.0) phantomjs @@ -403,12 +405,15 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.20.0) + loofah (2.21.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp material_design_lite-sass (1.3.0.1) autoprefixer-rails (>= 6.5) sass (>= 3.3) @@ -421,7 +426,6 @@ GEM rake mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.4.0) mini_racer (0.4.0) libv8-node (~> 15.14.0.0) minitest (5.15.0) @@ -433,8 +437,21 @@ GEM mustermann-grape (1.0.2) mustermann (>= 1.0.0) nenv (0.3.0) + net-imap (0.2.2) + digest + net-protocol + strscan + net-pop (0.1.2) + net-protocol + net-protocol (0.1.2) + io-wait + timeout net-scp (4.0.0) net-ssh (>= 2.6.5, < 8.0.0) + net-smtp (0.3.0) + digest + net-protocol + timeout net-ssh (6.1.0) ng-rails-csrf (0.1.0) ngannotate-rails (1.2.2) @@ -442,8 +459,8 @@ GEM rails (>= 3.1) nio4r (2.5.9) no_proxy_fix (0.1.2) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + nokogiri (1.12.5-x86_64-darwin) + racc (~> 1.4) non-stupid-digest-assets (1.0.9) sprockets (>= 2.0) notiffany (0.1.3) @@ -479,13 +496,14 @@ GEM pry-remote (0.1.8) pry (~> 0.9) slop (~> 3.0) - pry-stack_explorer (0.4.12) + pry-stack_explorer (0.4.13) binding_of_caller (~> 0.7) pry (~> 0.13) public_suffix (3.1.1) puma (3.8.2) pundit (1.1.0) activesupport (>= 3.0.0) + racc (1.6.2) rack (2.2.7) rack-accept (0.4.5) rack (>= 0.4) @@ -559,7 +577,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.9.2) redis (>= 4, < 6) - regexp_parser (1.8.2) + regexp_parser (2.8.0) request_store (1.5.1) rack (>= 1.4) responders (3.0.1) @@ -567,6 +585,7 @@ GEM railties (>= 5.0) rexml (3.2.5) rolify (5.3.0) + rouge (3.30.0) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -622,10 +641,12 @@ GEM connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (>= 3.3.4, < 5) - simplecov (0.18.5) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) sinatra (2.0.8.1) mustermann (~> 1.0) rack (~> 2.0) @@ -643,7 +664,8 @@ GEM sshkit (1.21.4) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - temple (0.8.2) + strscan (3.0.6) + temple (0.10.0) thin (1.8.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) @@ -652,6 +674,7 @@ GEM thread_safe (0.3.6) tilt (2.1.0) timecop (0.9.6) + timeout (0.3.2) transitions (1.3.0) turbolinks (5.0.1) turbolinks-source (~> 5) @@ -732,7 +755,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 1.6, >= 1.6.0) + grape (~> 1.5, >= 1.5.3) grape-entity (~> 0.10.2) grape-kaminari (~> 0.1.9) grape-swagger From d733a02a94c2a2bc8594f368c885255a05ed2477 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 17:55:51 +0530 Subject: [PATCH 37/50] added sassc-rails --- Gemfile | 1 + Gemfile.lock | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/Gemfile b/Gemfile index fac7b491..cd8885ee 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ gem 'bower-rails', '~> 0.11.0' gem 'puma', '~> 3.8.2' # Rails +gem 'sassc-rails' gem 'rails', '~> 5.0.2' # Cortex-specific diff --git a/Gemfile.lock b/Gemfile.lock index 50554b8e..9b0947f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -628,6 +628,14 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sentry-raven (3.1.2) faraday (>= 1.0) shellany (0.0.1) @@ -812,6 +820,7 @@ DEPENDENCIES rubyzip (~> 1.2.1) rvm1-capistrano3 sass-rails (~> 5.0) + sassc-rails sentry-raven shoulda-matchers (~> 3.1) sidekiq (~> 5.0.0) From 8525535f52574e9c2b882efda6ca08b32d55283d Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 18:20:30 +0530 Subject: [PATCH 38/50] Using custom git source for grape --- Gemfile | 2 +- Gemfile.lock | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index cd8885ee..2240c5e1 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', '~> 1.5', '>= 1.5.3' +gem 'grape', git: 'git@github.com:saurabh-sharma-cb/grape-cortex.git', branch: 'v1.5.3-grape-cortex' gem 'grape-entity', '~> 0.10.2' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 9b0947f1..17c866a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,16 @@ +GIT + remote: git@github.com:saurabh-sharma-cb/grape-cortex.git + revision: 31b301eca7bebe1e7facac0b996b7072045fd30e + branch: v1.5.3-grape-cortex + specs: + grape (1.5.3) + activesupport + builder + dry-types (>= 1.1) + mustermann-grape (~> 1.0.0) + rack (>= 1.3.0) + rack-accept + GIT remote: https://github.com/cortex-cms/awesome_nested_set.git revision: d3bad27fa959788e403becc411f6db9d1aac1dfb @@ -298,13 +311,6 @@ GEM json multi_json request_store (>= 1.0) - grape (1.7.0) - activesupport - builder - dry-types (>= 1.1) - mustermann-grape (~> 1.0.0) - rack (>= 1.3.0) - rack-accept grape-entity (0.10.2) activesupport (>= 3.0.0) multi_json (>= 1.3.2) @@ -763,7 +769,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 1.5, >= 1.5.3) + grape! grape-entity (~> 0.10.2) grape-kaminari (~> 0.1.9) grape-swagger From dba5bec521569147ba1064c68a2e435e399da39b Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 19:28:37 +0530 Subject: [PATCH 39/50] reverting changes --- Gemfile | 6 ++-- Gemfile.lock | 92 +++++++++++++++++++----------------------------- config/deploy.rb | 2 +- 3 files changed, 41 insertions(+), 59 deletions(-) diff --git a/Gemfile b/Gemfile index 2240c5e1..23910261 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '2.5.0' +ruby '2.4.5' gem 'bundler', '=2.3.26' gem 'dotenv', '~> 2.6', '>= 2.6.0' @@ -19,8 +19,8 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', git: 'git@github.com:saurabh-sharma-cb/grape-cortex.git', branch: 'v1.5.3-grape-cortex' -gem 'grape-entity', '~> 0.10.2' +gem 'grape', github: 'saurabh-sharma-cb/grape-cortex', branch: 'v1.5.3-grape-cortex' +gem 'grape-entity' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 17c866a7..7f783c7f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,12 @@ GIT - remote: git@github.com:saurabh-sharma-cb/grape-cortex.git + remote: https://github.com/cortex-cms/awesome_nested_set.git + revision: d3bad27fa959788e403becc411f6db9d1aac1dfb + specs: + awesome_nested_set (3.1.2) + activerecord (>= 4.0.0, < 5.1) + +GIT + remote: https://github.com/saurabh-sharma-cb/grape-cortex.git revision: 31b301eca7bebe1e7facac0b996b7072045fd30e branch: v1.5.3-grape-cortex specs: @@ -11,13 +18,6 @@ GIT rack (>= 1.3.0) rack-accept -GIT - remote: https://github.com/cortex-cms/awesome_nested_set.git - revision: d3bad27fa959788e403becc411f6db9d1aac1dfb - specs: - awesome_nested_set (3.1.2) - activerecord (>= 4.0.0, < 5.1) - GIT remote: https://github.com/triloch/rails-observers.git revision: ea30390cb07b4a37dd2f9d03966c89c1372f9dbe @@ -130,13 +130,13 @@ GEM capistrano-thin (2.0.1) capistrano (~> 3.0) thin (~> 1.6) - capybara (3.35.3) + capybara (3.32.2) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) + regexp_parser (~> 1.5) xpath (~> 3.2) cells (4.1.7) declarative-builder (< 0.2.0) @@ -162,7 +162,7 @@ GEM coercible (1.0.0) descendants_tracker (~> 0.0.1) concurrent-ruby (1.2.2) - connection_pool (2.4.0) + connection_pool (2.2.5) content_disposition (1.0.0) cortex-exceptions (0.0.4) cortex-plugins-core (0.12.4) @@ -196,8 +196,7 @@ GEM warden (~> 1.2.3) dialog-polyfill-rails (0.4.5.1) diff-lcs (1.5.0) - digest (3.1.1) - docile (1.4.0) + docile (1.3.5) doorkeeper (4.4.3) railties (>= 4.2) dotenv (2.8.1) @@ -206,22 +205,26 @@ GEM railties (>= 3.2) down (5.2.2) addressable (~> 2.5) - dry-configurable (0.12.1) + dry-configurable (0.11.6) concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5.0) + dry-core (~> 0.4, >= 0.4.7) + dry-equalizer (~> 0.2) dry-container (0.7.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.6.0) + dry-core (0.4.9) concurrent-ruby (~> 1.0) + dry-equalizer (0.3.0) dry-inflector (0.2.0) - dry-logic (1.2.0) + dry-logic (1.0.8) concurrent-ruby (~> 1.0) - dry-core (~> 0.5, >= 0.5) - dry-types (1.5.1) + dry-core (~> 0.2) + dry-equalizer (~> 0.2) + dry-types (1.4.0) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.5, >= 0.5) + dry-core (~> 0.4, >= 0.4.4) + dry-equalizer (~> 0.3) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) ed25519 (1.3.0) @@ -304,20 +307,20 @@ GEM foreman (0.87.2) formatador (0.3.0) fspath (3.1.2) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (0.4.2) + activesupport (>= 4.2.0) gon (6.1.0) actionpack (>= 3.0) json multi_json request_store (>= 1.0) - grape-entity (0.10.2) + grape-entity (0.8.2) activesupport (>= 3.0.0) multi_json (>= 1.3.2) grape-kaminari (0.1.9) grape kaminari - grape-swagger (1.4.2) + grape-swagger (1.3.1) grape (~> 1.3) grape-swagger-entity (0.5.1) grape-entity (>= 0.6.0) @@ -372,7 +375,6 @@ GEM interactor-rails (2.2.1) interactor (~> 3.0) rails (>= 4.2) - io-wait (0.3.0) jasmine (2.99.0) jasmine-core (>= 2.99.0, < 3.0.0) phantomjs @@ -415,11 +417,8 @@ GEM crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) - mail (2.8.1) + mail (2.7.1) mini_mime (>= 0.1.1) - net-imap - net-pop - net-smtp material_design_lite-sass (1.3.0.1) autoprefixer-rails (>= 6.5) sass (>= 3.3) @@ -432,6 +431,7 @@ GEM rake mini_magick (4.12.0) mini_mime (1.1.2) + mini_portile2 (2.4.0) mini_racer (0.4.0) libv8-node (~> 15.14.0.0) minitest (5.15.0) @@ -443,21 +443,8 @@ GEM mustermann-grape (1.0.2) mustermann (>= 1.0.0) nenv (0.3.0) - net-imap (0.2.2) - digest - net-protocol - strscan - net-pop (0.1.2) - net-protocol - net-protocol (0.1.2) - io-wait - timeout net-scp (4.0.0) net-ssh (>= 2.6.5, < 8.0.0) - net-smtp (0.3.0) - digest - net-protocol - timeout net-ssh (6.1.0) ng-rails-csrf (0.1.0) ngannotate-rails (1.2.2) @@ -465,8 +452,8 @@ GEM rails (>= 3.1) nio4r (2.5.9) no_proxy_fix (0.1.2) - nokogiri (1.12.5-x86_64-darwin) - racc (~> 1.4) + nokogiri (1.10.10) + mini_portile2 (~> 2.4.0) non-stupid-digest-assets (1.0.9) sprockets (>= 2.0) notiffany (0.1.3) @@ -502,14 +489,13 @@ GEM pry-remote (0.1.8) pry (~> 0.9) slop (~> 3.0) - pry-stack_explorer (0.4.13) + pry-stack_explorer (0.4.12) binding_of_caller (~> 0.7) pry (~> 0.13) public_suffix (3.1.1) puma (3.8.2) pundit (1.1.0) activesupport (>= 3.0.0) - racc (1.6.2) rack (2.2.7) rack-accept (0.4.5) rack (>= 0.4) @@ -583,7 +569,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.9.2) redis (>= 4, < 6) - regexp_parser (2.8.0) + regexp_parser (1.8.2) request_store (1.5.1) rack (>= 1.4) responders (3.0.1) @@ -655,12 +641,10 @@ GEM connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (>= 3.3.4, < 5) - simplecov (0.22.0) + simplecov (0.18.5) docile (~> 1.1) simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) - simplecov_json_formatter (0.1.4) sinatra (2.0.8.1) mustermann (~> 1.0) rack (~> 2.0) @@ -678,8 +662,7 @@ GEM sshkit (1.21.4) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - strscan (3.0.6) - temple (0.10.0) + temple (0.8.2) thin (1.8.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) @@ -688,7 +671,6 @@ GEM thread_safe (0.3.6) tilt (2.1.0) timecop (0.9.6) - timeout (0.3.2) transitions (1.3.0) turbolinks (5.0.1) turbolinks-source (~> 5) @@ -770,7 +752,7 @@ DEPENDENCIES foreman gon (~> 6.1.0) grape! - grape-entity (~> 0.10.2) + grape-entity grape-kaminari (~> 0.1.9) grape-swagger grape-swagger-entity @@ -844,7 +826,7 @@ DEPENDENCIES yt (~> 0.30.1) RUBY VERSION - ruby 2.5.0p0 + ruby 2.4.5p335 BUNDLED WITH 2.3.26 diff --git a/config/deploy.rb b/config/deploy.rb index 62fe460d..7a5a00a4 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -8,7 +8,7 @@ set :s3_path_prod, '' # RVM options -set :rvm1_ruby_version, "2.5.0" +set :rvm1_ruby_version, "2.4.5" set :rvm_type, :user set :default_env, { rvm_bin_path: '~/.rvm/bin' } From c1f7209dcf69b68885d849119cee6f2a73c11ff5 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 19:51:32 +0530 Subject: [PATCH 40/50] Gemfile changes --- Gemfile | 4 ++-- Gemfile.lock | 38 +++++++++++--------------------------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/Gemfile b/Gemfile index 23910261..1ced65b6 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,6 @@ gem 'bower-rails', '~> 0.11.0' gem 'puma', '~> 3.8.2' # Rails -gem 'sassc-rails' gem 'rails', '~> 5.0.2' # Cortex-specific @@ -19,7 +18,8 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -gem 'grape', github: 'saurabh-sharma-cb/grape-cortex', branch: 'v1.5.3-grape-cortex' +# gem 'grape', github: 'saurabh-sharma-cb/grape-cortex', branch: 'v1.5.3-grape-cortex' +gem 'grape', '~> 1.5', '>= 1.5.3' gem 'grape-entity' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 7f783c7f..81bb8f15 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,19 +5,6 @@ GIT awesome_nested_set (3.1.2) activerecord (>= 4.0.0, < 5.1) -GIT - remote: https://github.com/saurabh-sharma-cb/grape-cortex.git - revision: 31b301eca7bebe1e7facac0b996b7072045fd30e - branch: v1.5.3-grape-cortex - specs: - grape (1.5.3) - activesupport - builder - dry-types (>= 1.1) - mustermann-grape (~> 1.0.0) - rack (>= 1.3.0) - rack-accept - GIT remote: https://github.com/triloch/rails-observers.git revision: ea30390cb07b4a37dd2f9d03966c89c1372f9dbe @@ -99,10 +86,10 @@ GEM thread_safe (~> 0.3, >= 0.3.1) bcrypt (3.1.18) bcrypt_pbkdf (1.1.0) - better_errors (2.10.0) + better_errors (2.9.1) + coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) - rouge (>= 1.0.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) bootscale (0.7.0) @@ -314,6 +301,13 @@ GEM json multi_json request_store (>= 1.0) + grape (1.5.3) + activesupport + builder + dry-types (>= 1.1) + mustermann-grape (~> 1.0.0) + rack (>= 1.3.0) + rack-accept grape-entity (0.8.2) activesupport (>= 3.0.0) multi_json (>= 1.3.2) @@ -413,7 +407,7 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.21.1) + loofah (2.20.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -577,7 +571,6 @@ GEM railties (>= 5.0) rexml (3.2.5) rolify (5.3.0) - rouge (3.30.0) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -620,14 +613,6 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.4.0) - ffi (~> 1.9) - sassc-rails (2.1.2) - railties (>= 4.0.0) - sassc (>= 2.0) - sprockets (> 3.0) - sprockets-rails - tilt sentry-raven (3.1.2) faraday (>= 1.0) shellany (0.0.1) @@ -751,7 +736,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape! + grape (~> 1.5, >= 1.5.3) grape-entity grape-kaminari (~> 0.1.9) grape-swagger @@ -808,7 +793,6 @@ DEPENDENCIES rubyzip (~> 1.2.1) rvm1-capistrano3 sass-rails (~> 5.0) - sassc-rails sentry-raven shoulda-matchers (~> 3.1) sidekiq (~> 5.0.0) From 575ea08ba25bec3a9044239e801238ff3e9c12cf Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Thu, 11 May 2023 22:05:52 +0530 Subject: [PATCH 41/50] grape source change --- Gemfile | 3 +-- Gemfile.lock | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 1ced65b6..8fb63da0 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,7 @@ gem 'cortex-exceptions', '= 0.0.4' gem 'cortex-plugins-core', '= 0.12.4' # API -# gem 'grape', github: 'saurabh-sharma-cb/grape-cortex', branch: 'v1.5.3-grape-cortex' -gem 'grape', '~> 1.5', '>= 1.5.3' +gem 'grape', github: 'saurabh-sharma-cb/grape-cortex', branch: 'v1.5.3-grape-cortex' gem 'grape-entity' gem 'grape-swagger' gem 'grape-swagger-entity' diff --git a/Gemfile.lock b/Gemfile.lock index 81bb8f15..f6d7a45d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,19 @@ GIT awesome_nested_set (3.1.2) activerecord (>= 4.0.0, < 5.1) +GIT + remote: https://github.com/saurabh-sharma-cb/grape-cortex.git + revision: 0af2eceeddb7c985ea688584c8328e88b71491ef + branch: v1.5.3-grape-cortex + specs: + grape (1.5.3) + activesupport + builder + dry-types (>= 1.1) + mustermann-grape (~> 1.0.0) + rack (>= 1.3.0) + rack-accept + GIT remote: https://github.com/triloch/rails-observers.git revision: ea30390cb07b4a37dd2f9d03966c89c1372f9dbe @@ -301,13 +314,6 @@ GEM json multi_json request_store (>= 1.0) - grape (1.5.3) - activesupport - builder - dry-types (>= 1.1) - mustermann-grape (~> 1.0.0) - rack (>= 1.3.0) - rack-accept grape-entity (0.8.2) activesupport (>= 3.0.0) multi_json (>= 1.3.2) @@ -736,7 +742,7 @@ DEPENDENCIES font-awesome-sass (~> 4.7.0) foreman gon (~> 6.1.0) - grape (~> 1.5, >= 1.5.3) + grape! grape-entity grape-kaminari (~> 0.1.9) grape-swagger From 0162346b4589626db4e08454ae02171f5029177e Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 15 May 2023 17:26:33 +0530 Subject: [PATCH 42/50] paperclip fixes --- app/assets/legacy_templates/media/new.html | 2 +- config/initializers/paperclip.rb | 14 ++++++++++++++ config/initializers/paperclip_optimizer.rb | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/assets/legacy_templates/media/new.html b/app/assets/legacy_templates/media/new.html index 065bf541..6142e240 100644 --- a/app/assets/legacy_templates/media/new.html +++ b/app/assets/legacy_templates/media/new.html @@ -1,5 +1,5 @@
-
+
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index ae0bd7c7..15b8584a 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -1,13 +1,27 @@ module Paperclip class HashieMashUploadedFileAdapter < AbstractAdapter + attr_accessor :original_filename + def initialize(target) @tempfile, @content_type, @size = target.tempfile, target.type, target.tempfile.size self.original_filename = target.filename end + end + class HashUploadedFileAdapter < AbstractAdapter + attr_accessor :original_filename + + def initialize(target) + @tempfile, @content_type, @size = target[:tempfile], target[:type], target[:tempfile].size + self.original_filename = target[:filename] + end end end Paperclip.io_adapters.register Paperclip::HashieMashUploadedFileAdapter do |target| target.is_a? Hashie::Mash end + +Paperclip.io_adapters.register Paperclip::HashUploadedFileAdapter do |target| + target.is_a?(Hash) && target[:tempfile].is_a?(Tempfile) +end diff --git a/config/initializers/paperclip_optimizer.rb b/config/initializers/paperclip_optimizer.rb index 92b1f41f..2c78936e 100644 --- a/config/initializers/paperclip_optimizer.rb +++ b/config/initializers/paperclip_optimizer.rb @@ -17,10 +17,11 @@ optipng: false, pngcrush: false, pngout: false, + oxipng: false, pngquant: { allow_lossy: true, quality: 33..50, speed: 3 }, - svgo: false + svgo: false } From 0a4e699ec1a107531878e42b6d27c6b03f896aa9 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 16 May 2023 20:08:21 +0530 Subject: [PATCH 43/50] webpages update error --- app/api/v1/resources/webpages.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/v1/resources/webpages.rb b/app/api/v1/resources/webpages.rb index 7e26fd2b..d1ca932d 100644 --- a/app/api/v1/resources/webpages.rb +++ b/app/api/v1/resources/webpages.rb @@ -70,6 +70,7 @@ class Webpages < Grape::API if params[:seo_keyword_list] webpage.seo_keyword_list = params[:seo_keyword_list] end + webpage.user = current_user! webpage.update!(update_params.to_hash) CacheBustWebpageJob.perform_later(webpage.url) From 7bbe08ce4f429a18b1c362761cdc12d1b51649cf Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 16 May 2023 22:38:23 +0530 Subject: [PATCH 44/50] added hashie mash to webpages --- app/api/v1/resources/webpages.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/v1/resources/webpages.rb b/app/api/v1/resources/webpages.rb index d1ca932d..2b56274d 100644 --- a/app/api/v1/resources/webpages.rb +++ b/app/api/v1/resources/webpages.rb @@ -5,6 +5,7 @@ class Webpages < Grape::API resource :webpages do include Grape::Kaminari + include Grape::Extensions::Hashie::Mash::ParamBuilder helpers ::V1::Helpers::WebpagesHelper paginate per_page: 25, max_per_page: 1000 From 6b2797bad7753a3b4193825d4a9402d972f32ec0 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 29 May 2023 16:43:59 +0530 Subject: [PATCH 45/50] Updated readme: added deployment changes + instructions --- README.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ba87c0e9..f34eece3 100644 --- a/README.md +++ b/README.md @@ -175,21 +175,31 @@ The admin interface should now be accessible locally on port `3000`. To access C ### Deployment -To use an automated tool to deploy the server, set this environmental variable: +Capistrano is used to deploy the application. +It requires the IP address for the server and the pem keyfile for access. +Following configuration is required: -```shell -CI=true +1. Edit 'config/deploy/staging.rb' and set the following values: ``` +set :staging_ip, '' +set :staging_key_path, '' +``` +2. Capistrano commands mini-cheatsheet +``` +# Deploy the application +cap staging deploy -This will suppress Bower's interactive request to enable insights/metrics reporting, which normally prevents the CI process from continuing. +# Restart thin web-server +cap staging thin:restart -Additionally, deploying the `development` environment as a non-local server will require an additional environmental variable be set: +# Restart Sidekiq +cap staging sidekiq:restart -```shell -DEPLOYED=true +# Rollback to the previous version +cap staging deploy:rollback ``` -This will configure various things, such as [dotenv](https://github.com/bkeepers/dotenv) to behave normally in a deployed scenario. +Analogous changes can be done for production environment. ## Running Test Suite From 71e82137668041279ef73d951204097980484709 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 31 May 2023 15:53:07 +0530 Subject: [PATCH 46/50] perform cache bust now --- app/api/v1/resources/webpages.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/v1/resources/webpages.rb b/app/api/v1/resources/webpages.rb index 2b56274d..394f4f52 100644 --- a/app/api/v1/resources/webpages.rb +++ b/app/api/v1/resources/webpages.rb @@ -74,7 +74,7 @@ class Webpages < Grape::API webpage.user = current_user! webpage.update!(update_params.to_hash) - CacheBustWebpageJob.perform_later(webpage.url) + CacheBustWebpageJob.perform(webpage.url) present webpage, with: ::V1::Entities::Webpage, full: true end From c45b3dc4cb9fd7cff3df08276a62e208f82e82a0 Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Wed, 31 May 2023 16:04:26 +0530 Subject: [PATCH 47/50] fix cache bust --- app/api/v1/resources/webpages.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/v1/resources/webpages.rb b/app/api/v1/resources/webpages.rb index 394f4f52..982d6610 100644 --- a/app/api/v1/resources/webpages.rb +++ b/app/api/v1/resources/webpages.rb @@ -74,7 +74,7 @@ class Webpages < Grape::API webpage.user = current_user! webpage.update!(update_params.to_hash) - CacheBustWebpageJob.perform(webpage.url) + CacheBustWebpageJob.perform_now(webpage.url) present webpage, with: ::V1::Entities::Webpage, full: true end From 7f6ef594a37b7882089940090cb66c592593a36d Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Mon, 18 Sep 2023 15:10:19 +0530 Subject: [PATCH 48/50] staging deploy changes --- config/deploy/staging.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index ffd287f1..c4f0e36d 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -7,9 +7,9 @@ # server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value # server "db.example.com", user: "deploy", roles: %w{db} -set :branch, 'legacy-develop' -set :staging_ip, '' -set :staging_key_path, '' +set :branch, 'RDP-30318-ec2-downsize' +set :staging_ip, '34.232.151.154' +set :staging_key_path, '/Users/sausharma/Keys/cortex-stage-saurabh.pem' server fetch(:staging_ip), user: 'ubuntu', roles: %w{app db web}, From a17592468e9d86a9b3f92e5b349a3271e85a746e Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 16 Jul 2024 10:21:14 +0530 Subject: [PATCH 49/50] removed elasticache update temporarily --- app/models/application_record.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index c3063f33..05927d76 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -3,7 +3,7 @@ class ApplicationRecord < ActiveRecord::Base # A bug in ES-Rails 5.x is breaking document updates: # https://github.com/elastic/elasticsearch-rails/issues/669 - after_commit :refresh_elasticsearch_index, on: :update + # after_commit :refresh_elasticsearch_index, on: :update private From 76d6ec01ab1c1f672b4ea4c30fd33f93f97d726e Mon Sep 17 00:00:00 2001 From: Saurabh Sharma Date: Tue, 16 Jul 2024 10:34:38 +0530 Subject: [PATCH 50/50] reverting changes for elastiserch update --- app/models/application_record.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 05927d76..c3063f33 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -3,7 +3,7 @@ class ApplicationRecord < ActiveRecord::Base # A bug in ES-Rails 5.x is breaking document updates: # https://github.com/elastic/elasticsearch-rails/issues/669 - # after_commit :refresh_elasticsearch_index, on: :update + after_commit :refresh_elasticsearch_index, on: :update private