Created
November 1, 2019 17:38
-
-
Save zicodhkbd/d9b19e2b49532096c67d184a01c8a1b7 to your computer and use it in GitHub Desktop.
Rocket.Chat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo useradd -m -U -r -d /opt/rocket rocket | |
sudo usermod -a -G rocket www-data | |
sudo chmod 750 /opt/rocket | |
su - rocket | |
sudo passwd rocket | |
su - rocket | |
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz | |
tar -xzf /tmp/rocket.chat.tgz -C /tmp | |
cd /temp | |
cd Rocket.Chat/programs/server | |
npm install | |
sudo mv /tmp/bundle /opt/Rocket.Chat | |
cat << EOF |sudo tee -a /lib/systemd/system/rocketchat.service | |
[Unit] | |
Description=The Rocket.Chat server | |
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target | |
[Service] | |
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js | |
StandardOutput=syslog | |
StandardError=syslog | |
SyslogIdentifier=rocketchat | |
User=rocketchat | |
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 ROOT_URL=http://localhost:3000/ PORT=3000 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01 | |
MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01 | |
ROOT_URL=http://your-host-name.com-as-accessed-from-internet:3000 | |
PORT=3000 | |
sudo sed -i "s/^# engine:/ engine: mmapv1/" /etc/mongod.conf | |
sudo sed -i "s/^#replication:/replication:\n replSetName: rs01/" /etc/mongod.conf | |
sudo systemctl enable mongod | |
sudo systemctl start mongod | |
mongo --eval "printjson(rs.initiate())" | |
sudo systemctl enable rocketchat | |
sudo systemctl start rocketchat | |
sudo systemctl status rocketchat | |
http://localhost:3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment