tis-rocketchat-server icon

tis-rocketchat-server

Silent install package for tis-rocketchat-server

7.8.3-10

  • package: tis-rocketchat-server
  • version: 7.8.3-10
  • maintainer: Kevin Guerineau
  • licence: MIT
  • locale: all
  • target_os: debian
  • impacted_process: node
  • architecture: x64
  • signature_date:
  • size: 339.85 Mo
  • homepage : https://rocket.chat
  • depends:

package           : tis-rocketchat-server
version           : 7.8.3-10
architecture      : x64
section           : base
priority          : optional
name              : 
categories        : 
maintainer        : Kevin Guerineau
description       : Rocket.Chat permit to communicate and collaborate with your team, share files, chat in real time or switch to video/audio conferencing
depends           : tis-nodejs22,tis-mongodb-server-community-7
conflicts         : 
maturity          : PROD
locale            : all
target_os         : debian
min_wapt_version  : 2.2
sources           : 
installed_size    : 
impacted_process  : node
description_fr    : Rocket.Chat permet de communiquer et de collaborer avec votre équipe, de partager des fichiers, de discuter en temps réel ou de passer à une conférence vidéo/audio.
description_pl    : Rocket.Chat pozwala na komunikację i współpracę z zespołem, udostępnianie plików, czat w czasie rzeczywistym lub przełączenie się na wideokonferencję/audio konferencję
description_de    : Rocket.Chat ermöglicht es, mit Ihrem Team zu kommunizieren und zusammenzuarbeiten, Dateien auszutauschen, in Echtzeit zu chatten oder zu Video-/Audiokonferenzen zu wechseln
description_es    : Rocket.Chat permite comunicarse y colaborar con su equipo, compartir archivos, chatear en tiempo real o cambiar a videoconferencia/audioconferencia.
description_pt    : Rocket.Chat permite comunicar e colaborar com a sua equipa, partilhar ficheiros, conversar em tempo real ou mudar para videoconferência/áudio
description_it    : Rocket.Chat permette di comunicare e collaborare con il team, condividere file, chattare in tempo reale o passare a videoconferenze/audioconferenze.
description_nl    : Rocket.Chat staat toe te communiceren en samen te werken met uw team, bestanden te delen, in real time te chatten of over te schakelen naar video/audio-conferencing
description_ru    : Rocket.Chat позволяет общаться и сотрудничать с вашей командой, обмениваться файлами, общаться в режиме реального времени или переключаться на видео/аудиоконференции
audit_schedule    : 
editor            : 
keywords          : 
licence           : MIT
homepage          : https://rocket.chat
package_uuid      : b1ee9e86-1115-4d2d-86ce-d33e6e966684
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 11
max_os_version    : 
icon_sha256sum    : b8127266889154a1af4f52b3add4e58cbb948d26621a60a81a5ce52243b4ed21
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-08-02T22:09:46.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : ExCIndA19Kp6eVScu4lSLfRq0wDgmzCymKOi3GPZVqt7t6WpCVsx37UyGLMs3IQFxKAiTAEvvzi4UZOnNQRcs4C09lRapBUWK5x4BgpZwrWcYZv7foAx3utFSZ8TjX+31NvgQCQwcxxva+LymkSbpYjz3PfA8NyJesGy7rm1Qq8e8m8FmBulXoPbLY/3xkKQkc2kmVm2dtuWmkIJZOyltlI9y+7wHtY1+S1dzSkc7RJKbzb5I5i0CMLTp3cCTIc2Vt5aWLBfnlKum8GuM6oDJ9St6J7LCRG3gN8PRhDL0icwB24j/Sz8imb16nYWe/U/NJIN9ADy7VxhogKI72ptKg==

# -*- coding: utf-8 -*-
from setuphelpers import *
import jinja2
from waptcrypto import SSLCertificate, SSLPrivateKey
import time


front_web = 'nginx' # nginx,none
rocketchat_url = 'https://rocketchat.yourdomain.com'
generate_ssl_cert = True # Values : True / False. Use False if you use commercial, Let's Encrypt or your PKI certificate.
# In this case, please configure "ssl_certificate_path" and "ssl_key_path" around line 220.
ssl_certificate_path = None # Set None if generate_ssl_cert = True
ssl_key_path = None # Set None if generate_ssl_cert = True

def systemd_enable_start_service(servicename):
    return run('LANG=C systemctl enable --now %s' % (servicename))


def install():
    print('Install dependances')
    install_apt('curl')
    install_apt('build-essential')
    install_apt('graphicsmagick')
    install_apt('sudo')

    print('If upgrade, stop Rocket.Chat')
    try:
        systemd_stop_service('rocketchat')
        first_install = False
    except:
        print("It's the first install")
        first_install = True

    print('Stop MongoDB Server')
    systemd_stop_service('mongod')

    print('Extact archive')
    run('tar xzf rocket.chat.tgz -C /tmp')

    print('Install node dependancies')
    print(run('(cd /tmp/bundle/programs/server; npm i)'))

    if not first_install:
        print('Remove old files')
        remove_tree('/opt/Rocket.Chat')

    print('Move files')
    copytree2('/tmp/bundle','/opt/Rocket.Chat')

    if first_install:
        print('Create rocketchat user')
        run('sudo useradd -M rocketchat && sudo usermod -L rocketchat')

    print('Set user rights')
    run('sudo chown -R rocketchat:rocketchat /opt/Rocket.Chat')

    node_path = run('which node').split('\n')[0]

    if first_install:
        print('Create service file')
        service = f"""[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
[Service]
Environment=ROOT_URL=http://localhost:3000
Environment=PORT=3000
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01
Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01
ExecStart={node_path} /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
[Install]
WantedBy=multi-user.target
"""

        with open('/lib/systemd/system/rocketchat.service','w') as service_file:
            service_file.write(service)
           
        run('systemctl daemon-reload')

    #if first_install:
    print('Configure MongoDB Server for Rocket.Chat')
    filecopyto('files/mongod.conf','/etc/mongod.conf')
        
    print('Start MongoDB Server')
    systemd_start_service('mongod')

    if first_install:
        time.sleep(10)
        print('Create the replicaset')
        run('mongosh --eval "printjson(rs.initiate())"')

    systemd_enable_start_service('rocketchat')

    if first_install:
        if front_web == 'nginx':
            print('Install Nginx')
            install_apt('nginx')

            jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader('templates'))
            template = jinja_env.get_template('nginx.conf.j2')

            print('Generate dhparam')
            run('openssl dhparam -out /etc/nginx/dhparam 2048')

            if generate_ssl_cert:
                print('Generate SSL key and certificate')
                ap_ssl_dir = makepath('/etc','ssl')
                mkdirs(ap_ssl_dir)
                key_fn = os.path.join(ap_ssl_dir,'private','rocketchat_key.pem')
                key = SSLPrivateKey(key_fn)
                if not os.path.isfile(key_fn):
                    print('Create SSL RSA Key %s' % key_fn)
                    key.create()
                    key.save_as_pem()

                cert_fn = os.path.join(ap_ssl_dir,'certs','rocketchat_cert.pem')
                if os.path.isfile(cert_fn):
                    crt = SSLCertificate(cert_fn)
                    if os.path.isfile(cert_fn):
                        crt = SSLCertificate(cert_fn)
                        if crt.cn != get_fqdn():
                            os.rename(cert_fn,"%s-%s.old" % (cert_fn,'{:%Y%m%d-%Hh%Mm%Ss}'.format(datetime.datetime.now())))
                            crt = key.build_sign_certificate(cn=get_fqdn(),is_code_signing=False)
                            print('Create X509 cert %s' % cert_fn)
                            crt.save_as_pem(cert_fn)
                else:
                    crt = key.build_sign_certificate(cn=get_fqdn(),is_code_signing=False)
                    print('Create X509 cert %s' % cert_fn)
                    crt.save_as_pem(cert_fn)

                template_variables = {
                    'rocketchat_url': rocketchat_url.replace('https://','').replace('http://',''),
                    'ssl_certificate_path': cert_fn.replace('\\','/'),
                    'ssl_key_path': key_fn.replace('\\','/')
                }
            else:
                template_variables = {
                    'rocketchat_url': rocketchat_url.replace('https://','').replace('http://',''),
                    'ssl_certificate_path': makepath('/etc','ssl','certs','rocketchat_cert.pem'),
                    'ssl_key_path': makepath('/etc','ssl','private','rocketchat_key.pem')
                }

            config_string = template.render(template_variables)
            print('Create Nginx configuration file %s' % makepath('/etc','nginx','sites-avalables','rocketchat.conf'))
            with open(makepath('/etc','nginx','sites-available','rocketchat.conf'), 'wt') as dst_file:
                dst_file.write(config_string)

            print('Create symlink to activate rocketchat site')
            if not os.path.exists('/etc/nginx/sites-enabled/rocketchat.conf'):
                print(run('ln -s /etc/nginx/sites-available/rocketchat.conf /etc/nginx/sites-enabled/rocketchat.conf'))

            print('Test Nginx configuration and start nginx')
            print(run('nginx -t'))
            print(run('systemctl restart nginx'))
            print(run('systemctl enable nginx'))

        else:
            print('No front web selected.')

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform
import json

# Declaring specific app values (TO CHANGE)
package_name = "rocketchat-server"


def update_package():
    print("Download/Update package content from upstream binary sources")

    # Getting proxy informations from WAPT settings
    proxy = {}
    if platform.system() == "Windows" and isfile(makepath(user_local_appdata(), "waptconsole", "waptconsole.ini")):
        proxywapt = inifile_readstring(makepath(user_local_appdata(), "waptconsole", "waptconsole.ini"), "global", "http_proxy")
        if proxywapt:
            proxy = {"http": proxywapt, "https": proxywapt}

    # Specific app values
    app_name = control.name
    git_repo = "RocketChat/Rocket.Chat"
    url_api = "https://api.github.com/repos/%s/releases" % git_repo

    version = sorted(json.loads(wgets(url_api, proxies=proxy)), key=lambda p: (Version(p['tag_name'] if not 'rc' in p['tag_name'].lower() else '0')), reverse=True)[0]['tag_name']

    url_dl_deb = f'https://releases.rocket.chat/{version}/download'

    latest_bin_deb = "rocket.chat.tgz"

    print("Latest " + app_name + " version is: " + version)
    print("Download url for APT-based systems is: " + url_dl_deb)

    # Downloading latest binaries
    if not isfile(latest_bin_deb):
        print("Downloading: " + latest_bin_deb)
        wget(url_dl_deb, latest_bin_deb, proxies=proxy)

        # Changing version of the package
        control.version = "%s-%s" % (version, int(control.version.split("-", 1)[1]) + 1)
        control.save_control_to_wapt()
        print("Changing version to " + control.version + " in WAPT\\control")
    else:
        print("This package is already up-to-date")

    # Deleting outdated binaries
    for bin_in_dir in glob.glob("*.deb"):
        if bin_in_dir != latest_bin_deb:
            print("Outdated binary: " + bin_in_dir + " Deleted")
            remove_file(bin_in_dir)

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
25a5517b9cd8fd4f882fa62c611e8f986e579e9aa7f7ace858b6df03d4b9a5dd : WAPT/control
b8127266889154a1af4f52b3add4e58cbb948d26621a60a81a5ce52243b4ed21 : WAPT/icon.png
0a5e172371303f7055b31e81aa342338f48812f652de307b3e57747d4584880e : files/mongod.conf
d5b75331960ba0932a0c448b57bd051322af6fedfa92995718f76fcb7aff8b60 : luti.json
4da75eac1e9622407fb4f69a300a1a2b30579b9a4d1634cab808a5b2c9c1b03e : rocket.chat.tgz
30c22adc9a736ca9242874fd195bbf405e18d64e566a4a5164a2f1e0dce8393c : setup.py
b756e700ac759d47470452f0956806bccb9176bd7eca87b35745f0b268b62422 : templates/nginx.conf.j2
efad812768d9da972dad8b494087217a0711f158b83e04aade4853e14345f777 : update_package.py