mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 18:47:51 +00:00 
			
		
		
		
	chore: upgrade ruby to 3.1.3 (#5555)
* chore: update to ruby 3.1.3
* chore: ping docker version to alpine3.16 for nodev16.x
Starting with Node 17, nodejs switched to OpenSSL3. The docker builds
are installing node18.xx with alpine-3.1.3.
From Node.js 17's announcement post:
    If you hit an ERR_OSSL_EVP_UNSUPPORTED error in your application
with Node.js 17, it’s likely that your application or a module you’re
using is attempting to use an algorithm or key size which is no longer
allowed by default with OpenSSL 3.0. A new command-line option,
--openssl-legacy-provider, has been added to revert to the legacy
provider as a temporary workaround for these tightened restrictions.
Looks like a webpack issue. This is fixed in webpacl 5+ and we are on
webpack4 at the moment.
Solutions
    Upgrade webpack.
    Pin nodejs version to be 16.x.x
    Use  --openssl-legacy-provider as a workaround.
Pin docker version to alpine3.16 branch to have node16.x by default
ref:
https://github.com/chatwoot/chatwoot/pull/5555#issuecomment-1379778532
* chore: update webmock
* chore: fix ruby gem path in dockerfile
* chore: switch to node16 in circleci
* chore: update ruby version in linux installer script
* chore: update ruby version in linux installer script
* chore: fix circleci
* chore: fix circleci
* feat: upgrade node version to 16.x in linux installer
* chore: update systemd files
Co-authored-by: Sojan Jose <sojan@chatwoot.com>
			
			
This commit is contained in:
		| @@ -7,7 +7,7 @@ defaults: &defaults | |||||||
|   working_directory: ~/build |   working_directory: ~/build | ||||||
|   docker: |   docker: | ||||||
|     # specify the version you desire here |     # specify the version you desire here | ||||||
|     - image: cimg/ruby:3.0.4-browsers |     - image: cimg/ruby:3.1.3-browsers | ||||||
|  |  | ||||||
|     # Specify service dependencies here if necessary |     # Specify service dependencies here if necessary | ||||||
|     # CircleCI maintains a library of pre-built images |     # CircleCI maintains a library of pre-built images | ||||||
| @@ -38,6 +38,18 @@ jobs: | |||||||
|           name: Which bundler? |           name: Which bundler? | ||||||
|           command: bundle -v |           command: bundle -v | ||||||
|  |  | ||||||
|  |       - run: | ||||||
|  |           name: Swap node versions | ||||||
|  |           command: | | ||||||
|  |             set +e | ||||||
|  |             wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||||||
|  |             export NVM_DIR="$HOME/.nvm" | ||||||
|  |             [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||||||
|  |             [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | ||||||
|  |             nvm install v16 | ||||||
|  |             echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV | ||||||
|  |             echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV | ||||||
|  |  | ||||||
|       # Run bundler |       # Run bundler | ||||||
|       # Load installed gems from cache if possible, bundle install then save cache |       # Load installed gems from cache if possible, bundle install then save cache | ||||||
|       # Multiple caches are used to increase the chance of a cache hit |       # Multiple caches are used to increase the chance of a cache hit | ||||||
| @@ -193,4 +205,3 @@ workflows: | |||||||
|       - upload-coverage: |       - upload-coverage: | ||||||
|           requires: |           requires: | ||||||
|              - build |              - build | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								.github/workflows/run_foss_spec.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/run_foss_spec.yml
									
									
									
									
										vendored
									
									
								
							| @@ -47,7 +47,6 @@ jobs: | |||||||
|  |  | ||||||
|     - uses: ruby/setup-ruby@v1 |     - uses: ruby/setup-ruby@v1 | ||||||
|       with: |       with: | ||||||
|         ruby-version: 3.0.4 # Not needed with a .ruby-version file |  | ||||||
|         bundler-cache: true # runs 'bundle install' and caches installed gems automatically |         bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||||||
|  |  | ||||||
|     - name: yarn |     - name: yarn | ||||||
|   | |||||||
| @@ -86,6 +86,10 @@ Style/ClassAndModuleChildren: | |||||||
|     - 'config/application.rb' |     - 'config/application.rb' | ||||||
| Style/MapToHash: | Style/MapToHash: | ||||||
|   Enabled: false |   Enabled: false | ||||||
|  | Style/HashSyntax: | ||||||
|  |   Enabled: true | ||||||
|  |   EnforcedStyle: no_mixed_keys | ||||||
|  |   EnforcedShorthandSyntax: never | ||||||
| RSpec/NestedGroups: | RSpec/NestedGroups: | ||||||
|   Enabled: true |   Enabled: true | ||||||
|   Max: 4 |   Max: 4 | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 3.0.4 | 3.1.3 | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Gemfile
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| source 'https://rubygems.org' | source 'https://rubygems.org' | ||||||
|  |  | ||||||
| ruby '3.0.4' | ruby '3.1.3' | ||||||
|  |  | ||||||
| ##-- base gems for rails --## | ##-- base gems for rails --## | ||||||
| gem 'rack-cors', require: 'rack/cors' | gem 'rack-cors', require: 'rack/cors' | ||||||
| @@ -107,7 +107,12 @@ gem 'sidekiq-cron', '~> 1.3' | |||||||
|  |  | ||||||
| ##-- Push notification service --## | ##-- Push notification service --## | ||||||
| gem 'fcm' | gem 'fcm' | ||||||
| gem 'webpush' |  | ||||||
|  | # Ref: https://github.com/mastodon/mastodon/pull/18449 | ||||||
|  | # ref: https://github.com/zaru/webpush/pull/106 | ||||||
|  | # lets switch to web-push gem once the above PR is merged | ||||||
|  | # https://github.com/zaru/webpush/pull/106#issuecomment-1342925261 | ||||||
|  | gem 'webpush', git: 'https://github.com/ClearlyClaire/webpush.git', ref: 'f14a4d52e201128b1b00245d11b6de80d6cfdcd9' | ||||||
|  |  | ||||||
| ##-- geocoding / parse location from ip --## | ##-- geocoding / parse location from ip --## | ||||||
| # http://www.rubygeocoder.com/ | # http://www.rubygeocoder.com/ | ||||||
| @@ -137,6 +142,11 @@ gem 'stripe' | |||||||
| ## to populate db with sample data | ## to populate db with sample data | ||||||
| gem 'faker' | gem 'faker' | ||||||
|  |  | ||||||
|  | # Can remove this in rails 7 | ||||||
|  | gem 'net-imap', require: false | ||||||
|  | gem 'net-pop', require: false | ||||||
|  | gem 'net-smtp', require: false | ||||||
|  |  | ||||||
| group :production, :staging do | group :production, :staging do | ||||||
|   # we dont want request timing out in development while using byebug |   # we dont want request timing out in development while using byebug | ||||||
|   gem 'rack-timeout' |   gem 'rack-timeout' | ||||||
|   | |||||||
							
								
								
									
										40
									
								
								Gemfile.lock
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								Gemfile.lock
									
									
									
									
									
								
							| @@ -1,3 +1,12 @@ | |||||||
|  | GIT | ||||||
|  |   remote: https://github.com/ClearlyClaire/webpush.git | ||||||
|  |   revision: f14a4d52e201128b1b00245d11b6de80d6cfdcd9 | ||||||
|  |   ref: f14a4d52e201128b1b00245d11b6de80d6cfdcd9 | ||||||
|  |   specs: | ||||||
|  |     webpush (0.3.8) | ||||||
|  |       hkdf (~> 0.2) | ||||||
|  |       jwt (~> 2.0) | ||||||
|  |  | ||||||
| GIT | GIT | ||||||
|   remote: https://github.com/chatwoot/devise-secure_password |   remote: https://github.com/chatwoot/devise-secure_password | ||||||
|   revision: d777b04f12652d576b1272b8f39857e3e0b3fc26 |   revision: d777b04f12652d576b1272b8f39857e3e0b3fc26 | ||||||
| @@ -73,8 +82,8 @@ GEM | |||||||
|       zeitwerk (~> 2.3) |       zeitwerk (~> 2.3) | ||||||
|     acts-as-taggable-on (9.0.1) |     acts-as-taggable-on (9.0.1) | ||||||
|       activerecord (>= 6.0, < 7.1) |       activerecord (>= 6.0, < 7.1) | ||||||
|     addressable (2.8.0) |     addressable (2.8.1) | ||||||
|       public_suffix (>= 2.0.2, < 5.0) |       public_suffix (>= 2.0.2, < 6.0) | ||||||
|     administrate (0.17.0) |     administrate (0.17.0) | ||||||
|       actionpack (>= 5.0) |       actionpack (>= 5.0) | ||||||
|       actionview (>= 5.0) |       actionview (>= 5.0) | ||||||
| @@ -360,7 +369,7 @@ GEM | |||||||
|       hana (~> 1.3) |       hana (~> 1.3) | ||||||
|       regexp_parser (~> 2.0) |       regexp_parser (~> 2.0) | ||||||
|       uri_template (~> 0.7) |       uri_template (~> 0.7) | ||||||
|     jwt (2.4.1) |     jwt (2.5.0) | ||||||
|     kaminari (1.2.2) |     kaminari (1.2.2) | ||||||
|       activesupport (>= 4.1.0) |       activesupport (>= 4.1.0) | ||||||
|       kaminari-actionview (= 1.2.2) |       kaminari-actionview (= 1.2.2) | ||||||
| @@ -426,6 +435,14 @@ GEM | |||||||
|     multipart-post (2.2.3) |     multipart-post (2.2.3) | ||||||
|     net-http-persistent (4.0.1) |     net-http-persistent (4.0.1) | ||||||
|       connection_pool (~> 2.2) |       connection_pool (~> 2.2) | ||||||
|  |     net-imap (0.3.1) | ||||||
|  |       net-protocol | ||||||
|  |     net-pop (0.1.2) | ||||||
|  |       net-protocol | ||||||
|  |     net-protocol (0.2.1) | ||||||
|  |       timeout | ||||||
|  |     net-smtp (0.3.3) | ||||||
|  |       net-protocol | ||||||
|     netrc (0.11.0) |     netrc (0.11.0) | ||||||
|     newrelic_rpm (8.9.0) |     newrelic_rpm (8.9.0) | ||||||
|     nio4r (2.5.8) |     nio4r (2.5.8) | ||||||
| @@ -469,7 +486,7 @@ GEM | |||||||
|       method_source (~> 1.0) |       method_source (~> 1.0) | ||||||
|     pry-rails (0.3.9) |     pry-rails (0.3.9) | ||||||
|       pry (>= 0.10.4) |       pry (>= 0.10.4) | ||||||
|     public_suffix (4.0.7) |     public_suffix (5.0.1) | ||||||
|     puma (5.6.4) |     puma (5.6.4) | ||||||
|       nio4r (~> 2.0) |       nio4r (~> 2.0) | ||||||
|     pundit (2.2.0) |     pundit (2.2.0) | ||||||
| @@ -662,6 +679,7 @@ GEM | |||||||
|     time_diff (0.3.0) |     time_diff (0.3.0) | ||||||
|       activesupport |       activesupport | ||||||
|       i18n |       i18n | ||||||
|  |     timeout (0.3.1) | ||||||
|     trailblazer-option (0.1.2) |     trailblazer-option (0.1.2) | ||||||
|     twilio-ruby (5.68.0) |     twilio-ruby (5.68.0) | ||||||
|       faraday (>= 0.9, < 3.0) |       faraday (>= 0.9, < 3.0) | ||||||
| @@ -693,7 +711,7 @@ GEM | |||||||
|       activemodel (>= 6.0.0) |       activemodel (>= 6.0.0) | ||||||
|       bindex (>= 0.4.0) |       bindex (>= 0.4.0) | ||||||
|       railties (>= 6.0.0) |       railties (>= 6.0.0) | ||||||
|     webmock (3.14.0) |     webmock (3.18.1) | ||||||
|       addressable (>= 2.8.0) |       addressable (>= 2.8.0) | ||||||
|       crack (>= 0.3.2) |       crack (>= 0.3.2) | ||||||
|       hashdiff (>= 0.4.0, < 2.0.0) |       hashdiff (>= 0.4.0, < 2.0.0) | ||||||
| @@ -702,9 +720,6 @@ GEM | |||||||
|       rack-proxy (>= 0.6.1) |       rack-proxy (>= 0.6.1) | ||||||
|       railties (>= 5.2) |       railties (>= 5.2) | ||||||
|       semantic_range (>= 2.3.0) |       semantic_range (>= 2.3.0) | ||||||
|     webpush (1.1.0) |  | ||||||
|       hkdf (~> 0.2) |  | ||||||
|       jwt (~> 2.0) |  | ||||||
|     webrick (1.7.0) |     webrick (1.7.0) | ||||||
|     websocket-driver (0.7.5) |     websocket-driver (0.7.5) | ||||||
|       websocket-extensions (>= 0.1.0) |       websocket-extensions (>= 0.1.0) | ||||||
| @@ -779,6 +794,9 @@ DEPENDENCIES | |||||||
|   listen |   listen | ||||||
|   maxminddb |   maxminddb | ||||||
|   mock_redis |   mock_redis | ||||||
|  |   net-imap | ||||||
|  |   net-pop | ||||||
|  |   net-smtp | ||||||
|   newrelic_rpm |   newrelic_rpm | ||||||
|   omniauth-oauth2 |   omniauth-oauth2 | ||||||
|   pg |   pg | ||||||
| @@ -826,12 +844,12 @@ DEPENDENCIES | |||||||
|   web-console |   web-console | ||||||
|   webmock |   webmock | ||||||
|   webpacker (~> 5.4, >= 5.4.3) |   webpacker (~> 5.4, >= 5.4.3) | ||||||
|   webpush |   webpush! | ||||||
|   wisper (= 2.0.0) |   wisper (= 2.0.0) | ||||||
|   working_hours |   working_hours | ||||||
|  |  | ||||||
| RUBY VERSION | RUBY VERSION | ||||||
|    ruby 3.0.4p208 |    ruby 3.1.3p185 | ||||||
|  |  | ||||||
| BUNDLED WITH | BUNDLED WITH | ||||||
|    2.3.16 |    2.3.26 | ||||||
|   | |||||||
| @@ -3,25 +3,25 @@ module SwitchLocale | |||||||
|  |  | ||||||
|   private |   private | ||||||
|  |  | ||||||
|   def switch_locale(&action) |   def switch_locale(&) | ||||||
|     # priority is for locale set in query string (mostly for widget/from js sdk) |     # priority is for locale set in query string (mostly for widget/from js sdk) | ||||||
|     locale ||= locale_from_params |     locale ||= locale_from_params | ||||||
|     # if locale is not set in account, let's use DEFAULT_LOCALE env variable |     # if locale is not set in account, let's use DEFAULT_LOCALE env variable | ||||||
|     locale ||= locale_from_env_variable |     locale ||= locale_from_env_variable | ||||||
|     set_locale(locale, &action) |     set_locale(locale, &) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def switch_locale_using_account_locale(&action) |   def switch_locale_using_account_locale(&) | ||||||
|     locale = locale_from_account(@current_account) |     locale = locale_from_account(@current_account) | ||||||
|     set_locale(locale, &action) |     set_locale(locale, &) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def set_locale(locale, &action) |   def set_locale(locale, &) | ||||||
|     # if locale is empty, use default_locale |     # if locale is empty, use default_locale | ||||||
|     locale ||= I18n.default_locale |     locale ||= I18n.default_locale | ||||||
|     # Ensure locale won't bleed into other requests |     # Ensure locale won't bleed into other requests | ||||||
|     # https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests |     # https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests | ||||||
|     I18n.with_locale(locale, &action) |     I18n.with_locale(locale, &) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def locale_from_params |   def locale_from_params | ||||||
|   | |||||||
| @@ -69,11 +69,11 @@ class ApplicationMailer < ActionMailer::Base | |||||||
|     Current.account = account if account.present? |     Current.account = account if account.present? | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def switch_locale(&action) |   def switch_locale(&) | ||||||
|     locale ||= locale_from_account(Current.account) |     locale ||= locale_from_account(Current.account) | ||||||
|     locale ||= I18n.default_locale |     locale ||= I18n.default_locale | ||||||
|     # ensure locale won't bleed into other requests |     # ensure locale won't bleed into other requests | ||||||
|     # https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests |     # https://guides.rubyonrails.org/i18n.html#managing-the-locale-across-requests | ||||||
|     I18n.with_locale(locale, &action) |     I18n.with_locale(locale, &) | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ class DashboardApp < ApplicationRecord | |||||||
|         'required' => %w[url type], |         'required' => %w[url type], | ||||||
|         'properties' => { |         'properties' => { | ||||||
|           'type' => { 'enum': ['frame'] }, |           'type' => { 'enum': ['frame'] }, | ||||||
|           'url' => { 'type': 'string', 'format' => 'uri' } |           'url' => { :type => 'string', 'format' => 'uri' } | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       'additionalProperties' => false, |       'additionalProperties' => false, | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ class Whatsapp::Providers::WhatsappCloudService < Whatsapp::Providers::BaseServi | |||||||
|       "#{phone_id_path}/messages", |       "#{phone_id_path}/messages", | ||||||
|       headers: api_headers, |       headers: api_headers, | ||||||
|       body: { |       body: { | ||||||
|         messaging_product: 'whatsapp', |         :messaging_product => 'whatsapp', | ||||||
|         'to' => phone_number, |         'to' => phone_number, | ||||||
|         'type' => type, |         'type' => type, | ||||||
|         type.to_s => type_content |         type.to_s => type_content | ||||||
|   | |||||||
| @@ -16,10 +16,10 @@ KillMode=mixed | |||||||
| StandardInput=null | StandardInput=null | ||||||
| SyslogIdentifier=%p | SyslogIdentifier=%p | ||||||
|  |  | ||||||
| Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.0.4/bin:/home/chatwoot/.rvm/gems/ruby-3.0.4@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.0.4/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" | Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.1.3/bin:/home/chatwoot/.rvm/gems/ruby-3.1.3@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.1.3/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" | ||||||
| Environment="PORT=3000" | Environment="PORT=3000" | ||||||
| Environment="RAILS_ENV=production" | Environment="RAILS_ENV=production" | ||||||
| Environment="NODE_ENV=production" | Environment="NODE_ENV=production" | ||||||
| Environment="RAILS_LOG_TO_STDOUT=true" | Environment="RAILS_LOG_TO_STDOUT=true" | ||||||
| Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-3.0.4" | Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-3.1.3" | ||||||
| Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-3.0.4:/home/chatwoot/.rvm/gems/ruby-3.0.4@global" | Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-3.1.3:/home/chatwoot/.rvm/gems/ruby-3.1.3@global" | ||||||
|   | |||||||
| @@ -16,10 +16,10 @@ KillMode=mixed | |||||||
| StandardInput=null | StandardInput=null | ||||||
| SyslogIdentifier=%p | SyslogIdentifier=%p | ||||||
|  |  | ||||||
| Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.0.4/bin:/home/chatwoot/.rvm/gems/ruby-3.0.4@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.0.4/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" | Environment="PATH=/home/chatwoot/.rvm/gems/ruby-3.1.3/bin:/home/chatwoot/.rvm/gems/ruby-3.1.3@global/bin:/home/chatwoot/.rvm/rubies/ruby-3.1.3/bin:/home/chatwoot/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/chatwoot/.rvm/bin:/home/chatwoot/.rvm/bin" | ||||||
| Environment="PORT=3000" | Environment="PORT=3000" | ||||||
| Environment="RAILS_ENV=production" | Environment="RAILS_ENV=production" | ||||||
| Environment="NODE_ENV=production" | Environment="NODE_ENV=production" | ||||||
| Environment="RAILS_LOG_TO_STDOUT=true" | Environment="RAILS_LOG_TO_STDOUT=true" | ||||||
| Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-3.0.4" | Environment="GEM_HOME=/home/chatwoot/.rvm/gems/ruby-3.1.3" | ||||||
| Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-3.0.4:/home/chatwoot/.rvm/gems/ruby-3.0.4@global" | Environment="GEM_PATH=/home/chatwoot/.rvm/gems/ruby-3.1.3:/home/chatwoot/.rvm/gems/ruby-3.1.3@global" | ||||||
|   | |||||||
| @@ -172,7 +172,7 @@ EOF | |||||||
| function install_dependencies() { | function install_dependencies() { | ||||||
|   apt update && apt upgrade -y |   apt update && apt upgrade -y | ||||||
|   apt install -y curl |   apt install -y curl | ||||||
|   curl -sL https://deb.nodesource.com/setup_14.x | bash - |   curl -sL https://deb.nodesource.com/setup_16.x | bash - | ||||||
|   curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - |   curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||||||
|   echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list |   echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||||||
|   apt update |   apt update | ||||||
| @@ -328,8 +328,8 @@ function setup_chatwoot() { | |||||||
|   sudo -i -u chatwoot << EOF |   sudo -i -u chatwoot << EOF | ||||||
|   rvm --version |   rvm --version | ||||||
|   rvm autolibs disable |   rvm autolibs disable | ||||||
|   rvm install "ruby-3.0.4" |   rvm install "ruby-3.1.3" | ||||||
|   rvm use 3.0.4 --default |   rvm use 3.1.3 --default | ||||||
|  |  | ||||||
|   git clone https://github.com/chatwoot/chatwoot.git |   git clone https://github.com/chatwoot/chatwoot.git | ||||||
|   cd chatwoot |   cd chatwoot | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| # pre-build stage | # pre-build stage | ||||||
| FROM ruby:3.0.4-alpine AS pre-builder | FROM ruby:3.1.3-alpine3.16 AS pre-builder | ||||||
|  |  | ||||||
| # ARG default to production settings | # ARG default to production settings | ||||||
| # For development docker-compose file overrides ARGS | # For development docker-compose file overrides ARGS | ||||||
| @@ -61,11 +61,12 @@ RUN if [ "$RAILS_ENV" = "production" ]; then \ | |||||||
|   fi |   fi | ||||||
|  |  | ||||||
| # Remove unnecessary files | # Remove unnecessary files | ||||||
| RUN rm -rf /gems/ruby/3.0.0/cache/*.gem \ | RUN rm -rf /gems/ruby/3.1.0/cache/*.gem \ | ||||||
|   && find /gems/ruby/3.0.0/gems/ \( -name "*.c" -o -name "*.o" \) -delete |   && find /gems/ruby/3.1.0/gems/ \( -name "*.c" -o -name "*.o" \) -delete | ||||||
|  |  | ||||||
| # final build stage | # final build stage | ||||||
| FROM ruby:3.0.4-alpine | FROM ruby:3.1.3-alpine3.16 | ||||||
|  |  | ||||||
|  |  | ||||||
| ARG BUNDLE_WITHOUT="development:test" | ARG BUNDLE_WITHOUT="development:test" | ||||||
| ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} | ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} | ||||||
|   | |||||||
| @@ -278,7 +278,7 @@ RSpec.describe 'Api::V1::Accounts::MacrosController', type: :request do | |||||||
|                                 { 'action_name' => 'snooze_conversation' }, |                                 { 'action_name' => 'snooze_conversation' }, | ||||||
|                                 { 'action_name' => 'assign_agent', 'action_params' => [user_1.id] }, |                                 { 'action_name' => 'assign_agent', 'action_params' => [user_1.id] }, | ||||||
|                                 { 'action_name' => 'send_message', 'action_params' => ['Send this message.'] }, |                                 { 'action_name' => 'send_message', 'action_params' => ['Send this message.'] }, | ||||||
|                                 { 'action_name' => 'add_private_note', 'action_params': ['We are sending greeting message to customer.'] } |                                 { 'action_name' => 'add_private_note', :action_params => ['We are sending greeting message to customer.'] } | ||||||
|                               ]) |                               ]) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ FactoryBot.define do | |||||||
|         'type' => 'message_create', |         'type' => 'message_create', | ||||||
|         'id' => '123', |         'id' => '123', | ||||||
|         'message_create' => { |         'message_create' => { | ||||||
|           target: { 'recipient_id' => '1' }, |           :target => { 'recipient_id' => '1' }, | ||||||
|           'sender_id' => '2', |           'sender_id' => '2', | ||||||
|           'source_app_id' => '268278', |           'source_app_id' => '268278', | ||||||
|           'message_data' => { |           'message_data' => { | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ RSpec.describe Webhooks::LineEventsJob, type: :job do | |||||||
|   subject(:job) { described_class.perform_later(params: params) } |   subject(:job) { described_class.perform_later(params: params) } | ||||||
|  |  | ||||||
|   let!(:line_channel) { create(:channel_line) } |   let!(:line_channel) { create(:channel_line) } | ||||||
|   let!(:params) { { line_channel_id: line_channel.line_channel_id, 'line' => { test: 'test' } } } |   let!(:params) { { :line_channel_id => line_channel.line_channel_id, 'line' => { test: 'test' } } } | ||||||
|   let(:post_body) { params.to_json } |   let(:post_body) { params.to_json } | ||||||
|   let(:signature) { Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), line_channel.line_channel_secret, post_body)) } |   let(:signature) { Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), line_channel.line_channel_secret, post_body)) } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ RSpec.describe Webhooks::TelegramEventsJob, type: :job do | |||||||
|   subject(:job) { described_class.perform_later(params) } |   subject(:job) { described_class.perform_later(params) } | ||||||
|  |  | ||||||
|   let!(:telegram_channel) { create(:channel_telegram) } |   let!(:telegram_channel) { create(:channel_telegram) } | ||||||
|   let!(:params) { { bot_token: telegram_channel.bot_token, 'telegram' => { test: 'test' } } } |   let!(:params) { { :bot_token => telegram_channel.bot_token, 'telegram' => { test: 'test' } } } | ||||||
|  |  | ||||||
|   it 'enqueues the job' do |   it 'enqueues the job' do | ||||||
|     expect { job }.to have_enqueued_job(described_class) |     expect { job }.to have_enqueued_job(described_class) | ||||||
|   | |||||||
| @@ -63,8 +63,8 @@ describe Whatsapp::IncomingMessageService do | |||||||
|           'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }], |           'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }], | ||||||
|           'messages' => [{ |           'messages' => [{ | ||||||
|             'errors' => [{ 'code': 131_051, 'title': 'Message type is currently not supported.' }], |             'errors' => [{ 'code': 131_051, 'title': 'Message type is currently not supported.' }], | ||||||
|             'from': '2423423243', 'id': 'wamid.SDFADSf23sfasdafasdfa', |             :from => '2423423243', :id => 'wamid.SDFADSf23sfasdafasdfa', | ||||||
|             'timestamp': '1667047370', 'type': 'unsupported' |             :timestamp => '1667047370', :type => 'unsupported' | ||||||
|           }] |           }] | ||||||
|         }.with_indifferent_access |         }.with_indifferent_access | ||||||
|  |  | ||||||
| @@ -131,7 +131,7 @@ describe Whatsapp::IncomingMessageService do | |||||||
|         params = { |         params = { | ||||||
|           'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }], |           'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }], | ||||||
|           'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa', |           'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa', | ||||||
|                            'interactive': { |                            :interactive => { | ||||||
|                              'button_reply': { |                              'button_reply': { | ||||||
|                                'id': '1', |                                'id': '1', | ||||||
|                                'title': 'First Button' |                                'title': 'First Button' | ||||||
| @@ -195,11 +195,11 @@ describe Whatsapp::IncomingMessageService do | |||||||
|           'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }], |           'contacts' => [{ 'profile' => { 'name' => 'Sojan Jose' }, 'wa_id' => '2423423243' }], | ||||||
|           'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa', |           'messages' => [{ 'from' => '2423423243', 'id' => 'SDFADSf23sfasdafasdfa', | ||||||
|                            'location' => { 'id' => 'b1c68f38-8734-4ad3-b4a1-ef0c10d683', |                            'location' => { 'id' => 'b1c68f38-8734-4ad3-b4a1-ef0c10d683', | ||||||
|                                            'address': 'San Francisco, CA, USA', |                                            :address => 'San Francisco, CA, USA', | ||||||
|                                            'latitude': 37.7893768, |                                            :latitude => 37.7893768, | ||||||
|                                            'longitude': -122.3895553, |                                            :longitude => -122.3895553, | ||||||
|                                            'name': 'Bay Bridge', |                                            :name => 'Bay Bridge', | ||||||
|                                            'url': 'http://location_url.test' }, |                                            :url => 'http://location_url.test' }, | ||||||
|                            'timestamp' => '1633034394', 'type' => 'location' }] |                            'timestamp' => '1633034394', 'type' => 'location' }] | ||||||
|         }.with_indifferent_access |         }.with_indifferent_access | ||||||
|         described_class.new(inbox: whatsapp_channel.inbox, params: params).perform |         described_class.new(inbox: whatsapp_channel.inbox, params: params).perform | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ RSpec.configure do |config| | |||||||
|  |  | ||||||
|   config.shared_context_metadata_behavior = :apply_to_host_groups |   config.shared_context_metadata_behavior = :apply_to_host_groups | ||||||
|  |  | ||||||
|   def with_modified_env(options, &block) |   def with_modified_env(options, &) | ||||||
|     ClimateControl.modify(options, &block) |     ClimateControl.modify(options, &) | ||||||
|   end |   end | ||||||
| end | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Vishnu Narayanan
					Vishnu Narayanan