Commit 9e2a4a78 authored by Štěpán Henek's avatar Štěpán Henek 🐻

foris+foris-ws: websocket url moved into lighttpd '/foris-ws'

parent 6e50e14d
......@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=foris-ws
PKG_VERSION:=0.1.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.labs.nic.cz/turris/foris-ws
......@@ -25,7 +25,7 @@ $(call include_mk, python-package.mk)
define Package/foris-ws
TITLE:=foris-ws
URL:=https://gitlab.labs.nic.cz/turris/foris-ws
DEPENDS:=+python-light +python-websocket-server +python-prctl +socat +rpcd +lighttpd-https-cert +python-ubus
DEPENDS:=+python-light +python-websocket-server +python-prctl +rpcd +foris-client +python-ubus +lighttpd-mod-proxy
MAINTAINER:=Stepan Henek <stepan.henek@nic.cz>
endef
......@@ -52,6 +52,8 @@ define Package/foris-ws/install
$(INSTALL_BIN) ./files/websocket-listen $(1)/usr/libexec/rpcd/websocket-listen
$(INSTALL_DIR) $(1)/usr/share/foris-ws/bin/
$(INSTALL_BIN) ./files/socat.sh $(1)/usr/share/foris-ws/bin/socat.sh
$(INSTALL_DIR) $(1)/etc/lighttpd/conf.d/
$(INSTALL_DATA) ./files/lighttpd-foris-ws.conf $(1)/etc/lighttpd/conf.d/foris-ws.conf
endef
define Package/foris-ws/postinst
......
......@@ -3,8 +3,7 @@ package 'ubus-ws'
config ubus-ws 'main'
option bus ubus
option insecure_port 9080
option secure_port 9443
option port 9080
option debug 0
config ubus 'ubus'
......
......@@ -22,12 +22,10 @@ STOP=1
USE_PROCD=1
PROG=/usr/bin/foris-ws
SOCAT=/usr/share/foris-ws/bin/socat.sh
start_service() {
config_load foris-ws
config_get secure_port main secure_port 9443
config_get insecure_port main insecure_port 9080
config_get port main port 9080
config_get_bool debug main debug 0
config_get bus main bus ubus
......@@ -38,15 +36,11 @@ start_service() {
procd_open_instance
if [ "$bus" == "ubus" ]; then
config_get path ubus path "/var/run/ubus.sock"
procd_set_param command "$PROG" ${debug_arg:-} -a ubus --host "0.0.0.0" --port "$insecure_port" ubus --path "$path"
procd_set_param command "$PROG" ${debug_arg:-} -a ubus --host "127.0.0.1" --port "$port" ubus --path "$path"
elif [ "$bus" == "unix-socket" ]; then
config_get path unix path "/var/run/ubus.sock"
procd_set_param command "$PROG" ${debug_arg:-} -a ubus --host "0.0.0.0" --port "$insecure_port" unix-socket --path "$path"
procd_set_param command "$PROG" ${debug_arg:-} -a ubus --host "127.0.0.1" --port "$port" unix-socket --path "$path"
fi
procd_set_param respawn
procd_close_instance
procd_open_instance
procd_set_param command "$SOCAT" "$insecure_port" "$secure_port"
procd_close_instance
}
$HTTP["url"] =~ "^/foris-ws$" {
proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => "9080" ) ) )
proxy.header = ( "upgrade" => "enable" )
}
......@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=foris
PKG_VERSION:=97
PKG_VERSION:=97.1
PKG_RELEASE:=1
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE_PROTO:=git
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment