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.27k stars 324 forks source link

"error": "Failed to apply new configuration." - REG #1037

Open harishvgts opened 6 months ago

harishvgts commented 6 months ago

When I modified the config.json and ran the below curl command I got this issue - "error": "Failed to apply new configuration."

Details: Server: Ubuntu | Django Deployment curl command: sudo curl -X PUT --data-binary @config.json --unix-socket /var/run/control.unit.sock http://localhost/config/ config.json:

{
  "listeners": {
      "*:80": {
          "pass": "routes"
      }
  },

  "routes": [
      {
          "action": {
              "pass": "applications/django"
          }
      }
  ],

  "applications": {
      "django": {
          "type": "python 3.10",
          "path": "//home/ubuntu/vittae/",
          "home": "/home/ubuntu/venv/",
          "module": "unit.wsgi"
      }
  }
}
lcrilly commented 6 months ago

Language modules typically don't have spaces in them (especially if you're using the official packages).

Try

"type": "python"
callahad commented 6 months ago

Our docs do suggest specifying language versions:

Except for external and wasm, you can detail the runtime version: "type": "python 3", "type": "python 3.4", or even "type": "python 3.4.9rc1". Unit searches its modules and uses the latest matching one, reporting an error if none match.

...so in this case I suspect we're not finding a Python 3.10 and just returning a poor error to the user.

@harishvgts What version of Ubuntu are you using, how did you install Unit, and what are the contents of /usr/lib/unit/modules/?