Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Starting the socket server

Basic usage and testing

For basic usage and testing the socket server can be run directly via commandline by calling the server.php in the FrontendMessageBus directory:

Code Block
php server.php

Productive usage - start the socket server via supervisord

For productive usage the server.php should be run as daemon, for example with supervisord as recommended in the documentation of the used ratchet library.

supervisord installation

For installation of supervisord see http://supervisord.org/installing.html and for running http://supervisord.org/running.html.

...

For integration of supervisord in boot up, either a start script was provided by your linux distribution or follow the instructions in: https://serverfault.com/questions/96499/how-to-automatically-start-supervisord-on-linux-ubuntu

If installed via apt under Ubuntu, just call "systemctl enable --now supervisor"

supervisord configuration

Follow the supervisor installation instructions to create proper config templates., or if installed with apt just create the following file in /etc/supervisord/conf.d/

Create a program section Then create a program section for translate5 messagebus:

Code Block
title/etc/supervisord/translate5_message_bus.iniconf
[program:t5socketserver]
command                 = bash -c "exec /usr/bin/php /pathToMessageBus/server.php"
process_name            = Translate5SocketServer
numprocs                = 1
autostart               = true
autorestart             = true
user                    = t5messagebus
stdout_logfile          = /var/log/supervisor/t5-messagebus.log
stdout_logfile_maxbytes = 1MB
stderr_logfile          = /var/log/supervisor/t5-messagebus-error.log
stderr_logfile_maxbytes = 1MB

Impotant: restart supervisord after creating the above config.

After that the messagebus server should be started automatically. To verify this do:

Code Block
sudo supervisorctl status all# this should output then:t5socketserver:Translate5SocketServer   RUNNING   pid 979, uptime 4:37:43