passer par un alias pour les websockets
This commit is contained in:
parent
01da55e6d6
commit
6081e6a692
|
@ -2,6 +2,7 @@
|
|||
<creole>
|
||||
<files>
|
||||
<file filelist='ninegate' name='/etc/eole/eole-db.d/ninegate-db.yml' rm='True' mkdir='True'/>
|
||||
<file filelist='ninegate_nginx' name='/etc/nginx/web.d/ninegate.conf' source='ninegate-nginx.conf' rm='True' mkdir='True' />
|
||||
</files>
|
||||
|
||||
<containers>
|
||||
|
@ -9,6 +10,7 @@
|
|||
<package>ninegate-apps</package>
|
||||
|
||||
<file filelist='ninegate' name='/etc/apache2/sites-available/ninegate' source='ninegate-apache.conf' rm="True"/>
|
||||
<file filelist='ninegate' name='/lib/systemd/system/wssninegate.service' source='ninegate.service'/>
|
||||
<file filelist="ninegate" name="/var/www/html/ninegate/app/config/parameters.yml" source="ninegate-parameters.yml" rm="True"/>
|
||||
<file filelist="ninegate" name="/var/www/html/ninegate/app/config/template.yml" source="ninegate-template.yml" rm="True"/>
|
||||
<file filelist="ninegate" name="/var/www/html/ninegate/scripts/ninegate-postservice-00.sh" source="ninegate-postservice-00.sh" rm="True" mode="700" />
|
||||
|
@ -18,11 +20,6 @@
|
|||
<file filelist='ninegate-migration' name='/var/www/html/envole-migration/config/config-db-ninegate.php' source='ninegate-migration.php' mkdir='True'/>
|
||||
|
||||
<service method='apache' servicelist='ninegate'>ninegate</service>
|
||||
|
||||
<service_access service='ninegate_websocket'>
|
||||
<port port_type="SymLinkOption">ninegate_websocket_portexterne</port>
|
||||
</service_access>
|
||||
|
||||
</container>
|
||||
</containers>
|
||||
|
||||
|
@ -372,19 +369,6 @@
|
|||
<variable type='string' name='ninegate_widwordpress_url' description='URL complète de votre Wordpress' mandatory='True' />
|
||||
<variable type='string' name='ninegate_widwordpress_syncenvole' description='URL Posh-Profil pour synchronisation Wordpress' mandatory='True' />
|
||||
|
||||
|
||||
|
||||
<!-- WEBSOCKET -->
|
||||
<variable type='string' name='ninegate_websocket_url' description='Host du serveur Websocket' mandatory='True' />
|
||||
<variable type='string' name='ninegate_websocket_portexterne' description='Port de commuinication externe du serveur Websocket' mandatory='True' >
|
||||
<value>5555</value>
|
||||
</variable>
|
||||
<variable type='string' name='ninegate_websocket_portinterne' description='Port de commuinication interne du serveur Websocket' mandatory='True'>
|
||||
<value>5556</value>
|
||||
</variable>
|
||||
|
||||
|
||||
|
||||
<!-- EMAIL -->
|
||||
<variable type='string' name='ninegate_noreply' description='Adresse mail utilisé pour le noreply' mandatory='True' />
|
||||
<variable type="oui/non" name='ninegate_activer_localmail' description="Utiliser le serveur d'envoi de mail local" mandatory='True'>
|
||||
|
@ -441,7 +425,7 @@
|
|||
<separator name="ninegate_activate_widroundcube">Paramètres associés à Roundcube</separator>
|
||||
<separator name="ninegate_activate_widsacoche">Paramètres associés à Sacoche</separator>
|
||||
<separator name="ninegate_activate_widwordpress">Paramètres associés à Wordpress</separator>
|
||||
<separator name="ninegate_websocket_url">Paramètres associés au Serveur WEBSOCKET</separator>
|
||||
<separator name="ninegate_activate_websocket">Paramètres associés au Serveur WEBSOCKET</separator>
|
||||
<separator name="ninegate_noreply">Paramètres associés aux Mails</separator>
|
||||
<separator name="ninegate_db_mode">Paramètres EoleDB associés à Ninegate</separator>
|
||||
</separators>
|
||||
|
@ -453,6 +437,11 @@
|
|||
<target type='variable'>activer_ninegate</target>
|
||||
</condition>
|
||||
|
||||
<condition name='hidden_if_in' source='activer_revprox'>
|
||||
<param>non</param>
|
||||
<target type='filelist'>nineboard_nginx</target>
|
||||
</condition>
|
||||
|
||||
<condition name='hidden_if_in' source='activer_ninegate'>
|
||||
<param>non</param>
|
||||
|
||||
|
@ -529,6 +518,7 @@
|
|||
<target type='variable'>ninegate_dbpass</target>
|
||||
|
||||
<target type='filelist'>ninegate</target>
|
||||
<target type='filelist'>ninegate_nginx</target>
|
||||
<target type='filelist'>ninegate-migration</target>
|
||||
|
||||
<target type='servicelist'>ninegate</target>
|
||||
|
@ -796,25 +786,6 @@
|
|||
<target type='variable'>ninegate_widsacoche_syncenvole</target>
|
||||
</condition>
|
||||
|
||||
|
||||
<!-- AFFICHAGE EN FONCTION DU MODULE WEBSOCKET -->
|
||||
<condition name='hidden_if_in' source='ninegate_activate_websocket'>
|
||||
<param>non</param>
|
||||
|
||||
<target type='variable'>ninegate_websocket_url</target>
|
||||
<target type='variable'>ninegate_websocket_portinterne</target>
|
||||
<target type='variable'>ninegate_websocket_portexterne</target>
|
||||
<target type='servicelist'>ninegate_websocket</target>
|
||||
</condition>
|
||||
|
||||
<fill name='calc_multi_condition' target='ninegate_websocket_url'>
|
||||
<param>oui</param>
|
||||
<param type='eole' name='condition_1' hidden='False'>activer_apache</param>
|
||||
<param type='eole' name='match' hidden='False'>web_url</param>
|
||||
<param name='default_mismatch'>None</param>
|
||||
</fill>
|
||||
|
||||
|
||||
<!-- AFFICHAGE EN FONCTION DU WIDGET ADMINER -->
|
||||
<fill name='calc_multi_condition' target='ninegate_activate_widadminer'>
|
||||
<param>oui</param>
|
||||
|
|
|
@ -127,16 +127,16 @@ gos_web_socket:
|
|||
firewall: main
|
||||
shared_config: true
|
||||
server:
|
||||
port: %websocket_port% #The port the socket server will listen on
|
||||
host: %websocket_host% #The host ip to bind to
|
||||
port: 443 #The port the socket server will listen on
|
||||
host: %weburl%/wssninegate #The host ip to bind to
|
||||
|
||||
router:
|
||||
resources:
|
||||
- "@CadolesWebsocketBundle/Resources/config/topic.yml"
|
||||
pushers:
|
||||
wamp:
|
||||
host: %websocket_host%
|
||||
port: %websocket_portinterne%
|
||||
host: 0.0.0.0
|
||||
port: 5556
|
||||
|
||||
# ckeditor configuration
|
||||
ivory_ck_editor:
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#!/bin/bash
|
||||
websocket_url=$(CreoleGet adresse_ip_eth0 non)
|
||||
websocket_portinterne=$(CreoleGet ninegate_websocket_portinterne non)
|
||||
|
||||
# Server Websocket
|
||||
if [[ "$1" != "restartifdown" ]]; then
|
||||
echo WEBSOCKET = STOP
|
||||
pid="$(pgrep -a -f gos:websocket | grep $websocket_portinterne)"
|
||||
pid="$(pgrep -a -f gos:websocket | grep 5556)"
|
||||
if [ -n "${pid}" ]; then
|
||||
IFS=' ' read -r -a array <<< "$pid"
|
||||
kill -9 ${array[0]};
|
||||
|
@ -13,7 +11,7 @@ if [[ "$1" != "restartifdown" ]]; then
|
|||
fi
|
||||
|
||||
# Port LISTEN ?
|
||||
pid="$(pgrep -a -f gos:websocket | grep $websocket_portinterne)"
|
||||
pid="$(pgrep -a -f gos:websocket | grep 5556)"
|
||||
restart="yes"
|
||||
if [ "$1" == "restartifdown" ] && [ -n "${pid}" ] ; then
|
||||
restart="no"
|
||||
|
@ -22,5 +20,5 @@ fi
|
|||
if [ "$restart" == "yes" ] && [ "$1" != "stop" ] ; then
|
||||
echo WEBSOCKET = START
|
||||
cd /var/www/html/ninegate
|
||||
bin/console gos:websocket:server --port $websocket_portinterne -a $websocket_url --no-debug -n -q --env=prod & disown
|
||||
systemctl restart wssninegate
|
||||
fi
|
|
@ -318,49 +318,6 @@
|
|||
loadmsgCounter()
|
||||
}, {{(app.session.get("timerefreshnotif")*1000)}});
|
||||
{% endif %}
|
||||
|
||||
// Init socket de counter
|
||||
/* Désactiver car il semble préférable de faire un appel ajax régulier plutot qu'ouvrir un channel websocket
|
||||
{% if websocket_activate %}
|
||||
var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}";
|
||||
|
||||
var webSocket = WS.connect(_WS_URI);
|
||||
|
||||
webSocket.on("socket/connect", function (session) {
|
||||
// The callback function in "subscribe" is called everytime an event is published in that channel.
|
||||
session.subscribe("websocket/counter", function (uri, payload) {
|
||||
if(payload.log) {
|
||||
console.log("Received message", payload.log);
|
||||
}
|
||||
if(payload.alert) {
|
||||
alert(payload.alert);
|
||||
}
|
||||
{% if app.user %}
|
||||
if(payload.from!="{{app.user.id}}") {
|
||||
menu=$("a[data-group='"+payload.group+"']");
|
||||
if(menu.length) {
|
||||
if(payload.add) {
|
||||
console.log("Ajout counter pour group "+payload.group+" by "+payload.from);
|
||||
if(menu.children(".badge").length) {
|
||||
menu.children(".badge").html(+(menu.children(".badge").html())+1);
|
||||
}
|
||||
else menu.append("<span id='badge-"+payload.group+"' class='badge'>1</span");
|
||||
}
|
||||
}
|
||||
}
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
$(document).on('click', '#refreshcounter', function(){
|
||||
{% if app.user %}
|
||||
event=$(this).data("event");
|
||||
event.userid={{app.user.id}}
|
||||
session.publish("websocket/counter", event);
|
||||
{% endif %}
|
||||
});
|
||||
});
|
||||
{% endif %}
|
||||
*/
|
||||
});
|
||||
|
||||
$(window).resize(function() {
|
||||
|
|
|
@ -51,12 +51,16 @@ class ChatController extends Controller
|
|||
if(!$group) die();
|
||||
|
||||
// Génération d'une clé temporaire d'accès au chat
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["group"=>$group,"user"=>$user]);
|
||||
$key=null;
|
||||
if($usergroup) {
|
||||
$usergroup->setKeyvalue($key);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
$key=$usergroup->getKeyvalue();
|
||||
if(is_null($key)) {
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup->setKeyvalue($key);
|
||||
$em->persist($usergroup);
|
||||
$em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -362,7 +362,8 @@
|
|||
|
||||
function websocket()
|
||||
{
|
||||
var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}";
|
||||
var _WS_URI = "wss://{{ gos_web_socket_server_host }}";
|
||||
console.log(_WS_URI);
|
||||
webSocket = WS.connect(_WS_URI,{retryDelay: delayRetry});
|
||||
|
||||
webSocket.on("socket/connect", function (sess) {
|
||||
|
|
|
@ -9,23 +9,6 @@ Alias /ninegate /var/www/html/ninegate/web
|
|||
</Directory>
|
||||
|
||||
%if %%getVar("ninegate_activate_websocket", 'non') == "oui"
|
||||
Listen %%adresse_ip_eth0:%%ninegate_websocket_portexterne
|
||||
<VirtualHost %%adresse_ip_eth0:%%ninegate_websocket_portexterne>
|
||||
ErrorLog /var/log/apache2/ssl_error.log
|
||||
CustomLog /var/log/apache2/ssl_access.log common
|
||||
SSLEngine on
|
||||
%if %%cert_type == "letsencrypt"
|
||||
SSLCertificateFile /etc/ssl/letsencrypt/conf/live/%%ninegate_websocket_url/cert.pem
|
||||
SSLCertificateKeyFile /etc/ssl/letsencrypt/conf/live/%%ninegate_websocket_url/privkey.pem
|
||||
%else
|
||||
SSLCertificateFile %%server_cert
|
||||
SSLCertificateKeyFile %%server_key
|
||||
%end if
|
||||
SSLProtocol all -SSLv3 -SSLv2
|
||||
ServerName %%ninegate_websocket_url
|
||||
RewriteEngine On
|
||||
|
||||
ProxyPass / ws://%%adresse_ip_eth0:%%ninegate_websocket_portinterne retry=0 keepalive=On
|
||||
ProxyPassReverse / ws://%%adresse_ip_eth0:%%ninegate_websocket_portinterne retry=0
|
||||
</VirtualHost>
|
||||
ProxyPass /wssninegate ws://0.0.0.0:5556 retry=0 keepalive=On
|
||||
ProxyPassReverse /wssninegate ws://0.0.0.0:5556 retry=0
|
||||
%end if
|
|
@ -0,0 +1,6 @@
|
|||
location /wssninegate {
|
||||
proxy_pass https://%%container_ip_web;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
|
@ -52,14 +52,8 @@ parameters:
|
|||
%end if
|
||||
%if %%getVar("ninegate_activate_websocket", 'non') == "oui"
|
||||
websocket_activate: true
|
||||
websocket_host: %%ninegate_websocket_url
|
||||
websocket_port: %%ninegate_websocket_portexterne
|
||||
websocket_portinterne: %%ninegate_websocket_portinterne
|
||||
%else
|
||||
websocket_activate: false
|
||||
websocket_host: %%web_url
|
||||
websocket_port: 80
|
||||
websocket_portinterne: 80
|
||||
%end if
|
||||
%if %%getVar("ninegate_activate_portal", 'non') == "oui"
|
||||
portal_activate: true
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Ninegate websocket server
|
||||
After=local-fs.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/var/www/html/ninegate/bin/console gos:websocket:server --port 5556 -a 0.0.0.0 --no-debug -n -q --env=prod
|
||||
Restart=on-watchdog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue