Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run multiple Django App Gunicorn systemd?

I have two django projects running on different ports in same ec2 instance, One I have configured with gunicorn system as follows by creating gunicorn.service file at /etc/systemd/system/ which is working awesome if I run the command systemctl start gunicorn. Now I want to run another proect, how can I configure it, currently I am running that using gunicorn command /usr/local/bin/gunicorn --graceful-timeout 30 --bind 0.0.0.0:8690 projectFile.wsgi:application --daemon, Can I add same in gunicorn.service itself. How do I configure multiple projects in gunicorn systemd?

gunicron.service file -

[Unit]
Description=gunicorn daemon
After=network.target


[Service]
PIDFile=/tmp/gunicorn.pid
LogFile=/tmp/lgunicorn.log
User=root
Group=www-data
WorkingDirectory=/home/ubuntu/website/UniservedWebsite

ExecStart = /usr/local/bin/gunicorn --workers 2 --graceful-timeout 30 --bind 0.0.0.0:8134 UniservedWebsite.wsgi:application


[Install]
WantedBy=multi-user.target
like image 602
Piyush S. Wanare Avatar asked Aug 31 '17 06:08

Piyush S. Wanare


1 Answers

Just create two .service file, and start them separately...

like image 132
Sinandro Avatar answered Sep 16 '22 16:09

Sinandro