ยง2024-10-14

$ cd ~/build/src
$ curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
$ cd .. && ttar xvf /tmp/rocket.chat.tgz
$ cd bundle/programs/server`  && npm install --production
$ sudo mv bundle /opt/RocketChat-x.y.z
$ sudo chown -R rocketchat:rocketchat /opt/RocketChat-x.y.z

Then modify your service file!

  1. Install requirements
sudo apt update && sudo apt install -y curl build-essential graphicsmagick
  1. install fnm
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash
Downloading https://github.com/Schniz/fnm/releases/latest/download/fnm-arm64.zip...
######################################################################## 100.0%
Installing for Bash. Appending the following to /home/alexlai/.bashrc:

# fnm
FNM_PATH="/home/alexlai/.local/share/fnm"
if [ -d "$FNM_PATH" ]; then
  export PATH="$FNM_PATH:$PATH"
  eval "`fnm env`"
fi

In order to apply the changes, open a new terminal or run the following command:

  source /home/alexlai/.bashrc
$ source ~/.bashrc

$ fnm list
* v14.21.3 default
* v22.6.0
* system
alexlai@hc4Noble:~$ fnm install v14.21.3
Installing Node v14.21.3 (arm64)
warning: Version already installed at "/home/alexlai/.local/share/fnm/node-versions/v14.21.3"
  1. Download and extract the latest release of Rocket.Chat
$ cd ~/build/src
$ $ curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz
$ cd .. && ttar xvf /tmp/rocket.chat.tgz

....
bundle/programs/web.browser.legacy/app/client/vendor/fontello/
bundle/programs/web.browser.legacy/app/client/vendor/fontello/utf8-rtl.html
bundle/programs/web.browser.legacy/app/client/vendor/fontello/demo.html
bundle/main.js
bundle/server/
bundle/server/.bundle_version.txt
bundle/.node_version.txt
  1. from bundle/programs/server && npm install --production
cd /tmp/bundle/programs/server && npm install --production

$ sudo mv bundle/ /opt/Rocket.Chat-6.13.0 $ sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat-6.13.0/


5. Configure the Rocket.Chat service

Add the rocketchat user and set the right permissions on the Rocket.Chat folder.

$ sudo useradd -M rocketchat && sudo usermod -L rocketchat $ sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat.Dragonfly28


6. RocketChatLaiKos.service 

[Unit] Description=The Rocket.Chat server After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service [Service]

ExecStart=/home/alexlai/.local/share/fnm/node-versions/v14.21.3/installation/bin/node /opt/Rocket.Chat/main.js

ExecStart=/bin/bash -c 'printenv; /home/alexlai/.local/share/fnm/node-versions/v14.21.3/installation/bin/node /opt/Rocket.Chat-6.13.0/main.js' StandardOutput=syslog StandardError=syslog SyslogIdentifier=rocketchat User=rocketchat

Environment="MONGO_URL=mongodb://siteRootAdmin:b23258585@x8664Arch.yushei.com.tw:27017,n2Bookworm.yushei.com.tw:27017,n2Jammy.yushei.com.tw:27017/LaiKos?replicaSet=odroid01&authSource=admin"

Environment="MONGO_OPLOG_URL=mongodb://siteRootAdmin:b23258585@x8664Arch.yushei.com.tw:27017,n2Bookworm.yushei.com.tw:27017,n2Jammy.yushei.com.tw:27017/LaiKos?replicaSet=odroid01&authSource=admin"

Environment="MONGO_URL=mongodb://siteRootAdmin:b23258585@redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017/LaiKos?replicaSet=ys20220318&authSource=admin" Environment="MONGO_OPLOG_URL=mongodb://siteRootAdmin:b23258585@redisMongo03.yushei.com.tw:27017,redisMongo04.yushei.com.tw:27017,redisMongo05.yushei.com.tw:27017/LaiKos?replicaSet=ys20220318&authSource=admin"

Environment="ROOT_URL=https://munetaka.me:43887/" Environment="PORT=43887" Environment="ADMIN_USERNAME=LaiKosAdmin" Environment="ADMIN_PASS=TseiLienLai#1950" Environment="ADMIN_EMAIL=rai.sousuke@mac.com" Environment="MAIL_URL=smtp://alexlai:alex1765@mail.h2Jammy.yushei.net:25/" [Install] WantedBy=multi-user.target