aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stadler <peter.stadler@student.uibk.ac.at>2019-08-28 09:41:59 +0200
committerPeter Stadler <peter.stadler@student.uibk.ac.at>2020-01-01 18:28:01 +0100
commit96d1910d81ec30e6dee2a0b77867b0b9c6b83367 (patch)
tree82a29a1d3b5a82be21be16c257b5dacfa8c1190f
parent6990e2a1e5ca0435df4796740a549dd0c91e4e56 (diff)
uwsgi: add modular package superseeding uwsgi-cgi
Provide the minimal applications and plugins for: cgi, filelog, syslog and python3. More plugins can be added if needed by other packages. Autostart uwsgi in emperor mode loading vassals on demand. For now, include luci-support (maybe it will be moved to another package), which uses the syslog plugin by default. Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
-rw-r--r--net/uwsgi-cgi/Makefile71
-rw-r--r--net/uwsgi-cgi/patches/001-remove-unused-deps.patch17
-rw-r--r--net/uwsgi/Makefile168
-rw-r--r--net/uwsgi/files-luci-support/luci-cgi_io.ini (renamed from net/uwsgi-cgi/files-luci-support/luci-cgi_io.ini)13
-rw-r--r--net/uwsgi/files-luci-support/luci-webui.ini (renamed from net/uwsgi-cgi/files-luci-support/luci-webui.ini)19
-rw-r--r--net/uwsgi/files/emperor.ini (renamed from net/uwsgi-cgi/files/emperor.ini)5
-rw-r--r--net/uwsgi/files/uwsgi.init (renamed from net/uwsgi-cgi/files/uwsgi.init)1
-rw-r--r--net/uwsgi/patches/001-dont-hardcode-zlib.patch (renamed from net/uwsgi-cgi/patches/002-dont-hardcode-zlib.patch)0
-rw-r--r--net/uwsgi/patches/002-dont-override-toolchain-optimization.patch (renamed from net/uwsgi-cgi/patches/003-dont-override-toolchain-optimization.patch)0
-rw-r--r--net/uwsgi/patches/003-hard-code-Linux-as-compilation-os.patch (renamed from net/uwsgi-cgi/patches/004-hard-code-Linux-as-compilation-os.patch)2
-rw-r--r--net/uwsgi/patches/010-uclibc-ng.patch (renamed from net/uwsgi-cgi/patches/010-uclibc-ng.patch)0
-rw-r--r--net/uwsgi/patches/020-uwsgiconfig-system-python3.patch (renamed from net/uwsgi-cgi/patches/020-uwsgiconfig-system-python3.patch)0
-rw-r--r--net/uwsgi/patches/030-plugins-cgi_adds_dontresolve_option.patch (renamed from net/uwsgi-cgi/patches/030-plugins-cgi_adds_dontresolve_option.patch)0
-rw-r--r--net/uwsgi/src/buildconf/openwrt.ini30
14 files changed, 226 insertions, 100 deletions
diff --git a/net/uwsgi-cgi/Makefile b/net/uwsgi-cgi/Makefile
deleted file mode 100644
index 3df4c5b59..000000000
--- a/net/uwsgi-cgi/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=uwsgi-cgi
-PKG_VERSION:=2.0.18
-PKG_RELEASE:=4
-
-PKG_SOURCE_URL= \
- https://projects.unbit.it/downloads \
- https://codeload.github.com/unbit/uwsgi/tar.gz/$(PKG_VERSION)?
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=4972ac538800fb2d421027f49b4a1869b66048839507ccf0aa2fda792d99f583
-PKG_BUILD_DIR:=$(BUILD_DIR)/uwsgi-$(PKG_VERSION)
-
-PKG_LICENSE:=GPL-2.0-or-later
-PKG_LICENSE_FILES:=LICENSE
-PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>
-
-PKG_BUILD_DEPENDS:=python3/host
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/uwsgi-cgi
- SECTION:=net
- CATEGORY:=Network
- SUBMENU:=Web Servers/Proxies
- TITLE:=The uWSGI server
- URL:=https://projects.unbit.it/uwsgi
- DEPENDS:=+libcap +jansson +libuuid
-endef
-
-define Package/uwsgi-cgi-luci-support
- SECTION:=net
- CATEGORY:=Network
- SUBMENU:=Web Servers/Proxies
- TITLE:=Support files for LuCI on Nginx
- DEPENDS:=+uwsgi-cgi
-endef
-
-define Package/uwsgi-cgi/description
- The uWSGI project build with cgi profile
-endef
-
-MAKE_VARS+=\
- CPP=$(TARGET_CROSS)cpp \
- PYTHON=$(STAGING_DIR_HOSTPKG)/bin/python3
-
-define Build/Compile
- $(call Build/Compile/Default,PROFILE=cgi)
-endef
-
-define Package/uwsgi-cgi/install
- $(INSTALL_DIR) $(1)/usr/sbin
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/uwsgi $(1)/usr/sbin/
-
- $(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_BIN) ./files/uwsgi.init $(1)/etc/init.d/uwsgi
-
- $(INSTALL_DIR) $(1)/etc/uwsgi
- $(INSTALL_DATA) ./files/emperor.ini $(1)/etc/uwsgi/emperor.ini
-
- $(INSTALL_DIR) $(1)/etc/uwsgi/vassals
-endef
-
-define Package/uwsgi-cgi-luci-support/install
- $(INSTALL_DIR) $(1)/etc/uwsgi/vassals
- $(INSTALL_DATA) ./files-luci-support/luci-webui.ini $(1)/etc/uwsgi/vassals/luci-webui.ini
- $(INSTALL_DATA) ./files-luci-support/luci-cgi_io.ini $(1)/etc/uwsgi/vassals/luci-cgi_io.ini
-endef
-
-$(eval $(call BuildPackage,uwsgi-cgi))
-$(eval $(call BuildPackage,uwsgi-cgi-luci-support))
diff --git a/net/uwsgi-cgi/patches/001-remove-unused-deps.patch b/net/uwsgi-cgi/patches/001-remove-unused-deps.patch
deleted file mode 100644
index 2b058c302..000000000
--- a/net/uwsgi-cgi/patches/001-remove-unused-deps.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- a/buildconf/base.ini
-+++ b/buildconf/base.ini
-@@ -1,9 +1,9 @@
- [uwsgi]
--xml = auto
--yaml = true
--json = auto
--ssl = auto
--pcre = auto
-+xml = false
-+yaml = embedded
-+json = jansson
-+ssl = false
-+pcre = false
- routing = auto
- debug = false
- unbit = false
diff --git a/net/uwsgi/Makefile b/net/uwsgi/Makefile
new file mode 100644
index 000000000..f34ba6a62
--- /dev/null
+++ b/net/uwsgi/Makefile
@@ -0,0 +1,168 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=uwsgi
+PKG_VERSION:=2.0.18
+PKG_RELEASE:=1
+
+PKG_SOURCE:=uwsgi-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL=https://files.pythonhosted.org/packages/source/u/uwsgi/
+PKG_HASH:=4972ac538800fb2d421027f49b4a1869b66048839507ccf0aa2fda792d99f583
+PKG_BUILD_DIR:=$(BUILD_DIR)/uwsgi-$(PKG_VERSION)
+PKG_BUILD_DEPENDS:=python3/host
+
+PKG_LICENSE:=GPL-2.0-or-later
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Ansuel Smith <ansuelsmth@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+include ../../lang/python/python3-package.mk
+#for LINUX_UNAME_VERSION:
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/uwsgi
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Web Servers/Proxies
+ TITLE:=The uWSGI server
+ URL:=https://uwsgi-docs.readthedocs.io/en/latest/
+ DEPENDS:=+libpcre +libcap +libuuid
+ MENU:=1
+endef
+
+define Package/uwsgi-logfile-plugin
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Web Servers/Proxies
+ TITLE:=The Logfile plugin for the uWSGI server
+ DEPENDS:=uwsgi
+ MDEPENDS:=uwsgi
+endef
+
+define Package/uwsgi-syslog-plugin
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Web Servers/Proxies
+ TITLE:=The Syslog plugin for the uWSGI server
+ DEPENDS:=uwsgi
+ MDEPENDS:=uwsgi
+endef
+
+define Package/uwsgi-cgi-plugin
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Web Servers/Proxies
+ TITLE:=The CGI plugin for the uWSGI server
+ DEPENDS:=uwsgi
+ MDEPENDS:=uwsgi
+endef
+
+define Package/uwsgi-python3-plugin
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Web Servers/Proxies
+ TITLE:=The Python3 plugin for the uWSGI server
+ DEPENDS:=uwsgi +python3-light
+ MDEPENDS:=uwsgi
+endef
+
+define Package/uwsgi-luci-support
+ SECTION:=net
+ CATEGORY:=Network
+ SUBMENU:=Web Servers/Proxies
+ TITLE:=Support files for LuCI on Nginx
+ DEPENDS:=uwsgi +uwsgi-syslog-plugin +uwsgi-cgi-plugin
+ MDEPENDS:=uwsgi
+endef
+
+define Package/uwsgi/description
+ The uWSGI project (to be used together with nginx or nginx-ssl).
+endef
+
+define Package/uwsgi-logfile-plugin/description
+ The Logfile plugin for the uWSGI project.
+endef
+
+define Package/uwsgi-syslog-plugin/description
+ The Syslog plugin for the uWSGI project.
+endef
+
+define Package/uwsgi-cgi-plugin/description
+ The CGI plugin for the uWSGI project.
+endef
+
+define Package/uwsgi-python3-plugin/description
+ The Python3 plugin for the uWSGI project.
+endef
+
+define Package/uwsgi-luci-support/description
+ Support files for LuCI on Nginx
+endef
+
+MAKE_VARS+=\
+ CPP=$(TARGET_CROSS)cpp \
+ PYTHON=$(STAGING_DIR_HOSTPKG)/bin/python3 \
+ LINUX_UNAME_VERSION=$(LINUX_UNAME_VERSION)
+
+define Build/Compile
+ $(call Build/Compile/Default,PROFILE=openwrt)
+ $(call Build/Compile/Default,plugin.logfile PROFILE=openwrt)
+ $(call Build/Compile/Default,plugin.syslog PROFILE=openwrt)
+ $(call Build/Compile/Default,plugin.cgi PROFILE=openwrt)
+ $(call Build/Compile/HostPy3RunTarget, \
+ cd $(PKG_BUILD_DIR), \
+ uwsgiconfig.py --plugin plugins/python openwrt, \
+ CPP="$(TARGET_CROSS)cpp" \
+ LINUX_UNAME_VERSION=$(LINUX_UNAME_VERSION) \
+ CFLAGS="$(TARGET_CPPFLAGS) -I$(PYTHON3_INC_DIR) $(TARGET_CFLAGS)" \
+ )
+endef
+
+define Package/uwsgi/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/uwsgi $(1)/usr/sbin/
+
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/uwsgi.init $(1)/etc/init.d/uwsgi
+
+ $(INSTALL_DIR) $(1)/etc/uwsgi
+ $(INSTALL_CONF) ./files/emperor.ini $(1)/etc/uwsgi/emperor.ini
+
+ $(INSTALL_DIR) $(1)/etc/uwsgi/vassals
+endef
+
+define Package/uwsgi/conffiles
+/etc/uwsgi/emperor.ini
+endef
+
+define Package/uwsgi-logfile-plugin/install
+ $(INSTALL_DIR) $(1)/usr/lib/uwsgi
+ $(CP) $(PKG_BUILD_DIR)/logfile_plugin.so $(1)/usr/lib/uwsgi/
+endef
+
+define Package/uwsgi-syslog-plugin/install
+ $(INSTALL_DIR) $(1)/usr/lib/uwsgi
+ $(CP) $(PKG_BUILD_DIR)/syslog_plugin.so $(1)/usr/lib/uwsgi/
+endef
+
+define Package/uwsgi-cgi-plugin/install
+ $(INSTALL_DIR) $(1)/usr/lib/uwsgi
+ $(CP) $(PKG_BUILD_DIR)/cgi_plugin.so $(1)/usr/lib/uwsgi/
+endef
+
+define Package/uwsgi-python3-plugin/install
+ $(INSTALL_DIR) $(1)/usr/lib/uwsgi
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/python_plugin.so $(1)/usr/lib/uwsgi/
+endef
+
+define Package/uwsgi-luci-support/install
+ $(INSTALL_DIR) $(1)/etc/uwsgi/vassals
+ $(INSTALL_DATA) ./files-luci-support/luci-webui.ini $(1)/etc/uwsgi/vassals/luci-webui.ini
+ $(INSTALL_DATA) ./files-luci-support/luci-cgi_io.ini $(1)/etc/uwsgi/vassals/luci-cgi_io.ini
+endef
+
+$(eval $(call BuildPackage,uwsgi))
+$(eval $(call BuildPackage,uwsgi-logfile-plugin))
+$(eval $(call BuildPackage,uwsgi-syslog-plugin))
+$(eval $(call BuildPackage,uwsgi-cgi-plugin))
+$(eval $(call BuildPackage,uwsgi-python3-plugin))
+$(eval $(call BuildPackage,uwsgi-luci-support))
diff --git a/net/uwsgi-cgi/files-luci-support/luci-cgi_io.ini b/net/uwsgi/files-luci-support/luci-cgi_io.ini
index af95d67d2..da5ef7604 100644
--- a/net/uwsgi-cgi/files-luci-support/luci-cgi_io.ini
+++ b/net/uwsgi/files-luci-support/luci-cgi_io.ini
@@ -1,7 +1,14 @@
[uwsgi]
strict = true
+if-not-env = UWSGI_EMPEROR_FD
+socket = /var/run/luci-cgi_io.socket
+chmod-socket = 666
+cheap = true
+end-if =
+plugin = cgi
cgi-mode = true
cgi = /www/
+chdir = /usr/lib/lua/luci/
buffer-size = 10000
reload-mercy = 8
max-requests = 2000
@@ -12,11 +19,13 @@ no-orphans = true
post-buffering = 8192
socket-timeout = 120
thunder-lock = true
-#logger = syslog:uwsgi-luci-cgi_io
+plugin = syslog
disable-logging = true
+req-logger = syslog:uwsgi-luci-cgi_io
+log-format=%(method) %(uri) => return %(status) (%(rsize) bytes in %(msecs) ms)
chmod-socket = 666
cgi-safe = /usr/libexec/cgi-io
cgi-dontresolve = true
cgi-close-stdin-on-eof = true
cheap = true
-idle = 360 \ No newline at end of file
+idle = 360
diff --git a/net/uwsgi-cgi/files-luci-support/luci-webui.ini b/net/uwsgi/files-luci-support/luci-webui.ini
index 5371a1081..04abfc82d 100644
--- a/net/uwsgi-cgi/files-luci-support/luci-webui.ini
+++ b/net/uwsgi/files-luci-support/luci-webui.ini
@@ -1,5 +1,11 @@
[uwsgi]
strict = true
+if-not-env = UWSGI_EMPEROR_FD
+socket = /var/run/luci-webui.socket
+chmod-socket = 666
+cheap = true
+end-if =
+plugin = cgi
cgi-mode = true
cgi = /www/
chdir = /usr/lib/lua/luci/
@@ -13,16 +19,17 @@ enable-threads = true
post-buffering = 8192
socket-timeout = 120
thunder-lock = true
-#logger = syslog:uwsgi-luci
+plugin = syslog
+logger = luci syslog:uwsgi-luci
+log-route = luci luci:
disable-logging = true
-log-format = %(addr) %(method) %(uri) => generated %(rsize) bytes in %(msecs) msecs
+req-logger = syslog:uwsgi-luci
+log-format=%(method) %(uri) => return %(status) (%(rsize) bytes in %(msecs) ms)
threads = 3
processes = 3
-chmod-socket = 666
-cheap = true
cheaper-algo = spare
cheaper = 1
-cheaper-initial = 2
+cheaper-initial = 1
cheaper-step = 1
master = true
-idle = 360 \ No newline at end of file
+idle = 360
diff --git a/net/uwsgi-cgi/files/emperor.ini b/net/uwsgi/files/emperor.ini
index 5baa11bf2..9c245af1d 100644
--- a/net/uwsgi-cgi/files/emperor.ini
+++ b/net/uwsgi/files/emperor.ini
@@ -1,10 +1,9 @@
[uwsgi]
strict = true
-pidfile = /var/run/uwsgi.pid
+pidfile = /var/run/uwsgi.pid
emperor = /etc/uwsgi/vassals/*.ini
-logger = syslog:uwsgi-emperor
+early-emperor = true
vacuum = true
emperor-on-demand-directory = /var/run/
emperor-required-heartbeat = 99
vassal-set = die-on-idle=true
-#disable-logging = true \ No newline at end of file
diff --git a/net/uwsgi-cgi/files/uwsgi.init b/net/uwsgi/files/uwsgi.init
index 98f2c839c..20a1280e5 100644
--- a/net/uwsgi-cgi/files/uwsgi.init
+++ b/net/uwsgi/files/uwsgi.init
@@ -6,6 +6,7 @@ USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/sbin/uwsgi --ini /etc/uwsgi/emperor.ini
+ procd_set_param stderr 1
procd_set_param file /etc/uwsgi/emperor.ini
procd_set_param respawn
procd_close_instance
diff --git a/net/uwsgi-cgi/patches/002-dont-hardcode-zlib.patch b/net/uwsgi/patches/001-dont-hardcode-zlib.patch
index 23ca62d5d..23ca62d5d 100644
--- a/net/uwsgi-cgi/patches/002-dont-hardcode-zlib.patch
+++ b/net/uwsgi/patches/001-dont-hardcode-zlib.patch
diff --git a/net/uwsgi-cgi/patches/003-dont-override-toolchain-optimization.patch b/net/uwsgi/patches/002-dont-override-toolchain-optimization.patch
index 196edfbdb..196edfbdb 100644
--- a/net/uwsgi-cgi/patches/003-dont-override-toolchain-optimization.patch
+++ b/net/uwsgi/patches/002-dont-override-toolchain-optimization.patch
diff --git a/net/uwsgi-cgi/patches/004-hard-code-Linux-as-compilation-os.patch b/net/uwsgi/patches/003-hard-code-Linux-as-compilation-os.patch
index 0459ed034..169a309f8 100644
--- a/net/uwsgi-cgi/patches/004-hard-code-Linux-as-compilation-os.patch
+++ b/net/uwsgi/patches/003-hard-code-Linux-as-compilation-os.patch
@@ -8,7 +8,7 @@
-uwsgi_os_k = re.split('[-+_]', os.uname()[2])[0]
-uwsgi_os_v = os.uname()[3]
+uwsgi_os = "Linux"
-+uwsgi_os_k = "4.4.0"
++uwsgi_os_k = os.environ['LINUX_UNAME_VERSION']
+uwsgi_os_v = "Linux"
uwsgi_cpu = os.uname()[4]
diff --git a/net/uwsgi-cgi/patches/010-uclibc-ng.patch b/net/uwsgi/patches/010-uclibc-ng.patch
index e967320d9..e967320d9 100644
--- a/net/uwsgi-cgi/patches/010-uclibc-ng.patch
+++ b/net/uwsgi/patches/010-uclibc-ng.patch
diff --git a/net/uwsgi-cgi/patches/020-uwsgiconfig-system-python3.patch b/net/uwsgi/patches/020-uwsgiconfig-system-python3.patch
index 82522be19..82522be19 100644
--- a/net/uwsgi-cgi/patches/020-uwsgiconfig-system-python3.patch
+++ b/net/uwsgi/patches/020-uwsgiconfig-system-python3.patch
diff --git a/net/uwsgi-cgi/patches/030-plugins-cgi_adds_dontresolve_option.patch b/net/uwsgi/patches/030-plugins-cgi_adds_dontresolve_option.patch
index 7acdfc71c..7acdfc71c 100644
--- a/net/uwsgi-cgi/patches/030-plugins-cgi_adds_dontresolve_option.patch
+++ b/net/uwsgi/patches/030-plugins-cgi_adds_dontresolve_option.patch
diff --git a/net/uwsgi/src/buildconf/openwrt.ini b/net/uwsgi/src/buildconf/openwrt.ini
new file mode 100644
index 000000000..f9ea8344f
--- /dev/null
+++ b/net/uwsgi/src/buildconf/openwrt.ini
@@ -0,0 +1,30 @@
+[uwsgi]
+xml = false
+yaml = false
+json = false
+ssl = false
+pcre = true
+routing = auto
+debug = false
+unbit = false
+malloc_implementation = libc
+extras =
+plugins =
+bin_name = uwsgi
+append_version =
+plugin_dir = /usr/lib/uwsgi
+plugin_build_dir = .
+embedded_plugins =
+as_shared_library = false
+
+locking = auto
+event = auto
+timer = auto
+filemonitor = auto
+
+blacklist =
+whitelist =
+
+embed_files =
+
+embed_config =