mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 10:42:38 +00:00
feat: support vite build for linux installations(cwctl) (#10231)
- 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 ```
This commit is contained in:
@@ -1 +1 @@
|
||||
3.9.0
|
||||
3.13.0
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.8.0
|
||||
3.0.0
|
||||
|
||||
@@ -19,7 +19,7 @@ fi
|
||||
# option --output/-o requires 1 argument
|
||||
LONGOPTS=console,debug,help,install,Install:,logs:,restart,ssl,upgrade,webserver,version
|
||||
OPTIONS=cdhiI:l:rsuwv
|
||||
CWCTL_VERSION="2.8.0"
|
||||
CWCTL_VERSION="3.0.0"
|
||||
pg_pass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 15 ; echo '')
|
||||
CHATWOOT_HUB_URL="https://hub.2.chatwoot.com/events"
|
||||
|
||||
@@ -173,8 +173,6 @@ EOF
|
||||
function install_dependencies() {
|
||||
apt update && apt upgrade -y
|
||||
apt install -y curl
|
||||
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
|
||||
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
|
||||
mkdir -p /etc/apt/keyrings
|
||||
@@ -189,9 +187,10 @@ function install_dependencies() {
|
||||
libxml2-dev libxslt1-dev file g++ gcc autoconf build-essential \
|
||||
libssl-dev libyaml-dev libreadline-dev gnupg2 \
|
||||
postgresql-client redis-tools \
|
||||
nodejs yarn patch ruby-dev zlib1g-dev liblzma-dev \
|
||||
nodejs patch ruby-dev zlib1g-dev liblzma-dev \
|
||||
libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev sudo \
|
||||
libvips python3-pip
|
||||
npm install -g pnpm
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
@@ -343,7 +342,7 @@ function setup_chatwoot() {
|
||||
cd chatwoot
|
||||
git checkout "$BRANCH"
|
||||
bundle
|
||||
yarn
|
||||
pnpm i
|
||||
|
||||
cp .env.example .env
|
||||
sed -i -e "/SECRET_KEY_BASE/ s/=.*/=$secret/" .env
|
||||
@@ -354,7 +353,7 @@ function setup_chatwoot() {
|
||||
sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env
|
||||
echo -en "\nINSTALLATION_ENV=linux_script" >> ".env"
|
||||
|
||||
rake assets:precompile RAILS_ENV=production NODE_OPTIONS=--openssl-legacy-provider
|
||||
rake assets:precompile RAILS_ENV=production NODE_OPTIONS="--max-old-space-size=4096 --openssl-legacy-provider"
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -793,6 +792,27 @@ function upgrade_node() {
|
||||
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Install pnpm - this replaces yarn starting from Chatwoot 4.0
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# None
|
||||
# Outputs:
|
||||
# None
|
||||
##############################################################################
|
||||
function get_pnpm() {
|
||||
# if pnpm is already installed, return
|
||||
if command -v pnpm &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
npm install -g pnpm
|
||||
sudo -i -u chatwoot << "EOF"
|
||||
cd chatwoot
|
||||
rm -rf node_modules
|
||||
EOF
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Upgrade an existing installation to latest stable version(-u/--upgrade)
|
||||
# Globals:
|
||||
@@ -810,6 +830,7 @@ function upgrade() {
|
||||
upgrade_prereq
|
||||
upgrade_redis
|
||||
upgrade_node
|
||||
get_pnpm
|
||||
sudo -i -u chatwoot << "EOF"
|
||||
|
||||
# Navigate to the Chatwoot directory
|
||||
@@ -826,10 +847,10 @@ function upgrade() {
|
||||
|
||||
# Update dependencies
|
||||
bundle
|
||||
yarn
|
||||
pnpm -i
|
||||
|
||||
# Recompile the assets
|
||||
rake assets:precompile RAILS_ENV=production NODE_OPTIONS=--openssl-legacy-provider
|
||||
rake assets:precompile RAILS_ENV=production NODE_OPTIONS="--max-old-space-size=4096 --openssl-legacy-provider"
|
||||
|
||||
# Migrate the database schema
|
||||
RAILS_ENV=production POSTGRES_STATEMENT_TIMEOUT=600s bundle exec rake db:migrate
|
||||
|
||||
Reference in New Issue
Block a user