rocketchat / install.sh Goto Github PK
View Code? Open in Web Editor NEWcommand line tool to help you install and configure a RocketChat server in a Linux host
Home Page: https://rocket.chat/docs/installation/rocketchatctl/
command line tool to help you install and configure a RocketChat server in a Linux host
Home Page: https://rocket.chat/docs/installation/rocketchatctl/
root@Rocket-Chat:
# rocketchatctl check-updates# rocketchatctl update
Current update available for RocketChat server: from 1.2.1 to 1.3.2
root@Rocket-Chat:
Current update available for RocketChat server: from 1.2.1 to 1.3.2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 223 100 223 0 0 541 0 --:--:-- --:--:-- --:--:-- 541
100 136M 100 136M 0 0 63.6M 0 0:00:02 0:00:02 --:--:-- 98.7M
npm WARN deprecated [email protected]: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.[email protected] install /tmp/bundle/programs/server/node_modules/fibers
node build.js || nodejs build.js
linux-x64-57
exists; testing
Binary is fine; exiting
npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd %s %s (wd=%s) meteor-dev-bundle@ node npm-rebuild.js /tmp/bundle/programs/server
added 150 packages in 21.939s
Waiting up to 60 seconds for RocketChat server to be active ... 2
Waiting up to 60 seconds for RocketChat server to be active ... 4
Waiting up to 60 seconds for RocketChat server to be active ... 6
Waiting up to 60 seconds for RocketChat server to be active ... 8
Waiting up to 60 seconds for RocketChat server to be active ... 10
Waiting up to 60 seconds for RocketChat server to be active ... 12
Waiting up to 60 seconds for RocketChat server to be active ... 14
Waiting up to 60 seconds for RocketChat server to be active ... 16
Waiting up to 60 seconds for RocketChat server to be active ... 18
Waiting up to 60 seconds for RocketChat server to be active ... 20
Waiting up to 60 seconds for RocketChat server to be active ... 22
Waiting up to 60 seconds for RocketChat server to be active ... 24
Waiting up to 60 seconds for RocketChat server to be active ... 26
Waiting up to 60 seconds for RocketChat server to be active ... 28
Waiting up to 60 seconds for RocketChat server to be active ... 30
Waiting up to 60 seconds for RocketChat server to be active ... 32
Waiting up to 60 seconds for RocketChat server to be active ... 34
Waiting up to 60 seconds for RocketChat server to be active ... 36
Waiting up to 60 seconds for RocketChat server to be active ... 38
Waiting up to 60 seconds for RocketChat server to be active ... 40
Waiting up to 60 seconds for RocketChat server to be active ... 42
Waiting up to 60 seconds for RocketChat server to be active ... 44
Waiting up to 60 seconds for RocketChat server to be active ... 46
Waiting up to 60 seconds for RocketChat server to be active ... 48
Waiting up to 60 seconds for RocketChat server to be active ... 50
Waiting up to 60 seconds for RocketChat server to be active ... 52
Waiting up to 60 seconds for RocketChat server to be active ... 54
Waiting up to 60 seconds for RocketChat server to be active ... 56
Waiting up to 60 seconds for RocketChat server to be active ... 58
Waiting up to 60 seconds for RocketChat server to be active ... 60
Error in updated RocketChat server health check, restoring backup.
As mentioned in the margin in #33, we often see the "current_rocketchat_version
" check fail (on Debian 9.13) when running "rocketchatctl check-updates
" and "rocketchatctl update
", and that seems to cause additional problems, like in this case (first without debug output, then using "bash -x
"):
[… rocketchat has just been backed up and was restarted by the backup command …]
trolls:~ # rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
/usr/local/bin/rocketchatctl: line 900: [: 3.9.0: unary operator expected
Could not determine if updates available for RocketChat server.
[… immediate retry with debugging enabled …]
trolls:~ # bash -x rocketchatctl update
+ set -o nounset
+ main update
+ local VERSION=latest
+ local -r NODE_VERSION=v12.14.0
+ local -r NPM_VERSION=6.13.4
+ local MONGO_VERSION=
+ local -r 'MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01'
+ local -r 'MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01'
+ local ROCKETCHAT_DOWNLOAD_URL=https://releases.rocket.chat/latest/download
+ local -r NODE_DEB_DOWNLOAD_URL=https://deb.nodesource.com/setup_12.x
+ local -r NODE_RPM_DOWNLOAD_URL=https://rpm.nodesource.com/setup_12.x
+ local -r ROCKETCHAT_DIR=/opt/Rocket.Chat
+ local -r ROCKETCHAT_DIR_UPDATE=/opt/Rocket.Chat.bkup
+ local -r ROCKET_VERSION_INFO_URL=https://releases.rocket.chat/latest/info
+ local -r ROCKETCHATCTL_DOWNLOAD_URL=https://raw.githubusercontent.com/RocketChat/install.sh/master/rocketchatctl
+ local -r ROCKETCHATCTL_DIRECTORY=/usr/local/bin
+ local -r ROCKETCHATCTL_TEMP_DIRECTORY=/tmp
+ local -r TRAEFIK_DOWNLOAD_URL=https://github.com/containous/traefik/releases/download/v1.7.20/traefik
+ local -r CADDY_DOWNLOAD_URL=https://github.com/mholt/caddy/releases/download/v1.0.0/caddy_v1.0.0_linux_amd64.tar.gz
+ local distro=
+ local distro_version=
+ local install_node=0
+ local install_mongo=0
+ local rocket_healthy=0
+ local ROOT_URL=
+ local PORT=3000
+ local BIND_IP=0.0.0.0
+ local bind_loopback=true
+ local webserver=none
+ local install_node_arg=0
+ local use_mongo_arg=0
+ local webserver_arg=0
+ local rocket_mail_arg=0
+ local bind_loopback_arg=0
+ local rocket_domain=
+ local configure_rocketchat=0
+ local configure_webserver=0
+ local root_url_arg=0
++ date +%s
+ local sufix=1606910670
+ local node_path=/usr/bin/node
+ local backup_dir=/tmp
+ local update_node=0
+ '[' 0 -ne 0 ']'
+ '[' 1 -lt 1 ']'
+ [[ -t 0 ]]
+ case $1 in
+ os_supported
+ get_os_distro
+ '[' -r /etc/os-release ']'
++ . /etc/os-release
+++ PRETTY_NAME='Debian GNU/Linux 9 (stretch)'
+++ NAME='Debian GNU/Linux'
+++ VERSION_ID=9
+++ VERSION='9 (stretch)'
+++ VERSION_CODENAME=stretch
+++ ID=debian
+++ HOME_URL=https://www.debian.org/
+++ SUPPORT_URL=https://www.debian.org/support
+++ BUG_REPORT_URL=https://bugs.debian.org/
++ echo debian
+ distro=debian
++ . /etc/os-release
+++ PRETTY_NAME='Debian GNU/Linux 9 (stretch)'
+++ NAME='Debian GNU/Linux'
+++ VERSION_ID=9
+++ VERSION='9 (stretch)'
+++ VERSION_CODENAME=stretch
+++ ID=debian
+++ HOME_URL=https://www.debian.org/
+++ SUPPORT_URL=https://www.debian.org/support
+++ BUG_REPORT_URL=https://bugs.debian.org/
++ echo 9
+ distro_version=9
+ case "$distro" in
+ [[ 9 =~ ((9|10)) ]]
+ do_check_updates
+ get_rocketchat_latest_version
+ command_exists curl
+ command -v curl
++ curl https://releases.rocket.chat/latest/info
++ awk '-F"' '{print $2}'
++ awk -F: '{print $2}'
++ grep -w tag
+ latest_rocketchat_version=3.9.0
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ awk -F= '{print $3}'
++ grep PORT
++ cat /lib/systemd/system/rocketchat.service
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ print_make_backup
+ echo 'Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.'
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
+ [[ '' =~ ^([0-2]\..\..)$ ]]
+ version_gt 3.9.0
++ head -n 1
++ printf '%s\n' 3.9.0
++ sort -V
+ test 3.9.0 '!=' 3.9.0
+ '[' 3.9.0 == ']'
/usr/local/bin/rocketchatctl: line 900: [: 3.9.0: unary operator expected
+ print_check_updates_error_and_exit
+ errcho 'Could not determine if updates available for RocketChat server.'
+ echo 'Could not determine if updates available for RocketChat server.'
Could not determine if updates available for RocketChat server.
+ exit 1
I'm going to demonstrate the behavior with the following script, which is largely copy-and-pasted from "rocketchatctl
", plus an "until
" patch I'm suggesting (ignore the "--interface lo
", that's a patch for another day):
trolls:~ # cat test_version.sh
#!/bin/bash
PORT=$(cat /lib/systemd/system/rocketchat.service |grep PORT |awk -F= '{print $3}')
current_rocketchat_version=""
until [ -n "$current_rocketchat_version" ]; do
current_rocketchat_version=$(curl --interface lo http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
sleep 1
done
trolls:~ #
When running this on our very much non-beefy stage system, it behaves as follows:
trolls:~ # bash -x test_version.sh ; systemctl restart rocketchat.service ; bash -x test_version.sh
[…can't reproduce the problem when rocketchat is still running…]
++ cat /lib/systemd/system/rocketchat.service
++ awk -F= '{print $3}'
++ grep PORT
+ PORT=3000
+ current_rocketchat_version=
+ '[' -n '' ']'
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=3.9.0
+ sleep 1
+ '[' -n 3.9.0 ']'
[…restart happens here…]
++ cat /lib/systemd/system/rocketchat.service
++ awk -F= '{print $3}'
++ grep PORT
+ PORT=3000
+ current_rocketchat_version=
+ '[' -n '' ']'
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ sleep 1
+ '[' -n '' ']'
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ sleep 1
[…4 minutes 30 seconds later, when Rocket.Chat has finished starting up…]
+ '[' -n '' ']'
++ cut '-d"' -f4
++ curl --interface lo http://localhost:3000/api/info
+ current_rocketchat_version=3.9.0
+ sleep 1
+ '[' -n 3.9.0 ']'
trolls:~ #
So, I suggest a patch similar to the following:
--- /usr/local/bin/rocketchatctl 2020-12-01 08:14:38.872413023 +0000
+++ /usr/local/bin/rocketchatctl.2020-12-02.issue-34.patch 2020-12-02 16:52:39.787651510 +0000
@@ -757,7 +757,11 @@
get_rocketchat_current_version(){
if systemctl status rocketchat > /dev/null 2>&1; then
PORT=$(cat /lib/systemd/system/rocketchat.service |grep PORT |awk -F= '{print $3}')
- current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
+ current_rocketchat_version=""
+ until [ -n "$current_rocketchat_version" ]; do
+ current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
+ sleep 1
+ done
else
print_rocketchat_not_running_error_and_exit
fi
I believe (but I'm not sure) we've also in the past experienced this problem during the post-update startup wait period.
install should fail when latest info cannot be fetched or parsed. See also #55
Starting in version 4.2, MongoDB removes the deprecated MMAPv1 storage engine. WiredTiger has been the default since MongoDB 3.2.
Script should be updated to use WiredTiger.
MongoDB recently deprecated the mongo
command in favor of the more advanced shell command mongosh
. As a result, when installing RocketChat with the following args results in an error for the mongo
command used for instantiating the replica set.
Since the installer attempts to install the latest version of mongoDB it is currently selecting v 6.0.0, and I'm installing Rocket Chat version 5.0.0
./rocketchatctl install --version=5.0.0 --webserver=none
./rocketchatctl: line 431: mongo: command not found
The function with line 431:
initiate_and_start_mongo() {
systemctl daemon-reload
systemctl enable mongod
systemctl start mongod
if [[ -n $(pgrep mongod) ]]; then
mongo --eval "printjson(rs.initiate())" >&2
fi
}
This occurs when using the current version of the installer script, which has checksums as follows:
SHA256(rocketchatctl)= 02de8041f43cb37157d81e8c3290f938cc4e7ff53ce2e6674a6dff2ea2309804
MD5(rocketchatctl)= cf053fe64c3a196aca2b79be6a035abd
Commit hash: https://github.com/RocketChat/install.sh/commit/c0e4be7b412cddf234fb43a67e3ce1643b202f2b
mongosh
instead of mongo
for the same command.Since this uses traefik or caddy, is nginx needed as a service to wait for?
[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.service
https://github.com/RocketChat/install.sh/blob/master/rocketchatctl#L401
rocketchatctl update
fails with "Error: node version was not updated correctly. Cancelling ..." The reason is wrong check_node_major_version
function, it has
major_version=${NODE_VERSION:1:2}
but should be
major_version=${NODE_VERSION:0:2}
Version: b5c0e90
rocketchatctl reads latest version from website incorrectly.
JSON from server:
{"tag":"3.3.0","commit":"a9872957180059094e50678ec311b2fcef8f61ad","key":"build/rocket.chat-3.3.0.tgz","etag":"8d9a7dfa11ef3ca97ab219bcefcb9686-20","count":5170}
Actual
rocketchatctl extracts: 3.3.0commit
Expected
3.3.0
The parsing of PORT# from the rocketchat.service systemd file often fails. The GREP/AWK used for this terribly fragile and will only work if the service environment variable EXACTLY matches what it is expecting.
This often results in the dreaded UNARY operator error.
*basically meaning either current or latest version of Rocket.Chat returned NULL
This problem can easily be avoided by using a more flexible parse strategy which will pull the port number no matter where or how it is located in the environment= line...
Line 741 change from:
PORT=$(cat /lib/systemd/system/rocketchat.service | grep PORT= | awk -FPORT= '{print $3}')
to
PORT=$(cat /lib/systemd/system/rocketchat.service | grep PORT= | grep -Po 'PORT=\s*\K[0-9]+')
Apparently I last updated our staging server while RocketChat/Rocket.Chat#23137 was still open. Now, the server is really 3.18.1
but thinks it is 4.0.0
, and when I check for updates, I can't update to the actual v4:
myserver:~ # bash -x rocketchatctl check-updates
+ set -o nounset
+ main check-updates
+ local VERSION=latest
+ local -r NODE_VERSION=v12.18.4
+ local -r NPM_VERSION=6.14.8
+ local MONGO_VERSION=
+ local -r 'MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01'
+ local -r 'MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01'
+ local ROCKETCHAT_DOWNLOAD_URL=https://releases.rocket.chat/latest/download
+ local -r NODE_DEB_DOWNLOAD_URL=https://deb.nodesource.com/setup_12.x
+ local -r NODE_RPM_DOWNLOAD_URL=https://rpm.nodesource.com/setup_12.x
+ local -r ROCKETCHAT_DIR=/opt/Rocket.Chat
+ local -r ROCKETCHAT_DIR_UPDATE=/opt/Rocket.Chat.bkup
+ local -r ROCKET_VERSION_INFO_URL=https://releases.rocket.chat/latest/info
+ local -r ROCKETCHATCTL_DOWNLOAD_URL=https://raw.githubusercontent.com/RocketChat/install.sh/master/rocketchatctl
+ local -r ROCKETCHATCTL_DIRECTORY=/usr/local/bin
+ local -r ROCKETCHATCTL_TEMP_DIRECTORY=/tmp
+ local -r TRAEFIK_DOWNLOAD_URL=https://github.com/containous/traefik/releases/download/v1.7.20/traefik
+ local -r CADDY_DOWNLOAD_URL=https://github.com/mholt/caddy/releases/download/v1.0.0/caddy_v1.0.0_linux_amd64.tar.gz
+ local distro=
+ local distro_version=
+ local install_node=0
+ local install_mongo=0
+ local rocket_healthy=0
+ local ROOT_URL=
+ local PORT=3000
+ local BIND_IP=0.0.0.0
+ local bind_loopback=true
+ local webserver=none
+ local install_node_arg=0
+ local use_mongo_arg=0
+ local webserver_arg=0
+ local rocket_mail_arg=0
+ local bind_loopback_arg=0
+ local rocket_domain=
+ local configure_rocketchat=0
+ local configure_webserver=0
+ local root_url_arg=0
++ date +%s
+ local sufix=1633344692
+ local node_path=/usr/local/bin/node
+ local backup_dir=/tmp
+ local update_node=0
+ '[' 0 -ne 0 ']'
+ '[' 1 -lt 1 ']'
+ [[ -t 0 ]]
+ case $1 in
+ do_check_updates
+ get_rocketchat_latest_version
+ command_exists curl
+ command -v curl
++ curl https://releases.rocket.chat/latest/info
++ grep -w tag
++ awk '-F"' '{print $2}'
++ awk -F: '{print $2}'
+ latest_rocketchat_version=4.0.0
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ grep PORT
++ awk -F= '{print $3}'
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=4.0.0
+ print_make_backup
+ echo 'Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the bac
kup.'
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
+ get_mongo_storage_engine
++ mongo --eval 'printjson(db.serverStatus().storageEngine)'
++ grep name
++ awk -F: '{print $2}'
++ tr -d ,
++ tr -d '"'
++ tr -d '[:space:]'
+ storage=wiredTiger
+ [[ wiredTiger == \m\m\a\p\v\1 ]]
+ [[ 4.0.0 =~ ^([0-2]\..\..)$ ]]
+ version_gt 4.0.0 4.0.0
++ printf '%s\n' 4.0.0 4.0.0
++ sort -V
++ head -n 1
+ test 4.0.0 '!=' 4.0.0
+ '[' 4.0.0 == 4.0.0 ']'
+ print_rocketchat_in_latest_version_and_exit
+ echo 'RocketChat server already in latest version.'
RocketChat server already in latest version.
+ exit 2
myserver:~ #
Do I have to wait for 4.0.1
, or can I convince rocketchatctl
to override the version or force the update? (I want to avoid a re-install because that is a lot of work with our setup.)
(Might be related to #55.)
# rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 4.4 to 4.5.0.
/usr/local/bin/rocketchatctl: line 1127: jq: command not found
(23) Failed writing body
installing : node-v12.22.8
mkdir : /usr/local/n/versions/node/12.22.8
fetch : https://nodejs.org/dist/v12.22.8/node-v12.22.8-linux-x64.tar.xz
installed : v12.22.8 (with npm 6.14.15)
Warning: rocketchat.service changed on disk. Run 'systemctl daemon-reload' to reload units.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 132 100 132 0 0 267 0 --:--:-- --:--:-- --:--:-- 266
100 165M 100 165M 0 0 927k 0 0:03:02 0:03:02 --:--:-- 25.8M
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
> [email protected] install /tmp/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-72-glibc` exists; testing
Binary is fine; exiting
npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd meteor-dev-bundle@ node npm-rebuild.js (wd=/tmp/bundle/programs/server)
added 157 packages from 85 contributors and audited 157 packages in 7.571s
4 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Warning: rocketchat.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Waiting up to 5 minutes for RocketChat server to be active ... 2
Waiting up to 5 minutes for RocketChat server to be active ... 4
RocketChat server not running. Cancelling
In the syslog I see:
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: Started The Rocket.Chat server.
Mar 4 12:44:59 trolls.stage.mydomain.example rocketchat[21508]: Meteor requires Node v14.0.0 or later.
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Main process exited, code=exited, status=1/FAILURE
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Unit entered failed state.
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Failed with result 'exit-code'.
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Service hold-off time over, scheduling restart.
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: Stopped The Rocket.Chat server.
Mar 4 12:44:59 trolls.stage.mydomain.example systemd[1]: Started The Rocket.Chat server.
[…]
Mar 4 12:45:01 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Start request repeated too quickly.
Mar 4 12:45:01 trolls.stage.mydomain.example systemd[1]: Failed to start The Rocket.Chat server.
Mar 4 12:45:01 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Unit entered failed state.
Mar 4 12:45:01 trolls.stage.mydomain.example systemd[1]: rocketchat.service: Failed with result 'exit-code'.
It might very well be that my npm package versions are screwed up because I had huge problems with upgrading Rocket.Chat from 4.3 to 4.4 because some of the npm packages used (I had problems with node-gyp
and fibers
) seemed to ignore or incorrectly use the proxy
, https-proxy
and ca-file
settings from .npmrc
, which is why I had to manually point them to the https-proxy and the ca-file when they seemed to ignore the ca-file and wanted to use the (http) proxy for https sites. I don't know much about node, I'll write a separate issue for that.
Version 4 seems to report a shorter version, so the health check at the end repeats indefinitely:
# bash -x rocketchatctl update
[…]
+ systemctl start rocketchat
+ rocketchat_health_check
+ local count=0
+ '[' 0 -eq 1 ']'
+ '[' 0 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ awk -F= '{print $3}'
++ grep PORT
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ [[ '' =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] # <=== server not yet running…
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 2'
Waiting up to 5 minutes for RocketChat server to be active ... 2
[…]
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 30'
Waiting up to 5 minutes for RocketChat server to be active ... 30
+ '[' 0 -eq 1 ']'
+ '[' 15 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ awk -F= '{print $3}'
++ grep PORT
++ cat /lib/systemd/system/rocketchat.service
+ PORT=3000
++ cut '-d"' -f4
++ curl --interface lo http://localhost:3000/api/info
+ current_rocketchat_version=4.0
+ [[ 4.0 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] # <=== regex doesn't match anymore
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 32'
Waiting up to 5 minutes for RocketChat server to be active ... 32
[…]
I have aborted the script with ctrl-c, so I'm not sure what happens when the 5 minute timeout runs out (I assume the update will be aborted and the old version restored?).
Hello all..
Thanks for this great script... Kudos
Would it be possible to have an option to point to an existing certificate ? I use letencrypt with the dnsapi opton. This way I dont require leaving port 80 open...
Thanks and cheers
Keep up the great work..
S...
When using rocketchatctl
to update just now, I ran into RocketChat/Rocket.Chat#19537. From the phrasing there I'd assume it would only happen on manual upgrade.
This is on Debian 9.13.
trolls:~ # rocketchatctl check-updates
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 3.7.1 to 3.9.0.
We need to patch rocketchatctl
a bit, so I always do this:
trolls:~ # cp /usr/local/bin/rocketchatctl{,.$(date +%F)}
trolls:~ # rocketchatctl upgrade-rocketchatctl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 40074 100 40074 0 0 56840 0 --:--:-- --:--:-- --:--:-- 56842
rocketchatctl upgraded to latest version.
trolls:~ # diff /usr/local/bin/rocketchatctl.2020-12-01 /usr/local/bin/rocketchatctl
44c44
< --dir=<path_to_dir> sets the directory for storing the backup files, default backup directory is /tmp
---
> --backup-dir=<path_to_dir> sets the directory for storing the backup files, default backup directory is /tmp
760c760
< current_rocketchat_version=$(curl --interface lo http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
---
> current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
1118c1118
< --dir)
---
> --backup-dir)
trolls:~ # vimdiff /usr/local/bin/rocketchatctl.2020-12-01 /usr/local/bin/rocketchatctl
2 files to edit
(Patched our "--interface lo" workaround back into it, otherwise we (IIRC) run into a problem because this is an IPv6 host and "localhost" resolves to "::1" first, but parts of Rocket.Chat run on "127.0.0.1" only.)
trolls:~ # rocketchatctl check-updates
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 3.7.1 to 3.9.0.
trolls:~ # mkdir /opt/$(date +%F)_backup-rocket.chat-db && rocketchatctl backup --backup-dir=/opt/$(date +%F)_backup-rocket.chat-db
2020-12-01T08:16:06.715+0000 writing rocketchat.view_livechat_queue_status to archive on stdout
[…]
2020-12-01T08:16:09.437+0000 done dumping rocketchat.rocketchat_statistics (7369 documents)
Backup done successfully, check for the backup file in /opt/2020-12-01_backup-rocket.chat-db/dump_1606810566.gz. You can restore using # mongorestore --host localhost:27017 --db rocketchat --archive --gzip < /opt/2020-12-01_backup-rocket.chat-db/dump_1606810566.gz
trolls:~ # rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
/usr/local/bin/rocketchatctl: line 900: [: 3.9.0: unary operator expected
Could not determine if updates available for RocketChat server.
(We regularly see this, and just re-run the command until it works.)
trolls:~ # rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
/usr/local/bin/rocketchatctl: line 900: [: 3.9.0: unary operator expected
Could not determine if updates available for RocketChat server.
trolls:~ # bash -x rocketchatctl update
+ set -o nounset
+ main update
+ local VERSION=latest
+ local -r NODE_VERSION=v12.14.0
+ local -r NPM_VERSION=6.13.4
+ local MONGO_VERSION=
+ local -r 'MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01'
+ local -r 'MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01'
+ local ROCKETCHAT_DOWNLOAD_URL=https://releases.rocket.chat/latest/download
+ local -r NODE_DEB_DOWNLOAD_URL=https://deb.nodesource.com/setup_12.x
+ local -r NODE_RPM_DOWNLOAD_URL=https://rpm.nodesource.com/setup_12.x
+ local -r ROCKETCHAT_DIR=/opt/Rocket.Chat
+ local -r ROCKETCHAT_DIR_UPDATE=/opt/Rocket.Chat.bkup
+ local -r ROCKET_VERSION_INFO_URL=https://releases.rocket.chat/latest/info
+ local -r ROCKETCHATCTL_DOWNLOAD_URL=https://raw.githubusercontent.com/RocketChat/install.sh/master/rocketchatctl
+ local -r ROCKETCHATCTL_DIRECTORY=/usr/local/bin
+ local -r ROCKETCHATCTL_TEMP_DIRECTORY=/tmp
+ local -r TRAEFIK_DOWNLOAD_URL=https://github.com/containous/traefik/releases/download/v1.7.20/traefik
+ local -r CADDY_DOWNLOAD_URL=https://github.com/mholt/caddy/releases/download/v1.0.0/caddy_v1.0.0_linux_amd64.tar.gz
+ local distro=
+ local distro_version=
+ local install_node=0
+ local install_mongo=0
+ local rocket_healthy=0
+ local ROOT_URL=
+ local PORT=3000
+ local BIND_IP=0.0.0.0
+ local bind_loopback=true
+ local webserver=none
+ local install_node_arg=0
+ local use_mongo_arg=0
+ local webserver_arg=0
+ local rocket_mail_arg=0
+ local bind_loopback_arg=0
+ local rocket_domain=
+ local configure_rocketchat=0
+ local configure_webserver=0
+ local root_url_arg=0
++ date +%s
+ local sufix=1606810639
+ local node_path=/usr/bin/node
+ local backup_dir=/tmp
+ local update_node=0
+ '[' 0 -ne 0 ']'
+ '[' 1 -lt 1 ']'
+ [[ -t 0 ]]
+ case $1 in
+ os_supported
+ get_os_distro
+ '[' -r /etc/os-release ']'
++ . /etc/os-release
+++ PRETTY_NAME='Debian GNU/Linux 9 (stretch)'
+++ NAME='Debian GNU/Linux'
+++ VERSION_ID=9
+++ VERSION='9 (stretch)'
+++ VERSION_CODENAME=stretch
+++ ID=debian
+++ HOME_URL=https://www.debian.org/
+++ SUPPORT_URL=https://www.debian.org/support
+++ BUG_REPORT_URL=https://bugs.debian.org/
++ echo debian
+ distro=debian
++ . /etc/os-release
+++ PRETTY_NAME='Debian GNU/Linux 9 (stretch)'
+++ NAME='Debian GNU/Linux'
+++ VERSION_ID=9
+++ VERSION='9 (stretch)'
+++ VERSION_CODENAME=stretch
+++ ID=debian
+++ HOME_URL=https://www.debian.org/
+++ SUPPORT_URL=https://www.debian.org/support
+++ BUG_REPORT_URL=https://bugs.debian.org/
++ echo 9
+ distro_version=9
+ case "$distro" in
+ [[ 9 =~ ((9|10)) ]]
+ do_check_updates
+ get_rocketchat_latest_version
+ command_exists curl
+ command -v curl
++ curl https://releases.rocket.chat/latest/info
++ grep -w tag
++ awk '-F"' '{print $2}'
++ awk -F: '{print $2}'
+ latest_rocketchat_version=3.9.0
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ grep PORT
++ awk -F= '{print $3}'
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=3.7.1
+ print_make_backup
+ echo 'Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.'
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
+ [[ 3.7.1 =~ ^([0-2]\..\..)$ ]]
+ version_gt 3.9.0 3.7.1
++ printf '%s\n' 3.9.0 3.7.1
++ sort -V
++ head -n 1
+ test 3.7.1 '!=' 3.9.0
+ print_update_available_and_exit
+ echo 'Current update available for RocketChat server: from 3.7.1 to 3.9.0.'
Current update available for RocketChat server: from 3.7.1 to 3.9.0.
+ do_update
+ '[' 0 -eq 1 ']'
+ mv /opt/Rocket.Chat /opt/Rocket.Chat.bkup
+ '[' 0 == 0 ']'
+ systemctl stop rocketchat
+ install_rocketchat
+ curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 132 100 132 0 0 264 0 --:--:-- --:--:-- --:--:-- 264
100 148M 100 148M 0 0 447k 0 0:05:40 0:05:40 --:--:-- 30.2M
+ tar -xzf /tmp/rocket.chat.tgz -C /tmp
+ cd /tmp/bundle/programs/server
+ npm install
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
> [email protected] install /tmp/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-72-glibc` exists; testing
Binary is fine; exiting
npm WARN lifecycle meteor-dev-bundle@~install: cannot run in wd meteor-dev-bundle@ node npm-rebuild.js (wd=/tmp/bundle/programs/server)
added 146 packages from 122 contributors and audited 147 packages in 7.125s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
+ mv /tmp/bundle /opt/Rocket.Chat
+ rm /tmp/rocket.chat.tgz
+ set_rocketchat_user_and_permissions
+ id -un rocketchat
+ '[' 0 -ne 0 ']'
+ chown -R rocketchat:rocketchat /opt/Rocket.Chat
+ systemctl start rocketchat
+ rocketchat_health_check
+ local count=0
+ '[' 0 -eq 1 ']'
+ '[' 0 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ grep PORT
++ awk -F= '{print $3}'
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ [[ '' =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 2'
Waiting up to 5 minutes for RocketChat server to be active ... 2
+ '[' 0 -eq 1 ']'
+ '[' 1 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ grep PORT
++ awk -F= '{print $3}'
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ [[ '' =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 4'
Waiting up to 5 minutes for RocketChat server to be active ... 4
+ '[' 0 -eq 1 ']'
+ '[' 2 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ awk -F= '{print $3}'
++ grep PORT
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ [[ '' =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 6'
Waiting up to 5 minutes for RocketChat server to be active ... 6
+ '[' 0 -eq 1 ']'
+ '[' 3 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ awk -F= '{print $3}'
++ grep PORT
++ cat /lib/systemd/system/rocketchat.service
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ [[ '' =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 8'
Waiting up to 5 minutes for RocketChat server to be active ... 8
+ '[' 0 -eq 1 ']'
+ '[' 4 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ awk -F= '{print $3}'
++ grep PORT
++ cat /lib/systemd/system/rocketchat.service
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=
+ [[ '' =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
+ sleep 2
+ (( count++ ))
+ echo 'Waiting up to 5 minutes for RocketChat server to be active ... 10'
Waiting up to 5 minutes for RocketChat server to be active ... 10
+ '[' 0 -eq 1 ']'
+ '[' 5 -eq 150 ']'
+ get_rocketchat_current_version
+ systemctl status rocketchat
+ print_rocketchat_not_running_error_and_exit
+ errcho 'RocketChat server not running. Cancelling'
+ echo 'RocketChat server not running. Cancelling'
RocketChat server not running. Cancelling
+ exit 1
(The download takes that long because, well, corporate proxy.)
syslog revealed this error:
Dec 01 08:23:25 trolls systemd[1]: Started The Rocket.Chat server.
Dec 01 08:23:35 trolls rocketchat[17837]: /opt/Rocket.Chat/programs/server/node_modules/fibers/future.js:280
Dec 01 08:23:35 trolls rocketchat[17837]: throw(ex);
Dec 01 08:23:35 trolls rocketchat[17837]: ^
Dec 01 08:23:35 trolls rocketchat[17837]: TypeError: AsyncLocalStorage is not a constructor
Dec 01 08:23:35 trolls rocketchat[17837]: at module (server/sdk/index.ts:23:34)
Dec 01 08:23:35 trolls rocketchat[17837]: at fileEvaluate (packages/modules-runtime.js:336:7)
Dec 01 08:23:35 trolls rocketchat[17837]: at Module.require (packages/modules-runtime.js:238:14)
Dec 01 08:23:35 trolls rocketchat[17837]: at Module.moduleLink [as link] (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:52:22)
Dec 01 08:23:35 trolls rocketchat[17837]: at ee/server/broker.ts:1:80
Dec 01 08:23:35 trolls rocketchat[17837]: at module (ee/server/broker.ts:345:2)
Dec 01 08:23:35 trolls rocketchat[17837]: at fileEvaluate (packages/modules-runtime.js:336:7)
Dec 01 08:23:35 trolls rocketchat[17837]: at Module.require (packages/modules-runtime.js:238:14)
Dec 01 08:23:35 trolls rocketchat[17837]: at Module.moduleLink [as link] (/opt/Rocket.Chat/programs/server/npm/node_modules/meteor/modules/node_modules/reify/lib/runtime/index.js:52:22)
Dec 01 08:23:35 trolls rocketchat[17837]: at module (server/main.js:1:8)
Dec 01 08:23:35 trolls rocketchat[17837]: at fileEvaluate (packages/modules-runtime.js:336:7)
Dec 01 08:23:35 trolls rocketchat[17837]: at Module.require (packages/modules-runtime.js:238:14)
Dec 01 08:23:35 trolls rocketchat[17837]: at require (packages/modules-runtime.js:258:21)
Dec 01 08:23:35 trolls rocketchat[17837]: at /opt/Rocket.Chat/programs/server/app/app.js:191196:15
Dec 01 08:23:35 trolls rocketchat[17837]: at /opt/Rocket.Chat/programs/server/boot.js:401:38
Dec 01 08:23:35 trolls rocketchat[17837]: at Array.forEach (<anonymous>)
Dec 01 08:23:35 trolls systemd[1]: rocketchat.service: Main process exited, code=exited, status=1/FAILURE
Dec 01 08:23:35 trolls systemd[1]: rocketchat.service: Unit entered failed state.
Dec 01 08:23:35 trolls audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rocketchat comm="systemd" exe="/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Dec 01 08:23:35 trolls systemd[1]: rocketchat.service: Failed with result 'exit-code'.
That in turn led me to RocketChat/Rocket.Chat#19537.
This workaround (distilled from the above issue, and augmented) helped:
Before:
# node --version
v12.14.0
Workaround:
# n install 12.18.4
# systemctl restart rocketchat.service
HTH
Jul 08 08:27:47 localhost.localdomain systemd[1]: Started The Rocket.Chat server.
Jul 08 08:27:47 localhost.localdomain rocketchat[8986]: Meteor requires Node v14.0.0 or later.
Jul 08 08:27:47 localhost.localdomain systemd[1]: rocketchat.service: main process exited, code=exited, status=1/FAILURE
Jul 08 08:27:47 localhost.localdomain systemd[1]: Unit rocketchat.service entered failed state.
Jul 08 08:27:47 localhost.localdomain systemd[1]: rocketchat.service failed.
no sure why can't start the service
As mentioned in #56, I had huge problems with upgrading Rocket.Chat from 4.3 to 4.4 because some of the npm packages used seemed to ignore or incorrectly use the proxy
, https-proxy
and ca-file
settings from .npmrc
, which is why I had to manually point them to the https-proxy and the ca-file when they seemed to ignore the ca-file and wanted to use the (http) proxy for https sites.
I don't know much about node, the npm package "meteor" (or npm or node trying to do something with meteor) threw some vacuous error that I don't have anymore because we don't retain the logs that long. Here's what I had to do, emulating what rocketchatctl wanted to do:
curl -L https://releases.rocket.chat/4.4.0/download -o /tmp/rocket.chat.tgz
tar -xzf /tmp/rocket.chat.tgz -C /tmp
cd /tmp/bundle/programs/server && npm install --verbose
# threw an error
cd node_modules/fibers # or maybe it was npm/node_modules/fibers/
http_proxy=http://proxy.mydomain.example:3129 '/usr/local/bin/node' '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js' 'rebuild' '--release' --verbose --cafile=/etc/ssl/certs/cacert.pem
find . -iname binding.gyp
cd -
http_proxy=http://proxy.mydomain.example:3129 npm install --verbose
mv /tmp/bundle /opt/Rocket.Chat/
chown -R rocketchat:rocketchat /opt/Rocket.Chat/
systemctl restart rocketchat.service
I hope this is at least somewhat useful. 😞
I installed RocketChat.
I installed RocketChat CTL.
And then I tried to run /usr/local/bin/rocketchatctl update
Which results in:
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
/usr/local/bin/rocketchatctl: line 909: [: 3.15.0: unary operator expected
Could not determine if updates available for RocketChat server.
When I manually set the version to 3.14.1 it works with the update.
It seems that the version get command is broken.
Since RC went with nodejs version 12.x and up the old..old version in ctl will just destroy the whole install. Needs to be updated.
Thank you
Hi,
Do you plane to add support for Rocky Linux with rocketchatctl ?
thx
The url to the install.sh seems wrong, output when running the command from the repo homepage.
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 76433 0 76433 0 0 162k 0 --:--:-- --:--:-- --:--:-- 162k bash: -c: line 0: syntax error near unexpected token
newline'
bash: -c: line 0: <!doctype html>'
Visting https://rocket.chat/install.sh manually gives:
404
Houston, we have a problem
The page you are looking for does not exist
It seems #49 is missing a patch in another place where $current_rocketchat_version
is used:
# bash -x rocketchatctl check-updates
[…]
+ do_check_updates
+ get_rocketchat_latest_version
+ command_exists curl
+ command -v curl
++ curl https://releases.rocket.chat/latest/info
++ grep -w tag
++ awk '-F"' '{print $2}'
++ awk -F: '{print $2}'
+ latest_rocketchat_version=4.1.0
+ get_rocketchat_current_version
+ systemctl status rocketchat
++ cat /lib/systemd/system/rocketchat.service
++ grep PORT
++ awk -F= '{print $3}'
+ PORT=3000
++ curl --interface lo http://localhost:3000/api/info
++ cut '-d"' -f4
+ current_rocketchat_version=4.1
+ print_make_backup
+ echo 'Updates could be risky, […]'
Updates could be risky, […]
+ get_mongo_storage_engine
[…]
+ [[ 4.1 =~ ^([0-2]\..\..)$ ]]
+ version_gt 4.1.0 4.1
++ printf '%s\n' 4.1.0 4.1
++ sort -V
++ head -n 1
+ test 4.1 '!=' 4.1.0
+ print_update_available_and_exit
+ echo 'Current update available for RocketChat server: from 4.1 to 4.1.0.'
Current update available for RocketChat server: from 4.1 to 4.1.0.
Currently, the "up to date" case can't be reached. I guess the patch version (in "major.minor.patch
") should be removed somewhere before comparing both versions (at least if it is 0
(zero)).
Thanks!
I'm not a network guru, so please bear with me. When using multiple interfaces in a Linux system, tools like curl
use the first interface they can find, based on sorting rules I don't fully understand (f.e. in Debian, the order depends on which method you use to configure interfaces, and on the actual aliases used). When you have multiple addresses with different (ingress and) egress firewall rules and/or some using proxies and others not, and/or some being connected to the Internet and others to private networks, for tools like curl to work (with target URLs on the Internet), you have to specify an interface in the config.
For example, we use this setup:
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether […] brd ff:ff:ff:ff:ff:ff
inet [ipv4address]/26 brd [ipv4broadcast] scope global eth0
valid_lft forever preferred_lft forever
inet6 [ipv6address1]/64 scope global
valid_lft forever preferred_lft forever
inet6 [ipv6address2]/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::[…]/64 scope link
valid_lft forever preferred_lft forever
Since only "ipv6address2" can talk to the Internet (and isn't the "first", default, IP in the system), for the Rocket.Chat install to work, we have to create a curl config:
# cat .curlrc
interface [ipv6address2]
Now the install succeeds, yay!
(I can't tell how common this kind of setup is, but we use it for all of our hosts.)
Now we have another problem, because rocketchatctl
also uses curl
for localhost, which basically goes like this:
# curl -v http://localhost:3000
* Rebuilt URL to: http://localhost:3000/
* Trying ::1...
* TCP_NODELAY set
* Name '[ipv6address2]' family 10 resolved to '[ipv6address2]' family 10
* Local port: 0
* connect to ::1 port 3000 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Hostname [ipv6address2] was found in DNS cache
* Name '[ipv6address2]' family 2 resolved to '[ipv6address2]' family 10
* bind failed with errno 22: Invalid argument
* Failed to connect to localhost port 3000: Connection refused
* Closing connection 0
curl: (7) bind failed with errno 22: Invalid argument
Since the localhost addresses live in another castle^W^W^W on another interface, this fails.
Since it can be reasonably assumed that "localhost" will always live on a loopback address, I suggest this patch:
# diff -u rocketchatctl.orig.2021-05-07 rocketchatctl
--- rocketchatctl.orig.2021-05-07 2021-05-19 09:01:43.458370689 +0000
+++ rocketchatctl 2021-05-07 12:02:29.946660700 +0000
@@ -763,7 +763,7 @@
get_rocketchat_current_version(){
if systemctl status rocketchat > /dev/null 2>&1; then
PORT=$(cat /lib/systemd/system/rocketchat.service |grep PORT |awk -F= '{print $3}')
- current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
+ current_rocketchat_version=$(curl --interface lo http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
else
print_rocketchat_not_running_error_and_exit
fi
This works:
# curl -v --interface lo http://localhost:3000
* Rebuilt URL to: http://localhost:3000/
* Trying ::1...
* TCP_NODELAY set
* Local Interface lo is ip ::1 using address family 10
* Local port: 0
* connect to ::1 port 3000 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Local Interface lo is ip 127.0.0.1 using address family 2
* Local port: 0
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
[…]
(The first attempt to ::1
doesn't work because 127.0.0.1 is hardcoded into the config.)
Thanks!
The current version of rocketchatctl
tries to use jq
, which might not be installed:
# rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 4.4 to 4.5.0.
/usr/local/bin/rocketchatctl: line 1127: jq: command not found
(23) Failed writing body
installing : node-v12.22.8
mkdir : /usr/local/n/versions/node/12.22.8
fetch : https://nodejs.org/dist/v12.22.8/node-v12.22.8-linux-x64.tar.xz
installed : v12.22.8 (with npm 6.14.15)
Warning: rocketchat.service changed on disk. Run 'systemctl daemon-reload' to reload units.
% Total % Received % Xferd Average Speed Time Time Time Current
[…]
According to: https://docs.rocket.chat/deploy/prepare-for-your-deployment/rapid-deployment-methods/rocketchatctl
Debian 9, 10, 11
Debian 11 should be supported.
But when running on a newly created Debian 11 host it says:
The detected Linux distribution is not supported by rocketchatctl.
looking at the source of the bash script there is:
debian)
[[ "$distro_version" =~ (("9"|"10")) ]] || print_distro_not_supported_error_and_exit
I've not tried to insert "11" there and try it anyway.
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
/usr/local/bin/rocketchatctl: line 898: [: 3.9.4: unary operator expected
Could not determine if updates available for RocketChat server.```
Problem is in the `get_rocketchat_current_version()` function
`cat /lib/systemd/system/rocketchat.service |grep PORT |awk -F= '{print $3}'` is wrong, the correct field on my system is `$8`...
A better solution is to use:
`PORT=$(perl -ne 'print $1 if /PORT=(\d+)/' /lib/systemd/system/rocketchat.service)`
or
`grep -Eo 'PORT=\S+' /lib/systemd/system/rocketchat.service | cut -d= -f2` but this might be less portable, not sure `-E` or/and `-o` are universally supported...
Behind corporate proxy/proxies:
# env | grep -i proxy | sort
ftp_proxy=http://myproxy:3128
FTP_PROXY=http://myproxy:3128
http_proxy=http://myproxy:3128
HTTP_PROXY=http://myproxy:3128
https_proxy=http://myproxy:3129
HTTPS_PROXY=http://myproxy:3129
no_proxy=localhost,127.0.0.1,::1
NO_PROXY=localhost,127.0.0.1,::1
When upgrading from 4.1.0 to 4.2.0, the update throws the following errors:
# rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 4.1 to 4.2.0.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 132 100 132 0 0 257 0 --:--:-- --:--:-- --:--:-- 257
100 162M 100 162M 0 0 987k 0 0:02:48 0:02:48 --:--:-- 27.3M
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
> [email protected] install /tmp/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-72-glibc` exists; testing
Binary is fine; exiting
> meteor-dev-bundle@ install /tmp/bundle/programs/server
> node npm-rebuild.js
> [email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/meteor/ecmascript-runtime-client/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/ecmascript-runtime-client/node_modules/core-js
> [email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/meteor/ecmascript-runtime-server/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/ecmascript-runtime-server/node_modules/core-js
@babel/[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/@babel/code-frame
@babel/[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/@babel/highlight
[…]
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/meteor-babel-helpers
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/reify
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/reify/node_modules/semver
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/typescript
> [email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer
> node -e "try{require('./postinstall')}catch(e){}"
=== Nodemailer 6.4.6 ===
Thank you for using Nodemailer for your email sending needs! While Nodemailer
itself is mostly meant to be a SMTP client there are other related projects in
the Nodemailer project as well.
For example:
> IMAP API ( https://imapapi.com ) is a server application to easily access
IMAP accounts via REST API
> NodemailerApp ( https://nodemailer.com/app/ ) is a cross platform GUI app to
debug emails
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/email/node_modules/nodemailer
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/email/node_modules/stream-buffers
> [email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/meteor/url/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
[email protected] /tmp/bundle/programs/server/npm/node_modules/meteor/url/node_modules/core-js
> [email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/protobufjs
> node scripts/postinstall
> @napi-rs/[email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/@napi-rs/pinyin
> node postinstall.js
> @react-spring/[email protected] postinstall /tmp/bundle/programs/server/npm/node_modules/@react-spring/core
> node -e "console.log('\u001b[35m\u001b[1mEnjoy react-spring? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/react-spring/donate\u001b[0m')"
Enjoy react-spring? You can now donate to our open collective:
> https://opencollective.com/react-spring/donate
> [email protected] install /tmp/bundle/programs/server/npm/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! install response status 403 Forbidden on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 403 Forbidden on https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.1/bcrypt_lib-v5.0.1-napi-v3-linux-x64-glibc.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: tunneling socket could not be established, statusCode=403
gyp ERR! stack at ClientRequest.onConnect (/usr/local/lib/node_modules/npm/node_modules/tunnel-agent/index.js:166:19)
gyp ERR! stack at Object.onceWrapper (events.js:422:26)
gyp ERR! stack at ClientRequest.emit (events.js:315:20)
gyp ERR! stack at Socket.socketOnData (_http_client.js:503:11)
gyp ERR! stack at Socket.emit (events.js:315:20)
gyp ERR! stack at addChunk (_stream_readable.js:295:12)
gyp ERR! stack at readableAddChunk (_stream_readable.js:271:9)
gyp ERR! stack at Socket.Readable.push (_stream_readable.js:212:10)
gyp ERR! stack at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
gyp ERR! System Linux 4.9.0-16-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/bundle/programs/server/npm/node_modules/bcrypt/li$
/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/bundle/programs/server/npm/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_vers$
on=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /tmp/bundle/programs/server/npm/node_modules/bcrypt
gyp ERR! node -v v12.18.4
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/bundle/programs/server/np$
/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/bundle/programs/server/npm/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=6 --node_abi_napi=napi --n$
pi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/tmp/bundle/programs/server/npm/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.9.0-16-amd64
node-pre-gyp ERR! command "/usr/local/bin/node" "/tmp/bundle/programs/server/npm/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/bundle/programs/server/npm/node_modules/bcrypt
node-pre-gyp ERR! node -v v12.18.4
node-pre-gyp ERR! node-pre-gyp -v v1.0.5
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/bundle/programs/server/npm/node_modules/bcrypt/lib/bindi$
g/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/bundle/programs/server/npm/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=6 --node_abi_napi=napi --napi_build_version=3 --node_napi$
label=napi-v3' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-12-01T09_33_48_798Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meteor-dev-bundle@ install: `node npm-rebuild.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@ install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-12-01T09_33_48_967Z-debug.log
Waiting up to 5 minutes for RocketChat server to be active ... 2
Waiting up to 5 minutes for RocketChat server to be active ... 4
Waiting up to 5 minutes for RocketChat server to be active ... 6
Waiting up to 5 minutes for RocketChat server to be active ... 8
Waiting up to 5 minutes for RocketChat server to be active ... 10
Waiting up to 5 minutes for RocketChat server to be active ... 12
Waiting up to 5 minutes for RocketChat server to be active ... 14
Waiting up to 5 minutes for RocketChat server to be active ... 16
Waiting up to 5 minutes for RocketChat server to be active ... 18
Waiting up to 5 minutes for RocketChat server to be active ... 20
Waiting up to 5 minutes for RocketChat server to be active ... 22
Waiting up to 5 minutes for RocketChat server to be active ... 24
Waiting up to 5 minutes for RocketChat server to be active ... 26
Waiting up to 5 minutes for RocketChat server to be active ... 28
Waiting up to 5 minutes for RocketChat server to be active ... 30
Waiting up to 5 minutes for RocketChat server to be active ... 32
Waiting up to 5 minutes for RocketChat server to be active ... 34
Waiting up to 5 minutes for RocketChat server to be active ... 36
Waiting up to 5 minutes for RocketChat server to be active ... 38
Waiting up to 5 minutes for RocketChat server to be active ... 40
Waiting up to 5 minutes for RocketChat server to be active ... 42
Waiting up to 5 minutes for RocketChat server to be active ... 44
Waiting up to 5 minutes for RocketChat server to be active ... 46
Waiting up to 5 minutes for RocketChat server to be active ... 48
RocketChat server updated to latest version :)
# rocketchatctl check-updates
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 4.2 to 4.2.0.
The logfiles mentioned above don't provide any more insight:
bcrypt
:[…]
6673 info lifecycle [email protected]~install: [email protected]
6674 info lifecycle [email protected]~postinstall: [email protected]
6675 info build /tmp/bundle/programs/server/npm/node_modules/bcrypt
6676 info lifecycle [email protected]~preinstall: [email protected]
6677 info linkStuff [email protected]
6678 silly linkStuff [email protected] has /tmp/bundle/programs/server/npm/node_modules as its parent node_modules
6679 info lifecycle [email protected]~install: [email protected]
6680 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
6681 verbose lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/bundle/programs/server/npm/node_modules/bcrypt/node_modules/.bin:/tmp/bundle/progr
ams/server/npm/node_modules/.bin:/usr/local/bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/bundle/programs/server/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/us
r/bin:/sbin:/bin
6682 verbose lifecycle [email protected]~install: CWD: /tmp/bundle/programs/server/npm/node_modules/bcrypt
6683 silly lifecycle [email protected]~install: Args: [ '-c', 'node-pre-gyp install --fallback-to-build' ]
6684 silly lifecycle [email protected]~install: Returned: code: 1 signal: null
6685 info lifecycle [email protected]~install: Failed to exec install script
6686 verbose stack Error: [email protected] install: `node-pre-gyp install --fallback-to-build`
6686 verbose stack Exit status 1
6686 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
6686 verbose stack at EventEmitter.emit (events.js:315:20)
6686 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
6686 verbose stack at ChildProcess.emit (events.js:315:20)
6686 verbose stack at maybeClose (internal/child_process.js:1021:16)
6686 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
6687 verbose pkgid [email protected]
6688 verbose cwd /tmp/bundle/programs/server/npm
6689 verbose Linux 4.9.0-16-amd64
6690 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "rebuild" "--update-binary"
6691 verbose node v12.18.4
6692 verbose npm v6.14.6
6693 error code ELIFECYCLE
6694 error errno 1
6695 error [email protected] install: `node-pre-gyp install --fallback-to-build`
6695 error Exit status 1
6696 error Failed at the [email protected] install script.
6696 error This is probably not a problem with npm. There is likely additional logging output above.
6697 verbose exit [ 1, true ]
meteor-dev-bundle
:[…]
3936 info lifecycle [email protected]~postinstall: [email protected]
3937 timing action:postinstall Completed in 28ms
3938 verbose unlock done using /root/.npm/_locks/staging-1645f36b78f2781a.lock for /tmp/bundle/programs/server/node_modules/.staging
3939 timing stage:executeActions Completed in 5998ms
3940 timing stage:rollbackFailedOptional Completed in 1ms
3941 silly install runPostinstallTopLevelLifecycles
3942 silly build meteor-dev-bundle@
3943 info linkStuff meteor-dev-bundle@
3944 silly linkStuff meteor-dev-bundle@ has /tmp/bundle/programs as its parent node_modules
3945 silly install meteor-dev-bundle@
3946 info lifecycle meteor-dev-bundle@~install: meteor-dev-bundle@
3947 verbose lifecycle meteor-dev-bundle@~install: unsafe-perm in lifecycle true
3948 verbose lifecycle meteor-dev-bundle@~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/tmp/bundle/programs/server/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr
/sbin:/usr/bin:/sbin:/bin
3949 verbose lifecycle meteor-dev-bundle@~install: CWD: /tmp/bundle/programs/server
3950 silly lifecycle meteor-dev-bundle@~install: Args: [ '-c', 'node npm-rebuild.js' ]
3951 silly lifecycle meteor-dev-bundle@~install: Returned: code: 1 signal: null
3952 info lifecycle meteor-dev-bundle@~install: Failed to exec install script
3953 verbose stack Error: meteor-dev-bundle@ install: `node npm-rebuild.js`
3953 verbose stack Exit status 1
3953 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
3953 verbose stack at EventEmitter.emit (events.js:315:20)
3953 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
3953 verbose stack at ChildProcess.emit (events.js:315:20)
3953 verbose stack at maybeClose (internal/child_process.js:1021:16)
3953 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
3954 verbose pkgid meteor-dev-bundle@
3955 verbose cwd /tmp/bundle/programs/server
3956 verbose Linux 4.9.0-16-amd64
3957 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--unsafe-perm"
3958 verbose node v12.18.4
3959 verbose npm v6.14.6
3960 error code ELIFECYCLE
3961 error errno 1
3962 error meteor-dev-bundle@ install: `node npm-rebuild.js`
3962 error Exit status 1
3963 error Failed at the meteor-dev-bundle@ install script.
3963 error This is probably not a problem with npm. There is likely additional logging output above.
3964 verbose exit [ 1, true ]
Apparently, sometime in the past I told node
/npm
to use a proxy (that seems to be ignored in this case):
# npm get
; cli configs
[…]
; userconfig /root/.npmrc
cafile = "/etc/ssl/certs/cacert.pem"
https-proxy = "http://myproxy:3129/"
proxy = "http://myproxy:3128/"
; node bin location = /usr/local/bin/node
; cwd = /root
; HOME = /root
; "npm config ls -l" to show all defaults.
# cat .npmrc
proxy=http://myproxy:3128/
https-proxy=http://myproxy:3129/
cafile=/etc/ssl/certs/cacert.pem
Rocket.Chat still starts, and I couldn't find any problems yet, but I haven't tested it much.
Not really sure if this is a rocketchatctl
or a general Rocket.Chat issue, or a node
/npm
issue, or whether I'm supposed to configure node-pre-gyp
to use the proxy (how)?
Stumbling across the net, and several minutes later:
who decided to f*ck up the rocketchatctl so hard?
No updates in ages, wrong node version, ... is this on purpose?
I can tell you, this scares potential customers.
Needed for digitalocean image if we use this there to install. We need to be able to install 4.0.3
On a fresh Ubuntu 20.04 machine, rocketchatctl install
produces an installation containing mongodb 4.0.27, and Rocket.Chat immediately complains that it is deprecated.
| YOUR CURRENT MONGODB VERSION (4.0.27) IS DEPRECATED. |
| IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 5.0.0 AND GREATER, |
| PLEASE UPGRADE MONGODB TO VERSION 4.2 OR GREATER |
Shouldn't it use the mongodb-org/4.4
repository instead?
# mkdir /opt/$(date +%F)_backup-rocket.chat-db && rocketchatctl backup --backup-dir=/opt/$(date +%F)_backup-rocket.chat-db
/usr/local/bin/rocketchatctl: line 1106: run: command not found
Can't write in the backup directory: /opt/2022-05-02_backup-rocket.chat-db
That line is:
touch "$backup_dir/testfile_$sufix.txt" /dev/null 2>&1 && run rm "$backup_dir/testfile_$sufix.txt" || print_backup_dir_error_and_exit
Also on line 896:
run rm -rf $ROCKETCHAT_DIR_UPDATE
Also on line 1175:
command_exists nvm || { test -s /opt/nvm/nvm.sh && run source $_ || do_install_nvm; }
Please fix. Thanks.
Greetings!
Sometimes, RC fails for no apparent reason and works fine again after a (manual) restart (f.e. RocketChat/Rocket.Chat#22841). In this case, it would be nice to automatically restart it, instead of being dead until a slow meatbag like myself has time to look at the problem.
So, I suggest to add something like "Restart=on-failure
" somewhere around https://github.com/RocketChat/install.sh/blob/master/rocketchatctl#L490 (I have tested that this works for me), unless it is a deliberate decision to not restart.
Opinions?
I have an AWS EC2 instance originally deployed with AMI Marketplace official Rocket image.
Ive alway use rocketchatctl update to update to the latest Rocket.chat.
Im on 5.1.4 and Im trying to update to 5.2.0 and I get:
myip:~$ sudo rocketchatctl update
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
Current update available for RocketChat server: from 5.1 to 5.2.0.
/usr/local/bin/rocketchatctl: line 1175: run: command not found
mkdir: cannot create directory ‘/opt/nvm’: File exists
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15916 100 15916 0 0 740k 0 --:--:-- --:--:-- --:--:-- 740k
=> nvm is already installed in /opt/nvm, trying to update using git
=> => Compressing and cleaning up git repository
=> nvm source string already in /root/.bashrc
=> bash_completion source string already in /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="/opt/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
v14.19.3 is already installed.
Now using node v14.19.3 (npm v6.14.17)
/opt/nvm/nvm.sh: line 3319: EXIT_CODE: unbound variable
======
Upgrade to the latest version
Stuck in the old version
Not sure how to get the logs, sorry :-(
I just downloaded the latest version of rocketchatctl and tried to upgrade an existing rocketchat
OS: centos8
RocketChat version: 4.8.1
Apps Engine Version: 1.32.0
Node Version: v14.18.3
Database Migration: 265 (November 20, 2022 12:37 PM)
MongoDB: 4.2.24 / wiredTiger (oplog Enabled)
Commit Details: HEAD: (0b106e364); Branch: HEAD
./rocketchatclt check-updates
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup. /usr/local/bin/rocketchatctl: line 783: $1: unbound variable
rocketchatctl needs curl
to function properly.
For example, when curl
package is not installed, rocketchatctl check-updates
fails with a strange error:
root@rocketchat0# ./rocketchatctl check-updates
Updates could be risky, you can use the backup option # rocketchatctl backup, to create a backup of the rocketchat database first. Please check that you have enough space in your system to store the backup.
./rocketchatctl: line 764: $1: unbound variable
It should be useful to test curl availabilty (using command -v curl
for example) before any operation that requires it.
When I run the script with rocketchatctl install --mongo-version=4.4
it installs Mongo 5.0 (on Debian buster!) anyway. I have to comment out get_supported_mongo_version
.
sudo rocketchatctl update --version 3.3.0 breaks on a test failure due to incorrect PORT data extraction
running with -x shows the issue:
Line 757 - get_rocketchat_current_version() can mistakenly extract environment settings for Mongodb,
possible re-write may be:
get_rocketchat_current_version(){
if PORT=`systemctl status rocketchat | grep Process.Port | awk '{ print $10 }'`; then
current_rocketchat_version=$(curl http://localhost:$PORT/api/info 2>/dev/null |cut -d\" -f4)
else
print_rocketchat_not_running_error_and_exit
fi
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.