Gunicorn working from command but not from service

Viewed 24

When i execute direct on terminal

/ins/icenv/bin/gunicorn app.main:app --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 --certfile=/ins/key_ls/fullchain.pem --keyfile=/ins/key_ls/privkey.pem --access-logfile /tmp/null --error-logfile /ins/logs/error_log_gunicorn_ws.log &

gunicorn work perfectly and I receive data from port 8000 but when I run

sudo systemctl start gunicornws

process start and status is active but connection to port 8000 return no data

Here is my gunicornws.service

Description=WebSocket Gunicorn Service
After=network.target

[Service]
User=customuser
Group=www-data
WorkingDirectory=/instant_connection/
ExecStart=/ins/icenv/bin/gunicorn app.main:app --workers 1 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 --certfile=/ins/key_ls/fullchain.pem --keyfile=/ins/key_ls/privkey.pem --access-logfile /tmp/null --error-logfile /ins/logs/error_log_gunicorn_ws.log

[Install]
WantedBy=multi-user.target

I already tried many settings but I can't find any logical reasons for this.

I will appreciate your support.

NOTE: I have another instance of gunicorn running on .sock and work perfectly with nginx but I need another for WebSockets and a port for internal reasons.

EDIT. I change my gunicornws.service to and it's running perfectly

Description=WebSocket Gunicorn Service
After=network.target

[Service]
User=jean15151352
Group=jean15151352
WorkingDirectory=/ins/
ExecStart=/ins/icenv/bin/gunicorn \
 app.main:app \
--workers 1 \
--worker-class uvicorn.workers.UvicornWorker \
--bind 0.0.0.0:8000 \
--certfile=/ins/key_ls/fullchain.pem \
--keyfile=/ins/key_ls/privkey.pem \
--access-logfile /tmp/null \
--error-logfile /ins/logs/error_log_gunicorn_ws.log

[Install]
WantedBy=multi-user.target
0 Answers
Related