Running two projects on single VPS with Gunicorn?

Hello all,

so far my public projects were always deployed on dedicated Digital Ocean Droplet (their version of VPS). With Ubuntu, Gunicorn and NGINX. Following this tutorial.

But since my Droplet has very very low CPU usage, I decided to deploy my new project alongside existing one.

What seems a bit problematic is Gunicorn setup. I have the /etc/systemd/system/gunicorn.service with configuration as per the Digital Ocean tutorial and naively I thought I can add second [Service] block with paths to my new project… But that leads to error:

gunicorn.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

Is this thing possible or do I need to re-do my setup for the first project, so I can run two Django projects side by side on single VPS?

Please no Docker :smiley:

Have you seen this article from the Digital Ocean site?

Is this close to what you’re looking for?

I think I may have glanced at it, but it appeared like that was looking for solution to different problem. But maybe not.

So basically creating new .service file for the second project should do it? And the first one can keep using the old one, or do I need to switch this also?

That sounds right. Basically you want to run two services, so two unit files, two ports, and so on.

All looked easy, until both my projects got 502 Bad Gateway :frowning:

So another try then :smiley:

I messed up one config and forgot to rename gunicorn.sock which took down both Django projects.

On second try, everything is running smoothly. The initial gunicorn.sock as per the Digital Ocean tutorial and the second with its own .service and .sock

1 Like

Super. Yes, sharing the socket might be an issue. :smiley: