403Webshell
Server IP : 104.129.129.72  /  Your IP : 216.73.216.229
Web Server : LiteSpeed
System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
User : answe8064 ( 1002)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/installer/apps/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/installer/apps/rocketchat-latest-offirepo
#!/bin/bash

if [ -f "include/startup.sh" ]; then
    . include/startup.sh
elif [ -f "../include/startup.sh" ]; then
    . ../include/startup.sh
fi

checkTagExist nginx.success
checkTagExist mongodb.success
checkTagExist nodejs.success

rootDir=$(rootDir)
app_path=/opt/rocket

echo "Installing and tweaking nodejs requirements" | log
packages=(nginx gnupg2 git unzip build-essential curl software-properties-common graphicsmagick)
installPackage "${packages[@]}" | log
waitOrStop 0 "Failed apt install: ${packages[@]}"

echo "Create app user" | log
useradd -m -U -r -d $app_path rocket --shell /bin/bash
usermod -a -G rocket www-data
chmod 750 $app_path

echo "Install main app" | log
mongo_url="mongodb://127.0.0.1:27017/rocketchat"
app_port=3000
curlDownload https://releases.rocket.chat/latest/download $app_path/rocket.chat.tgz
waitOrStop 0 "File not downloaded from official source"
chown -R rocket:rocket $app_path/rocket.chat.tgz

su rocket << EOF
cd ${app_path}
tar -xvzf rocket.chat.tgz
mv bundle Rocket.Chat
cd Rocket.Chat/programs/server
npm install
EOF

ufw allow $app_port
ufw allow 27017

echo "Installing service" | log
cat << EOF > /etc/systemd/system/rocketchat.service

[Unit]
Description=Rocket.Chat server
After=network.target nss-lookup.target mongod.target 

[Service]
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocket
Environment=MONGO_URL=${mongo_url} ROOT_URL=https://${CWM_DISPLAYED_ADDRESS} PORT=${app_port}
ExecStart=/usr/bin/node ${app_path}/Rocket.Chat/main.js

[Install]
WantedBy=multi-user.target

EOF

echo "Adding Loading in Progress screen" | log
nginxErrorPage=/usr/share/nginx/html/customerror_50x.html
useFiglet
printf "<pre align=center>\n" > $nginxErrorPage
bannerFiglet "Loading in Progress\n Please Wait.\n" >> $nginxErrorPage
printf "Application and services loading is in progress, process will take a couple of minutes to complete \n\nThank you for your patience.\n\nRefresh page within a couple of minutes for updated status." >> $nginxErrorPage

echo "Configuring nginx" | log
cp -f $rootDir/tweaks/extras/rocketchat-nginx/rocketchat.conf /etc/nginx/sites-available/rocketchat.conf
sed -i "s/ServerDomain/${CWM_DISPLAYED_ADDRESS}/g" /etc/nginx/sites-available/rocketchat.conf
ln -s /etc/nginx/sites-available/rocketchat.conf /etc/nginx/sites-enabled/
unlink /etc/nginx/sites-enabled/default
unlink /etc/nginx/sites-enabled/default-ssl
systemctl reload nginx
waitOrStop 0 "Reload nginx service failed"

echo "Optimizing Mongo" | log
sed -i "s/security/replication/g" /etc/mongod.conf
sed -i "s/authorization: enabled/replSetName: replica01/g" /etc/mongod.conf
systemctl restart mongod
waitOrStop 0 "Restarting MongoDB failed"

sleep 5

echo "Initalizing MongoDB" | log
mongosh --eval "printjson(rs.initiate())"
sleep 1
systemctl daemon-reload
waitOrStop 0 "Reloading daemon failed"
systemctl restart nginx
waitOrStop 0 "Restarting NGINX failed"
systemctl enable rocketchat
sleep 1
systemctl start rocketchat
sleep 2
waitOrStop 0 "Start rocketchat service failed"

echo "Adding descriptions" | log
descriptionAppend "Rocket.chat application directory: ${app_path}/Rocket.Chat/"
descriptionAppend "Rocket.chat web UI: https://${CWM_DISPLAYED_ADDRESS}"
descriptionAppend " "

tagScript success

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit