Page tree

Versions Compared

Key

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

...

Configuration of the Socket Server (SSL enabled)

Warning

SSL: translate5 and the socket server must either run with SSL or both not. A mixture is not possible.

Timezone: if the messagebus runs on a different environment: The translate5 instances and the messagebus must run in the same timezone!

Apache proxy configuration

...

Warning

IMPORTANT: the domain in the ProxyPass command MUST match the configured domain in the Socket Server configuration in config.php (see below)

TESTING: The above setup can NOT be tested by calling "https://example.translate5.net/wss" in the browser! This will result in an HTTP 500 error with the following log entry: AH01144: No protocol handler was valid for the URL /wss (scheme 'ws'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
The correct function can only tested via translate5. If the FrontendMessageBus Plugin is enabled in translate5, there should be no error in the GUI. Then everything is setup correctly.



Code Block
titleExample Apache configuration
# enable the proxy 
Code Block
titleExample Apache configuration
# enable the proxy modules in main apache configuration (if not already done)
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so
LoadModule proxy_http2_module /usr/lib/apache2/modules/mod_proxy_http2.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.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>

...

Code Block
languagephp
titleSocket 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!
        //  In environments where an internal and external IP (AWS EC2 for example) is used, the ports must either mapped through, 
        //  or the httpHost should be set here to localhost where the proxypass points to too.
        // (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:

 '/translate5', // IMPORTANT although the ProxyPass /wss is used in the example, this MUST NOT added here!
    ]
];

Translate5

In the translate5 the following configurations should be set with translate5 CLI:

Code Block
languagebash
titleConfiguration of translate5
#
Code Block
titleConfiguration 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!
# regardless if the translate5 server name is different!
./translate5.sh config runtimeOptions.plugins.FrontEndMessageBus.socketServer.httpHost example.translate5.net

# MUST be set to the ProxyPass alias path in above apache config
./translate5.sh config runtimeOptions.plugins.FrontEndMessageBus.socketServer.schema = wss						 ; 

# MUST be set to the ProxyPassyour aliasapache pathSSL inport, above apachenormally 443
./translate5.sh config
 runtimeOptions.plugins.FrontEndMessageBus.socketServer.port = 443						 ; MUST be set to your apache SSL port, normally 443
 443

# MUST match the ProxyPass Alias + the route configured in config.php
./translate5.sh config runtimeOptions.plugins.FrontEndMessageBus.socketServer.route = /wss/translate5           ; MUST match the ProxyPass Alias + the route configured in config.php



Enable the frontend-messagebus plugin:

Code Block
languagebash
./translate5.sh plugin:enable FrontEndMessageBus


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.

...

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
languagebash
titleinstallation.ini
; add the following lines to the installation.ini
runtimeOptions.plugins.active[] = "editor_Plugins_FrontEndMessageBus_Init"
# call the following commands to configure translate5:
./translate5.sh plugin:enable FrontEndMessageBus

# MUST be the same HOSTNAME as above in httpHost:
./translate5.sh config runtimeOptions.plugins.FrontEndMessageBus.socketServer.httpHost = SET.A.VALID.HOSTNAME.HERE   ; MUST be the same as above in httpHost


Starting the socket server

...