Оглавление
Корпоративная болталка. Установка производится на чистую систему.
Подготовка
Обновление
1 2 3 |
sudo yum -y check-update |
Добавление репозитория
1 2 3 4 5 6 7 8 9 10 |
cat << EOF | sudo tee -a /etc/yum.repos.d/mongodb-org-4.0.repo [mongodb-org-4.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc EOF |
Настройка Node.js
1 2 3 |
sudo yum install -y curl && curl -sL https://rpm.nodesource.com/setup_8.x | sudo bash - |
Установка приложений, MongoDB, nodejs и graphicsmagick:
1 2 3 4 |
sudo yum install -y gcc-c++ make mongodb-org nodejs sudo yum install -y epel-release && sudo yum install -y GraphicsMagick |
1 2 3 |
sudo npm install -g inherits n && sudo n 8.11.4 |
Установка Rocket.Chat
Загрузка последней версии Rocket.Chat:
1 2 3 4 |
curl -L https://releases.rocket.chat/latest/download -o /tmp/rocket.chat.tgz tar -xzf /tmp/rocket.chat.tgz -C /tmp |
Установка:
1 2 3 4 |
cd /tmp/bundle/programs/server && npm install sudo mv /tmp/bundle /opt/Rocket.Chat |
Настройка Rocket.Chat.service
Добавление пользователя rocketchat, прав на каталог и демон
1 2 3 4 |
sudo useradd -M rocketchat && sudo usermod -L rocketchat sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 |
1 2 3 4 5 6 |
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 |
Настройка MongoDB и запуск Rocket.Chat
1 2 3 4 5 6 7 |
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 |
Проблема ZLIB
Необходимо добавить в файл конфигурации Rocket.Chat(/usr/lib/systemd/system/rocketchat.service) следующую строку:
1 2 3 4 |
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 LD_PRELOAD=/opt/Rocket.Chat/programs/server/npm/node_modules/sharp/vendor/lib/libz.so |
Настройка SSL
Установка NGINX и получение сертификата
1 2 3 |
yum install certbot-nginx nginx |
1 2 3 |
certbot --authenticator standalone --installer nginx -d rc.kost.su |
Настройка NGINX
/etc/nginx/conf.d/default.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# Upstreams upstream backend { server 127.0.0.1:3000; } # HTTPS Server server { listen 443; server_name rc.kost.su; # You can increase the limit if your need to. client_max_body_size 200M; error_log /var/log/nginx/rocketchat.access.log; ssl on; ssl_certificate /etc/letsencrypt/live/rc.kost.su/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/rc.kost.su/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE location / { proxy_pass http://backend/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header X-Forward-Proto http; proxy_set_header X-Nginx-Proxy true; proxy_redirect off; } } |