uwsgi: add luci-support package
authorAnsuel Smith <redacted>
Wed, 13 Jun 2018 17:26:40 +0000 (19:26 +0200)
committerAnsuel Smith <redacted>
Thu, 14 Jun 2018 18:37:20 +0000 (20:37 +0200)
This adds additional specific files to support luci on the nginx

Signed-off-by: Ansuel Smith <redacted>
net/uwsgi-cgi/Makefile
net/uwsgi-cgi/files-luci-support/uwsgi.conf [new file with mode: 0644]
net/uwsgi-cgi/files-luci-support/uwsgi.init [new file with mode: 0644]

index 5034b201f5e939d9c3bea495156be7a07de47d96..f7ede32a26d251b047db1d861ac6f79c340872ad 100644 (file)
@@ -26,6 +26,15 @@ define Package/uwsgi-cgi
   DEPENDS:=+libopenssl +libpcre +jansson +libuuid +libxml2
 endef
 
+define Package/uwsgi-cgi-luci-support
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=Support files for LuCI on Nginx
+  URL:=http://unbit.com/
+  DEPENDS:=+uwsgi-cgi
+endef
+
 define Package/uwsgi-cgi/description
        The uWSGI project build with cgi profile
 endef
@@ -39,4 +48,13 @@ define Package/uwsgi-cgi/install
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/uwsgi $(1)/usr/sbin/
 endef
 
+define Package/uwsgi-cgi-luci-support/install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files-luci-support/uwsgi.init $(1)/etc/init.d/uwsgi
+       $(INSTALL_DIR) $(1)/etc/uwsgi
+       $(INSTALL_BIN) ./files-luci-support/uwsgi.conf $(1)/etc/uwsgi/uwsgi.conf
+       $(INSTALL_DIR) $(1)/etc/nginx
+endef
+
 $(eval $(call BuildPackage,uwsgi-cgi))
+$(eval $(call BuildPackage,uwsgi-cgi-luci-support))
\ No newline at end of file
diff --git a/net/uwsgi-cgi/files-luci-support/uwsgi.conf b/net/uwsgi-cgi/files-luci-support/uwsgi.conf
new file mode 100644 (file)
index 0000000..780b44e
--- /dev/null
@@ -0,0 +1,26 @@
+[uwsgi]
+stric = True
+plugins = cgi
+uwsgi_modifier1 = 9
+socket = /var/run/uwsgi.sock
+cgi-mode = true
+cgi = /www/cgi-bin/luci
+chdir = /usr/lib/lua/luci/
+master = True
+buffer-size = 10000
+reload-mercy=8
+max-requests=2000
+limit-as=200
+reload-on-as=256
+reload-on-rss=192
+no-orphans=True
+vacuum=True
+enable-threads=True
+post-buffering=8192
+socket-timeout=120
+thunder-lock = True
+logger = syslog:uwsgi
+daemonize = True
+log-format = %(addr) %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs
+pidfile=/var/run/uwsgi.pid
+die-on-term=True
\ No newline at end of file
diff --git a/net/uwsgi-cgi/files-luci-support/uwsgi.init b/net/uwsgi-cgi/files-luci-support/uwsgi.init
new file mode 100644 (file)
index 0000000..7897180
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common 
+
+START=79
+
+start() {
+       core_number=$(grep -c ^processor /proc/cpuinfo)
+       /usr/sbin/uwsgi --ini /etc/uwsgi/uwsgi.conf --threads $core_number --processes $(($core_number * 2))
+       logger -ts "Uwsgi" "Starting Uwsgi process"
+}                 
+stop() {
+       pidfile="/var/run/uwsgi.pid"
+       if [ -n "$(pgrep uwsgi)" ]; then
+               if [ -f $pidfile ]; then
+                       logger -t "Uwsgi" "Stopping Uwsgi process"
+                       kill $( cat $pidfile )
+               else
+                       for pid in $(pgrep uwsgi); do
+                               if [ -n "$(pgrep uwsgi)" ]; then
+                                       #Keep trying to kill until the master process is found
+                                       kill -KILL $pid
+                               fi
+                       done
+               fi
+       else 
+               logger -t "Uwsgi" "Uwsgi not running!"
+       fi
+}
+
+reload() {
+       /usr/sbin/uwsgi --reload /var/run/uwsgi.pid
+}
+
+
git clone https://git.99rst.org/PROJECT