• Initial condition V4 MIT, resulting in V6 PRO
  • License Debugging
  • Installing MeiliSearch
  • Checking postgresql settings
  • Update 4* — 6* MIT-PRO

    Initial condition V4 MIT, resulting in V6 PRO

    admin (1 pc), service, and cron are not considered users, licenses are needed for others — first register, pay, and issue a license at ru.totum.online/pro

    If you have multiple installations on the server, this instruction assumes that they are all being upgraded to the new version.

    When transitioning from V4, it is impossible to verify the correctness of the license, so be careful when specifying the host and schema! The schema is indicated in the technical panel at the top right of your system (to the left of the version, default is totum).

    Also, make sure that the license contains a sufficient number of users.

    V5 uses web-sockets, so if you use intermediate proxies, you need to configure them in advance. To ensure that WebSocket requests are not lost when passing through an intermediate proxy server before Nginx, make sure that this proxy correctly processes and forwards the Upgrade and Connection headers used to establish WebSocket connections.

    Log in to the server and update the repositories:

    apt update
    

    Install PHP 8.3:

    apt -y install php8.3 php8.3-bcmath php8.3-cli php8.3-curl php8.3-fpm php8.3-gd php8.3-mbstring php8.3-opcache php8.3-pgsql php8.3-xml php8.3-zip php8.3-soap php8.3-ldap
    

    Transfer fpm pool settings to version 8.3:

    rm /etc/php/8.3/fpm/pool.d/www.conf && mv /etc/php/8.0/fpm/pool.d/totum.conf /etc/php/8.3/fpm/pool.d/totum.conf && sed -i "s:php8.0:php8.3:g" /etc/php/8.3/fpm/pool.d/totum.conf && sed -i "s:php8.0:php8.3:g" /etc/nginx/sites-available/totum.online.conf && sed -i "/jit_buffer_size/d" /etc/php/8.3/fpm/pool.d/totum.conf && sed -i '/php_admin_value\[opcache.enable_cli\] = 1/d' /etc/php/8.3/fpm/pool.d/totum.conf && service php8.3-fpm restart
    

    Add web-socket proxying to nginx settings:

    nano /etc/nginx/sites-available/totum.online.conf
    

    Insert the section before location ~* \.php$ {:

        # functionality for web sockets
        location /PRONotify {
        proxy_pass http://localhost:8181/PRONotify;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 600s;
        }
        # ...
    

    Save the file Ctrl + S and restart nginx:

    service nginx restart
    

    Remove PHP 8.0:

    service php8.0-fpm stop && apt -y purge php8.0 php8.0-bcmath php8.0-cli php8.0-curl php8.0-fpm php8.0-gd php8.0-mbstring php8.0-opcache php8.0-pgsql php8.0-xml php8.0-zip php8.0-soap php8.0-ldap
    

    Remove leftovers:

    apt autoremove
    

    Answer Y

    apt clean
    

    Check PHP version:

    php -v
    

    Set permission for restart by user totum using output redirection:

    echo 'totum ALL=(ALL) NOPASSWD: /usr/sbin/service totum-gom restart' | sudo tee /etc/sudoers.d/restart-totum-gom && sudo chmod 440 /etc/sudoers.d/restart-totum-gom
    

    Switch to Totum user:

    su totum
    
    cd ~/totum-mit
    

    Connect PRO repository:

    git remote set-url origin https://github.com/totumonline/totum-pro.git
    

    Download data:

    git fetch origin pro
    

    Switch to the new pro branch:

    git checkout -b pro origin/pro -t
    

    Update scripts:

    git pull
    

    Create GOM-service:

    exit
    
    ln -s /home/totum/totum-mit/totum-gom.service /etc/systemd/system/totum-gom.service && systemctl daemon-reload && systemctl enable totum-gom && service totum-gom start && service totum-gom status
    

    Check server timezone:

    cat /etc/php/8.3/fpm/pool.d/totum.conf
    

    Copy the timezone from the line php_admin_value[date.timezone] = Europe/Madid (Europe/Madrid copy this part).

    Return to totum:

    su totum
    

    Create file CLI.totum.php.ini (replace Europe/London with the timezone you copied in the previous step):

    nano /home/totum/totum-mit/CLI.totum.php.ini
    
    opcache.enable_cli = 1
    opcache.memory_consumption = 256M
    date.timezone = Europe/London
    
    cd ~/totum-mit && bin/totum git-update --force
    

    Be sure to obtain a valid license. Carefully check the host and database schemas when issuing the license!

    Create a license file:

    nano /home/totum/totum-mit/PRO.license
    

    Record the license obtained on the license server: license.totum-online.ru

    Record the license through the server console or its emulator! Do not use third-party file editors in your desktop operating system, or those provided by the hoster in the browser — they may add extra unreadable characters (such as line breaks) that will make the license file unreadable.

    The license is read by the system at the start of totum-gom (the totum module on GO).

    After saving the license file, you need to restart totum-gom:

    sudo service totum-gom restart
    

    You also need to check the number of active users in your system and ensure that there are enough slots in the license.

    You can check users with the command (see the TOTAL parameter at the bottom of the list) (change the schema totum to yours if it differs from the standard):

    cd /home/totum/totum-mit && bin/totum schema-users --schema=totum --list=on
    

    If you have multiple schemas on one server, they all must be covered by the license if there are more than 10 users in the schema.

    More about licenses, as well as information on how to disable users from the console in the installation documentation PRO-version.

    License Debugging

    If the system gives a license verification error when trying to log in:

    1. Check the file /etc/php/8.3/fpm/pool.d/totum.conf for the following lines:

      nano /etc/php/8.3/fpm/pool.d/totum.conf
      
      php_admin_value[session.gc_maxlifetime] = 3600
      php_admin_value[session.save_path] = /var/lib/php/sessions_totum
      

      If they are not present, add them as root and save.

      Create the directory:

      mkdir /var/lib/php/sessions_totum && chmod 1733 /var/lib/php/sessions_totum
      

      Restart FPM:

      service php8.3-fpm restart
      
    2. Obtain a test license on the license server and check if you have specified the hosts correctly using gomodule-test

      Switch to the totum user:

      su totum
      
      cd /home/totum/totum-mit
      

      Create the file PRO.license-test and write the test license obtained from the license server into it:

      nano PRO.license-test
      

      Run the check:

      bin/gomodule-test
      
    3. Run totum-gom in license debugging mode:

      Stop totum-gom as root

      service totum-gom stop
      

      Switch to the totum user:

      su totum
      
      cd /home/totum/totum-mit
      

      Run totum-gom in debug mode:

      /home/totum/totum-mit/bin/gomodule -php-sessions-directory /var/lib/php/sessions_totum -totum-directory /home/totum/totum-mit/ -log=ln
      

      After debugging, stop and start totum-gom as a service:

      sudo service totum-gom restart
      
      • with sudo this command can be executed from the totum user

    Installing MeiliSearch

    Execute as root, so exit the totum user:

    exit
    

    Add the meilisearch repository:

    echo "deb [trusted=yes] https://apt.fury.io/meilisearch/ /" > /etc/apt/sources.list.d/fury.list
    
    apt update && apt install meilisearch-http
    

    Meilisearch cannot be updated without dumping the database, as it may not start after an update due to differences between the database file and the package.

    To do this, you need to add the package to hold: apt-mark hold meilisearch-http

    Switch to the Totum user:

    su totum
    

    Go to the home directory:

    cd ~
    

    Create a key file and enter a random key using a - z, A - Z, 0 - 9 (to save Ctrl + X, enter Y and Enter):

    nano meili_masterkey
    

    Start the search server:

    meilisearch --no-analytics --db-path ./meilifiles --env production --master-key $(cat meili_masterkey) &
    

    Record the search start on server reboot:

    crontab -e
    

    Add the line at the end:

    @reboot cd ~ && exec meilisearch --no-analytics --db-path ./meilifiles --env production --master-key $(cat meili_masterkey) > /dev/null 2>&1 &
    

    The last line in crontab must be empty!

    To save Ctrl + X, enter Y and Enter.

    Further settings are done in the Totum schema.

    That's it!

    exit
    

    We also recommend updating all packages on the server to the latest versions:

    apt upgrade
    

    If asked about local configurations — choose to keep local ones as they are configured for your host

    Checking postgresql settings

    If you have many users working simultaneously, cron jobs, actively working remotes, and you are working with the standard postgresql configuration — the standard database connection pool (default 100) may be exhausted, as totum-gom uses its own connection pool in addition to PHP-FPM.

    If you see errors like:

    SQLSTATE[08006] [7] FATAL: remaining connection slots are reserved for non-replication superuser connections
    

    You need to increase them. As root, check the path to the configuration file:

    su - postgres -c "psql -c 'SHOW config_file;'"
    

    Open (for example):

    nano /etc/postgresql/12/main/postgresql.conf
    

    Find the max_connections parameter, change 100 > 300, save.

    Stop totum-gom:

    service totum-gom restart
    

    Restart the database:

    service postgresql restart
    

    Start totum-gom:

    service totum-gom start
    

    Also, make sure that your average server load does not exceed 20-25%. If it is higher and you are not a professional system administrator — increase the server plan to fit within the 25% average load limit.