Gunicorn service return error

Return error at service

Please do not post images of text data here. Copy/paste the text into the body of your post, surrounded by lines of three backtick - ` characters in the same way you fence-off python code.

Also, that portion of the error log isn’t particularly helpful. If that’s your syslog output, check the output of your gunicorn-error-log file. Also check for messages earlier in the file for the time period where you’re starting the process.

Thanks for the observation.

About output at gunicorn-error-log return this

tail -f gunicorn-error-log
[2023-12-05 13:37:43 -0300] [1606] [DEBUG] Arbiter booted
[2023-12-05 13:37:43 -0300] [1606] [INFO] Listening at: unix:/run/diretorio.socket (1606)
[2023-12-05 13:37:43 -0300] [1606] [INFO] Using worker: sync
[2023-12-05 13:37:43 -0300] [1617] [INFO] Booting worker with pid: 1617
[2023-12-05 13:37:43 -0300] [1618] [INFO] Booting worker with pid: 1618
[2023-12-05 13:37:43 -0300] [1619] [INFO] Booting worker with pid: 1619
[2023-12-05 13:37:43 -0300] [1620] [INFO] Booting worker with pid: 1620
[2023-12-05 13:37:44 -0300] [1621] [INFO] Booting worker with pid: 1621
[2023-12-05 13:37:44 -0300] [1622] [INFO] Booting worker with pid: 1622
[2023-12-05 13:37:44 -0300] [1606] [DEBUG] 6 workers
(venv) apjor@vps39025:~/app_repo$ sudo systemctl status diretorio
â—Ź diretorio.service - Gunicorn daemon (You can change if you want)
     Loaded: loaded (/etc/systemd/system/diretorio.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-12-05 13:40:43 -03; 4min 35s ago
TriggeredBy: â—Ź diretorio.socket
   Main PID: 1732 (gunicorn)
      Tasks: 7 (limit: 397)
     Memory: 82.1M
     CGroup: /system.slice/diretorio.service
             ├─1732 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >
             ├─1733 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >
             ├─1734 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >
             ├─1735 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >
             ├─1736 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >
             ├─1737 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >
             └─1738 /home/apjor/app_repo/venv/bin/python3.9 /home/apjor/app_repo/venv/bin/gunicorn --error-logfile /home/apjor/app_repo/gunicorn-error-log --enable-stdio-inheritance --log-level debug --capture-output --access-logfile - >

Dec 05 13:40:43 vps39025 systemd[1]: Started Gunicorn daemon (You can change if you want).

When I use curl it works

 curl --unix-socket /run/diretorio.socket localhost


<!DOCTYPE html>
<html lang="pt-BR">
<head>


<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://kit.fontawesome.com/102b7415d0.js" crossorigin="anonymous"></script>

<link rel="stylesheet" href="/static/global/css/style.css">

So what’s the issue that you’re looking for help with?

Because when i try acess at IP in VM dont return the page

This is an nginx error being returned. Check your nginx logs.

hmm ok

2023/12/05 14:09:45 [crit] 1444#1444: *95 connect() to unix:/run/diretorio failed (2: No such file or directory) while connecting to upstream, client: 185.224.128.31, server: 191.252.92.101, request: "GET / HTTP/1.1", upstream: "http://unix:/run/diretorio:/", host: "191.252.92.101:80"

What information is that giving you, relative to what you’ve posted so far?

What file(s) do you think you might want to check next?

I think the problem is in /etc/nginx/sites-enabled/diretorio where i configurated the nginx

# HTTP
server {
  listen 80;
  listen [::]:80;
  server_name 191.252.92.101;

  # Add index.php to the list if you are using PHP
  index index.html index.htm index.nginx-debian.html index.php;
  
  # ATTENTION: /home/apjor/app_repo/data/web/static
  location /static {
    autoindex on;
    alias /home/apjor/app_repo/data/web/static;
  }

  # ATTENTION: /home/apjor/app_repo/data/web/media 
  location /media {
    autoindex on;
    alias /home/apjor/app_repo/data/web/media;
  }

  # ATTENTION: diretorio
  location / {
    proxy_pass http://unix:/run/diretorio;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }

  # deny access to .htaccess files, if Apache's document root
  # concurs with nginx's one
  #
  location ~ /\.ht {
    deny all;
  }

  location ~ /\. {
    access_log off;
    log_not_found off;
    deny all;
  }

  gzip on;
  gzip_disable "msie6";

  gzip_comp_level 6;
  gzip_min_length 1100;
  gzip_buffers 4 32k;
  gzip_proxied any;
  gzip_types
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/json
    application/xml
    application/rss+xml
    image/svg+xml;

  access_log off;
  #access_log  /var/log/nginx/191.252.92.101-access.log;
  error_log   /var/log/nginx/191.252.92.101-error.log;
}

Yes.

Now what line in here do you think may be wrong - and why? (The nginx error message you posted is a big clue.)

hmm i think the problem is that line

  # ATTENTION: diretorio
  location / {
    proxy_pass http://unix:/run/diretorio;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }

where i configurated the socket, but i dont knowwhat the problem this

What is the error message telling you?

No such file or directory to unix:/run/diretorio, but im created the diretorio.socket adn diretorio.service

"diretorio" != "diretorio.socket"

2 Likes

OMG! :woozy_face: :woozy_face: :woozy_face: :face_with_spiral_eyes: :face_with_spiral_eyes: :face_with_spiral_eyes: :face_with_peeking_eye: :face_with_peeking_eye: :face_with_peeking_eye:

1 Like

This was such an entertaining roller coaster to read through :joy: