nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.39k stars 327 forks source link

Failed to apply new configuration. #935

Open brujah opened 1 year ago

brujah commented 1 year ago

Followed steps on https://unit.nginx.org/howto/fastapi/

Code: https://github.com/brujah/nginx-unit

Command: sudo curl -X PUT --data-binary @config.json --unix-socket /var/run/control.unit.sock http://localhost/config/

Error: Failed to apply new configuration

/var/log/unit.log: https://pastebin.com/SzsKRc9S

unitd --version unit version: 1.31.0 configured as ./configure --prefix=/usr --statedir=/var/lib/unit --control=unix:/var/run/control.unit.sock --runstatedir=/var/run --pid=/var/run/unit.pid --logdir=/var/log --log=/var/log/unit.log --tmpdir=/var/tmp --user=unit --group=unit --tests --openssl --njs --modulesdir=/usr/lib/unit/modules --libdir=/usr/lib/aarch64-linux-gnu --cc-opt='-g -O2 -ffile-prefix-map=/data/builder/debuild/unit-1.31.0/pkg/deb/debuild/unit-1.31.0=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -fdebug-prefix-map=/data/builder/debuild/unit-1.31.0/pkg/deb/debuild/unit-1.31.0=/usr/src/unit-1.31.0-1~lunar -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

python3 --version Python 3.11.4

which python3 /usr/bin/python3

Not sure what the issue might be here?

tippexs commented 1 year ago

I the log I can see you have loaded the python module. Is this the module installed from our packages or did you build it by yourself. I am About test the same FastAPI code with different versions and let you know.

brujah commented 1 year ago

I the log I can see you have loaded the python module. Is this the module installed from our packages or did you build it by yourself. I am About test the same FastAPI code with different versions and let you know.

Python module was from your package, did not build it myself

brujah commented 1 year ago

Side note, if I do source venv/bin/activate and enter the venv and do uvicorn asgi:app I get the following error:


    from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'```
tippexs commented 1 year ago

Thanks for sharing the additional information with us! I will have some time on Friday to have a closer look. We were busy with 1.31 :/ sorry for the delay! We will keep you posted!

acnebs commented 1 year ago

It sounds like you don't have fastapi installed in your venv