picibucor
picibucor

Reputation: 773

Creating flask-project in NixOS

Hi I want to have a NixOS - Nginx - Gunicorn - Python Flask setup, but got stucked.

I managed to run gunicorn as a systemd service, but got the following feedback:

× project.service - Gunicorn instance to serve project
  Loaded: loaded (/etc/systemd/system/project.service; enabled; preset: enabled)
  Active: failed (Result: exit-code) since Tue 2024-10-15 22:49:18 CEST; 507ms ago
  Duration: 22ms
  Process: 7442 ExecStart=/home/picibucor/project/projectenv/bin/gunicorn --workers 3 --bind unix:/home/picibucor/project/project.sock -m 770 wsgi:app (code=exited, status=203/EXEC)
  Main PID: 7442 (code=exited, status=203/EXEC)
  IP: 0B in, 0B out
  CPU: 4ms

Okt 15 22:49:18 nixos systemd[1]: Started Gunicorn instance to serve project.
Okt 15 22:49:18 nixos (gunicorn)[7442]: project.service: Failed to execute /home/picibucor/project/projectenv/bin/gunicorn: Permission denied
Okt 15 22:49:18 nixos systemd[1]: project.service: Main process exited, code=exited, status=203/EXEC
Okt 15 22:49:18 nixos systemd[1]: project.service: Failed with result 'exit-code'.
warning: error(s) occurred while switching to the new configurationenter code here  

In configuration.nix the systemd service user is defined to be the user nginx, however the flask-project (project) is located at /home/picibucor/project. It is no wonder that the user nginx does not have permission over /home/picibucor/project.

I tried the command sudo chmod -R 755 /home/picibur/project as well, but did not helped either.

Where should I create my flask-project to avoid the permission denied issue? Is there anything else I could try to resolve the issue?

Thanks in advance

Upvotes: 0

Views: 51

Answers (0)

Related Questions