## cwctl
- allow setting up only web/worker deployments for linux
- allow upgrades to a custom branch - experimental
```
Usage Examples:
# Convert existing full deployment to web-only (for web ASG)
cwctl --convert web
# Convert existing full deployment to worker-only (for worker ASG)
cwctl --convert worker
# Convert specialized deployment back to full
cwctl --convert full
# Fresh installs still work as before
cwctl -i --web-only # New web-only install
cwctl -i --worker-only # New worker-only instal
```
- Upgrading to custom branches is risky, as other dependencies like node
or db might have changed
```
cwctl --upgrade # Upgrade to master branch - default
cwctl -U v4.3.0 # Upgrade to specific release branch
cwctl --upgrade feat/new-feature # Upgrade to feature branch
```
# Pull Request Template
## Description
Multiple versions of postgres were getting installed, conflicting with
the `pgvector` extension being installed. This PR sets the version to
`16` for all postgres dependencies ensuring a single version is
installed.
## Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
## How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration.
## Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
Starting v4.0, pgvector support is mandatory. This PR adds pgvector
support for new/existing Linux installations via cwctl.
- Install `pgvector` for new deployments via cwctl
- Show a warning before upgrading to 4.0 or above for existing
installations. The user is expected to install `pgvector` based on their
version of self-hosted Postgres or managed Postgres.
- fix pip install during cwctl upgrade in `ubuntu 24.04`
- add logs during pnpm installation
- fix `pnpm` installation during upgrade
Ref
> PEP 668 specification in Ubuntu 24.04, which marks the Python
environment as "externally managed." This means it restricts using pip
for system-wide package installations to avoid conflicts with
system-managed packages.
- Switch to `pnpm` from `yarn`
Changelog
----
- add support for `pnpm` `vite` build for chatwoot 4.0
- for new installations, install pnpm and vite
- for existing installations, remove `node_modules` and install `pnpm`
Note: `yarn` is not removed when upgrading existing installations. If
you want to rollback to an older version of Chatwoot(pre 4.0),
```
sudo -i -u chatwoot
cd chatwoot
git checkout <tag> # tag is the version of chatwoot you want to rollback to
rm -rf node_modules # remove deps installed via pnpm
# Update dependencies
bundle
yarn
# Recompile the assets
rake assets:precompile RAILS_ENV=production
# Migrate the database schema
RAILS_ENV=production bundle exec rake db:migrate
exit
```
The `add user` utility was updated, and the `--disabled-login` behavior changed in Ubuntu 24.04. This set the login shell to `/sbin/nologin,` which broke the `cwctl` installation flow.
ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625758
Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
* 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
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-
* 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>
* 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
* 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
* 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>
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.
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
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.