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-old
#!/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
installPackage graphicsmagick
waitOrStop 0 "Failed apt install: graphicsmagick"
npm install -g inherits n
n 8.11.3

echo "Creat app user" | log
useradd -m -U -r -d $app_path rocket
usermod -a -G rocket www-data
chmod 750 $app_path

echo "Install main app" | log

mongo_url="mongodb://admin:${ADMINPASSWORD}@localhost:27017/rocketchat?authSource=admin"
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 zxf rocket.chat.tgz
mv bundle Rocket.Chat
cd Rocket.Chat/programs/server
npm install
export PORT=${app_port}
export ROOT_URL="http://0.0.0.0:"${app_port}"/"
export MONGO_URL=${mongo_url}
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 remote-fs.target nss-lookup.target mongod.target nginx.target

[Service]
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocket
Environment=NODE_ENV=production MONGO_URL=${mongo_url} ROOT_URL=https://${CWM_SERVERIP} PORT=${app_port}
ExecStart=/usr/local/bin/node ${app_path}/Rocket.Chat/main.js

[Install]
WantedBy=multi-user.target

EOF

systemctl daemon-reload
waitOrStop 0 "Reload systemctl failed"
systemctl start rocketchat
waitOrStop 0 "Start rocketchat service failed"
systemctl enable rocketchat

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-nginx-config /etc/nginx/sites-available/rocketchat.conf
# sed -i "s/SERVERIP/${CWM_SERVERIP}/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"

descriptionAppend "Rocket.chat application directory: ${app_path}/Rocket.Chat/"
descriptionAppend "Rocket.chat web UI: https://${CWM_SERVERIP}"
descriptionAppend " "

tagScript success

exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit