Commit Graph

34 Commits

Author SHA1 Message Date
Shivam Mishra
e2a6dc3e04 chore: Upgrade Node.js to v20 (#7759)
Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2023-08-28 19:20:35 +05:30
Vishnu Narayanan
590ce788b9 fix: update linux script(cwctl) to account for rails7 upgrade (#7106)
* chore: modify cwctl to fetch latest redis version on new installations

* fix: add libvips for activestorage imageprocessing support

* chore: update cwctl version

* feat: upgrade redis and install libvps for existing installations
2023-05-18 16:53:47 +05:30
Sojan Jose
022383d942 chore: Upgrade to Rails 7 (#6719)
fixes: #6736
2023-05-06 10:44:52 +05:30
Sojan Jose
7cbf1857e4 chore: Set statement timeout for Postgres (#6641)
By default, Rails does not set a timeout on database statements. For example, this will run for a full day, even if your ruby process goes away. But it's configurable in the database.yml with the statement_timeout variable.

Hence we are enforcing a 14s timeout by default. Migration commands inside chatwoot will run with a 10 minutes timeout. For specific cases like migrations, we can override this timeout using the environment variable POSTGRES_STATEMENT_TIMEOUT while starting a new rails console.

Test the timeouts from the rails console using.

```
ActiveRecord::Base.connection.execute("SELECT pg_sleep(15);")
```

ref: https://github.com/ankane/the-ultimate-guide-to-ruby-timeouts#postgresql
ref: https://til.hashrocket.com/posts/b44baf657d-railspg-statement-timeout-
2023-03-13 18:34:18 +05:30
Vishnu Narayanan
b1ec67d110 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>
2023-01-24 23:55:07 +05:30
opencartcomvn
487d90207b fix: Update node version in setup_20.04.sh (#5986)
Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
2023-01-23 16:34:45 +05:30
Sojan Jose
72f206025a chore: Fix connection pool (#6005)
We want to allocate as much database connection to the pool to match the sidekiq concurrency configuration.
ref: https://maxencemalbois.medium.com/the-ruby-on-rails-database-connections-pool-4ce1099a9e9f

fixes: #6004
2023-01-16 17:50:23 +05:30
David Kubeš
9ea43a2678 chore: Improve Nginx settings for speed and security (#5144)
* fix: Fixes #5138

* Move to helper function

* Improve Nginx settings

* chore: set ssl_prefer_server_ciphers to off
ssl_prefer_server_ciphers should be set to  `off` in a modern context.

ref: https://ssl-config.mozilla.org/#server=nginx&version=1.17.7&config=modern&openssl=1.1.1k&guideline=5.6

Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com>
2022-10-03 17:43:50 +05:30
Vishnu Narayanan
5957edc76b feat: abort cwctl upgrade if custom code changes detected (#5329)
* feat: abort cwctl upgrade if custom code changes detected

* fix: cwctl exit handler on upgrade

* chore: update cwctl version
2022-08-23 18:56:39 +05:30
Vishnu Narayanan
18d9bd8359 feat: add -I option to cwctl and modify -i option (#5045)
* feat: add -I option to cwctl and modify -i option

Modify -i option to drop support for installing specified branch
-i will always default to installing the latest stable branch(master)

Add -I option to support installing Chatwoot with a custom branch

* chore: minor fixes
2022-07-15 16:17:52 +05:30
Vishnu Narayanan
b7c2159274 chore: Improve output of cwctl -w option (#5037) 2022-07-14 14:13:33 +05:30
Vishnu Narayanan
1bb9556c86 fix: non-zero exit on --logs and handle no opts (#5006)
* fix: non-zero exit on --logs and handle no opts

* chore: update cwctl version + add utm_source
2022-07-08 18:49:27 +05:30
Vishnu Narayanan
f2dd88223f feat: add chatwoot ctl(cwctl) cli tool (#4836)
* chore: Add log messages for stages skipped during installation

* feat: allow chatwoot user to start/stop/restart chatwoot service

* feat: init options support

* feat: add option support to linux install script [c|h|i|l|s|u|wi]

Install/Update/Configure/Manage your Chatwoot installation
Example: cwctl -i master
Example: cwctl -l web
Example: cwctl --logs worker
Example: cwctl --upgrade
Example: cwctl -c

Installation/Upgrade:
  -i, --install             install Chatwoot with the git branch
specified
  -u, --upgrade             upgrade Chatwoot to latest version
  -s, --ssl                 fetch and install ssl certificates using
LetsEncrypt
  -w, --webserver           install and configure Nginx webserver

Management:
  -c, --console             open ruby console
  -l, --logs                tail logs from Chatwoot. Supported values
include web/worker.

Miscellaneous:
  -h, --help                display this help text and exit

* feat: add cwctl to PATH

* feat: add -v to cwctl

* chore: switch db migration to db:chatwoot_prepare

* fix: reload systemd files after update

* fix: improve -s -w cwctl options

* chore: throw error if run without options

Signed-off-by: Vishnu Narayanan <vishnu@chatwoot.com>

* feat: add -d/--debug option to cwctl

* fix: remove hardcoded ruby version in cwctl --upgrade

* chore: improve cwctl -v function

* fix: disable cwctl selfupdate

* chore: cleanup

* feat: allow chatwoot user to run cwctl

* chore: cwctl improve formatting for log messages

* fix: variable expansion inside heredoc

* feat: save pg_pass to file to support idempotency

One of the things preventing idempotency was the postgres
password generated at run-time to setup postgres initally.

This commit saves the password to the file if postgres setup function
is executed and reloads on future re-runs if needed.

* chore: formatting

* chore: add cwctl promotion message at the end of installation

* feat: add comments

* chore: add chatwoot and cwctl version files

* feat: add func to get latest chatwoot version

* chore: formatting

* feat: add --restart option to cwctl

* chore: update --help with restart option details

* chore: minor improvements to --restart
2022-06-22 23:39:01 +05:30
Vishnu Narayanan
43a0b4c039 fix: command execution in heredoc comment (#4783) 2022-06-02 19:51:50 +05:30
Vishnu Narayanan
568c30e93e chore: Update ruby and docker base image to 3.0.4 (#4693)
* chore: Update ruby version to 3.0.4

* chore: update ruby version in docker workflow

* chore: update ruby version to 3.1.2

* Upgrade vue-jest to remove deasync

* Revert to 3.0.4 to see if deasync issue is fixed

* fix: script failure if pg/redis not opted in

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2022-05-27 17:33:24 +05:30
Vishnu Narayanan
22d22cf4c3 feat: Improve Linux installation experience (#4713)
* feat: improve linux install script

* feat: setup logging and reduce verboseness

- redirect output/error to logfile
- reduce verboseness in main script exection
- trap non-zero exit

* chore: remove debug logging

* feat: fix exit handler

* improve legibility

* Apply suggestions from code review

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>

* chore: improve formatting

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2022-05-25 12:30:00 +05:30
Vishnu Narayanan
3813b3b372 feat: make linux script installation non-interactive (#4355)
This PR changes the LetsEncrypt behaviour to be non-interactive. Earlier, the installation flow was waiting for user input at the SSL cert generation stage. With this change, once the user confirms completes the initial selection, the installation can be completed unattended.
2022-04-01 00:34:50 +05:30
Frederik Kriewitz
17018d392d chore: update deployment scripts to install sudo (#3841)
* Update setup_20.04.sh to install sudo
* Update setup_18.04.sh to install sudo
2022-01-27 16:55:27 +05:30
Vishnu Narayanan
7986d61b6f feat: allow users to select components to install when using linux script (#3528)
Provide a choice to select the components to install. The script
should be able to just install chatwoot alone. Postgres, redis,
SSL certs via letsencrypt and nginx as a webserver should be
installed after confirmation.

Fixes: #3513
2021-12-14 18:26:57 +05:30
Vishnu Narayanan
ac46d0c855 feat: add domain check prompt for linux installation script (#3282)
- move domain check to beginning to have all user input at the start
- notify user to point DNS if they plan to use a domain with Chatwoot
2021-10-25 21:56:26 +05:30
Pranav Raj S
6de964a0bd fix: HTTP parser error in linux installations (#3232) 2021-10-18 14:20:48 +05:30
Vishnu Narayanan
2c381d726d chore: Update installation env value for linux script (#3005) 2021-09-14 12:59:22 +05:30
Vishnu Narayanan
319412f6dc feat: include installation method in data to cw hub (#2831) 2021-08-16 23:35:00 +05:30
Sojan Jose
ab54d9c629 chore: Upgrade rails and ruby versions (#2400)
ruby version: 3.0.2
rails version: 6.1.4
2021-08-03 20:11:52 +05:30
Vishnu Narayanan
4d45ac3bfc chore: Switch from addgroup to adduser (#2688) 2021-07-22 19:49:12 +05:30
Sojan Jose
fa37f8e185 chore: Support Github Codespaces (#2510)
Note: Update the ruby version 2.7.3. For production Linux VM, install 2.7.3 and follow the upgrade steps as shown in https://www.chatwoot.com/docs/self-hosted/deployment/linux-vm#upgrading-to-a-newer-version-of-chatwoot
2021-06-29 19:18:10 +05:30
Vishnu Narayanan
bed1979986 fix: rvm gpg key issue (#2514)
sks-keyserver gpg pool is now deprecated due to GDPR issues and is
no longer reliable. Switching to use ubuntu keyserver for the time
being as this is the only server returning rvm maintainers gpg keys.
2021-06-25 21:19:08 +05:30
Sojan Jose
5daf970a87 chore: Generate nginx config using chatwoot installation scripts (#1687)
Co-authored-by: iriseden <iriseden@localhost.localdomain>
Co-authored-by: iriseden <ad.chabod@iriseden.eu>
2021-02-17 20:03:43 +05:30
Pranav Raj S
5e190aad3c fix: Check if the argument is an empty string (#1474) 2020-12-05 00:56:33 +05:30
Tristan Roscoe
88f5f825b7 fix: Add branch variable to Linux VM setup script (#1462) 2020-11-27 13:37:57 +05:30
Adam Zysko
61d26f71c1 chore: bump ruby from 2.7.1 to 2.7.2 (#1426)
Closes:  #1399
2020-11-20 15:38:13 +05:30
Pranav Raj S
54214c73aa fix: Update production installation setup script for Ubuntu 20.04 (#1364)
Setup script for Ubuntu 20.04

Fixes: #1364
2020-10-25 22:40:13 +05:30
Sojan Jose
05ea6308f2 Chore: Update ruby and rails versions (#831) 2020-05-08 12:13:23 +05:30
Vishnu Narayanan
5bd7a4c511 Feature: Add installation script (#776)
* Feature: Add installation script
* Add systemd service files for chatwoot
* Enable static file serving by rails on prod
* Fix systemd files path
2020-05-05 01:59:38 +05:30