In order to use the multi user editing, the plug-in FrontEndMessageBus must be enabled, the socket server started and properly configured.
One Socket Server can be used by multiple translate5 installations on the same server.
Please follow the following steps to do soinstalla and configure.
Installation of dependencies (developers only)
...
Code Block |
---|
language | bash |
---|
title | Installation of dependencies |
---|
|
# until it is clear how we embed all the dependencies into translate5 we have to do the following for installation:
# go into the bus-server directory of the FrontEndMessageBus plug-in
cd application/modules/editor/Plugins/FrontEndMessageBus/bus-server
# Install composer with the following code (code from https://getcomposer.org/download/):
# if the following commands to get the composer produces an error, go to getcomposer.org and follow the updated instructions there.
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
# Install all needed dependencies
php composer.phar update
# go back to application/modules/editor/Plugins/FrontEndMessageBus
cd ..
# start MessageBus Server:
php server.php |
Configuration of the Socket Server (SSL enabled)
Apache proxy configuration
Code Block |
---|
title | Example Apache configuration |
---|
|
# enable the proxy modules in main apache configuration
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so
#
# example configuration of virtual host running translate5
#
<VirtualHost *:80>
ServerName example.translate5.net
DocumentRoot /usr/srv/example.translate5.net/public
# HTTP access is forbidden by redirecting always to HTTPS
Redirect permanent / https://example.translate5.net/
</VirtualHost>
<VirtualHost *:443>
ServerName example.translate5.net
DocumentRoot /usr/srv/example.translate5.net/public
SSLEngine on
SSLProxyEngine on # The SSLProxyEngine must be enabled, otherwise you will get errors from apache on reload
ProxyPass /wss ws://example.translate5.net:9056/ # IMPORTANT: the domain here MUST match the configured domain in the Socket Server configuration in config.php (see below)
</VirtualHost>
<VirtualHost *:443>
ServerName anotherexample.translate5.net
DocumentRoot /usr/srv/anotherexample.translate5.net/public
SSLEngine on
# IMPORTANT: Another translate5 installation may use the same socket server,
# BUT the socket server may be configured only with one domain!
# Therefore for anotherexample no separate proxypass is needed because the
# GUI must then be configured to use also wss://example.translate5.net!
</VirtualHost> |
Conclusion when using multiple Translate5 installations on one socket server
When using multiple translate5 installations on one server, they all can share one socket server. This is perfeclty possible due instance isolation in the socket server.
A separate virtualHost (for exmaple socketserver.translate5.net) may be configured then with the above proxy pass. All translate5 installations must be configured then to use socketserver.translate5.net as socket server.
Socket Server configuration in config.php
In application/modules/editor/Plugins/FrontEndMessageBus resides the file "config.php.example". Copy that file to config.php, and open it for editing.
Code Block |
---|
language | php |
---|
title | Socket Server Config for above mentioned setup |
---|
|
$configuration = [
'messageServer' => [
//address: IP address to listen for connections of translate5 instances
// MUST match the server configured in messageServer config in the instance.
'address' => '127.0.0.1',
//port: Port to listen on.
// MUST match the messagePort config in the instance.
'port' => '9057',
],
'socketServer' => [
//httpHost: HTTP hostname clients intend to connect to.
// IMPORTANT MUST match the socketServer config in the translate5 instance and (if used) in Apache ProxyPass statement!
// (MUST match JS `new WebSocket('ws://$httpHost');`)
'httpHost' => 'example.translate5.net',
//port: Port to listen on.
// MUST match the socketPort config in the instance.
'port' => '9056',
//listen: IP address to bind to. '0.0.0.0' for any interface.
'listen' => '0.0.0.0',
//route: The URL path to be used for the socket server, defaults to /translate5 and should normally not to be changed.
// When using SSL via ProxyPass, the proxy path (/tobedefined/ in the above example) MUST NOT added here!
'route' => '/translate5', // IMPORTANT although the ProxyPass /wss is used in the example, this MUST NOT added here!
]
]; |
Translate5
In the translate5 the following lines should either added to installation.ini or should be changed in the DB table Zf_Configuration:
Code Block |
---|
title | Configuration of translate5 |
---|
|
runtimeOptions.plugins.active[] = "editor_Plugins_FrontEndMessageBus_Init"
runtimeOptions.plugins.FrontEndMessageBus.socketServer.httpHost = example.translate5.net ; MUST be set to the socketServer['httpHost'] in above config.php
; MUST be set to the ProxyPass path target domain in above apache config
; regardless if the translate5 server name is different!
runtimeOptions.plugins.FrontEndMessageBus.socketServer.schema = wss ; MUST be set to the ProxyPass alias path in above apache config
runtimeOptions.plugins.FrontEndMessageBus.socketServer.port = 443 ; MUST be set to your apache SSL port, normally 443
runtimeOptions.plugins.FrontEndMessageBus.socketServer.route = /wss/translate5 ; MUST match the ProxyPass Alias + the route configured in config.php
|
Trouble-shooting (TODO)
- Possible problems: using HTTPS but no wss schema: must be defined as error in MessageBus.js!
- Browser Error: WebSocket connection to 'wss://example.translate5.net/wss/translate5?serverId=xxx&sessionId=xxx' failed: Error during WebSocket handshake: Unexpected response code: 503
- Either the socket server is down, or the proxy is configured wrong. Apache can not route the request to the socket server.
- Browser Error: WebSocket connection to 'wss://example.translate5.net/wss/translate5?serverId=xxx&sessionId=xxx' failed: Error during WebSocket handshake: Unexpected response code: 404
- The 404 is coming from the socket server. This means the basic proxy config is correct, but one of the 3 configurable hostnames (config.php / ProxyPass / installation.ini) does not match.
Configuration of the Socket Server (without SSL, for development only!)
Since no SSL is used in this configuration, no Apache WSS Proxy is needed, the configuration is easy then. Mostly the default values can be used.
Socket Server
Code Block |
---|
# in config.php all default values can be used unchanged, only httpHost must be set to your needs:
'httpHost' => 'SET.A.VALID.HOSTNAME.HERE', |
Translate5
Code Block |
---|
|
; add the following lines to the installation.ini
runtimeOptions.plugins.active[] = "editor_Plugins_FrontEndMessageBus_Init"
runtimeOptions.plugins.FrontEndMessageBus.socketServer.httpHost = SET.A.VALID.HOSTNAME.HERE ; MUST be the same as above in httpHost |