Skip to main content
Topic: Please help me make a working uwsgi service (Read 444 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Please help me make a working uwsgi service

HI everyone,
I have installed uwsgi but I hadn't found the relative service in the repos. I tried to make an instantiated service on my own, something like that:
Code: [Select]
[main]
@type = classic
@version = 0.1.0
@description = "uwsgi for @I"
@user = ( root )

[start]
@execute = (  uwsgi --ini /etc/uwsgi/@I.ini )

[stop]
@execute = ( pkill -9 uwsgi )

However, the service always fails to start correctly because the application times out. Also switching type to "longrun" has no effect. Oddly, if  I manually type the exact command in the terminal after startup everything starts normally. It looks like a notification readiness issue, maybe the service starts too early when uwsgi is not fully initialized, but I don't really know how to handle this. The uwsgi docs are really huge and I couldn't find any useful hint about check files, apart from the possibility to add hooks in the .ini file like exec 1>&3 (for the record, this won't work either). What elese could I try? The default value  in the  notification-fd file is 3 but I don't know if it's right. trying to change it to a higher value freezes the system.
The systemd service is this one:
Code: [Select]
[Unit]
Description=uWSGI service unit
After=syslog.target

[Service]
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -INT $MAINPID
Restart=always
Type=notify
NotifyAccess=all
KillSignal=SIGQUIT

[Install]
WantedBy=multi-user.target
Any help would be greatly appreciated, thanks.