Hello,
I am trying to determine the best way to introduce a resource clean up
logic into a python module that is called using ASGI protocol.
I am successfully catching the *'lifespan.startup' *event from within my
async def application(scope, receive, send*) *implementation.
Unfortunately, I do not see the *'lifespan.shutdown' *event when the
process is unloaded.
My config file includes:
"processes": {
"max": 3,
"spare": 1,
"idle_timeout": 10
},
I was under the assumption that the above config will force the idle
processes to shut down resulting in the *'lifespan.shutdown' *event .
Would appreciate any assistance.
gen
Hi,
I am debugging a situation on SmartOS (with unit 1.21.0) where
after reconfiguration, the controller socket just blocks
indefinitely (the listener is created, however), but
curl just won’t return to calling shell.
Is there any way to specify which event engine should be used at run time?
It is not clear to me from the documentation.
Any help/advices appreciated :-)
Thanks
otis
—
Juraj Lutter
XMPP: juraj (at) lutter.sk
GSM: +421907986576
Hello,
I'm serving an Angular + Django app with unit. For the most parts this
is working fine. The problem I'm having is with deep links and the
angular router.
All request to paths that are not found should be served the index.html
so that the Angular router can activate the matching component. In nginx
I would do this with the following:
try_files $uri $uri/ /index.html;
In unit I'm currently using this:
"routes": [
{
"match": {
"uri": [
"/api/*",
"/admin/*"
]
},
"action": {
"pass": "applications/myapp"
}
},
{
"action": {
"share": "/opt/myapp/web",
"fallback": {
"return": 301,
"location": "/"
}
}
}
],
With this configuration I'm loosing the path information because of the
redirect.
Any tips on how to solve the problem? Is there a way to get unit to
behave like try_files in nginx?
Kind regards,
Tobias
If i am not wrong then
If you are using linux then you can use logrotate utulity to achieve this.
On Wed, 13 Jan 2021, 2:35 pm Peter TKATCHENKO, <peter(a)bimp.fr> wrote:
> Hello,
>
> Is there any way to rotate unit.log without shutdown of the server?
>
> I cannot find any information about it in the documentation...
> Best regards,
>
> *Peter TKATCHENKO | Ingenieur Informatique*
> peter(a)bimp.fr
>
> 150 allée des Frènes - 69760 LIMONEST
>
> [image: BIMP Groupe LOGO]
> _______________________________________________
> unit mailing list
> unit(a)nginx.org
> https://mailman.nginx.org/mailman/listinfo/unit
Hello,
Is there any way to rotate unit.log without shutdown of the server?
I cannot find any information about it in the documentation...
Best regards,
*Peter TKATCHENKO | Ingenieur Informatique*
peter(a)bimp.fr <mailto:peter@bimp.fr>
150 allée des Frènes - 69760 LIMONEST
BIMP Groupe LOGO
Hello,
I am trying to return an HTTP Error Status 500 under certain conditions,
but for some reason 200 status is always returned. Although, the response
body is correctly populated.
I am using the following code (WSGI python module):
===================================================
def application(environ, start_response):
try:
#... main code
except Exception as error:
logger.exception(error)
start_response(
'500',
[('Content-Type', 'application/json')])
resp = {"Status": 500,
"Error": str(error),
"ErrorType": type(error).__name__}
else:
start_response(
'200 OK', [('Content-Type', 'application/json')])
resp = {}
#... set response
finally:
resp = json.dumps(resp, indent=4).encode("utf-8")
yield resp
========================================================
Would appreciate any help.
gen
Hello
Sometimes unitd leaves behind orphaned unix sockets (well, just
configure it to use some and kill -9!)
On next start, unitd fails to start because of existing sockets.
Is there a sane way to clean up them on start? keeping separate list of
sockets-to-remove is a clear way to insainty.
--
Alex
Hello,
I installed the latest Unit package for RHEL 8.
When I try to configure a simple demo app, I am getting:
2021/01/05 13:27:07 [info] 13694#13694 "demo" application started
2021/01/05 13:27:07 [alert] 13694#13694 Python failed to import module
"temp" ModuleNotFoundError: No module named 'temp'
2021/01/05 13:27:07 [notice] 13630#13630 process 13694 exited with code 1
2021/01/05 13:27:07 [warn] 13633#13633 failed to start application "demo"
2021/01/05 13:27:07 [alert] 13633#13633 failed to apply new conf
The JSON config is as following
============================================
{
"listeners": {
"*:8080": {
"pass": "applications/demo"
}
},
"applications": {
"demo": {
"type": "python",
"path": "/home/ec2-user/bp_tts/tmp/",
"module": "temp",
"protocol": "wsgi"
}
}
}
temp.py
============================================
def application(environ, start_response):
start_response("200 OK", [("Content-Type", "text/plain")])
return (b"Hello, Python on Unit!")
PWD of temp.py
============================================
/home/ec2-user/bp_tts/tmp
Would appreciate any advice.
Thank you,
gen