0

So, I've recently deployed my first Flask app with gunicorn. During deployment, I encountered the most peculiar issue. I had created a systemd unit file (the following is the working, functional example):

[Unit]
Description=Gunicorn instance for newscrape
After=network.target
After=mysql.service
Requires=mysql.service

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/newscrape
Environment="PATH=/var/www/newscrape/newscrapeenv/bin"
ExecStart=/var/www/newscrape/newscrapeenv/bin/gunicorn --bind 127.0.0.1:9001 run:app

[Install]
WantedBy=multi-user.target

Now, this works fine, but it is not what I originally wanted. My ExecStart line originally read: ExecStart=/var/www/newscrape/newscrapeenv/bin/gunicorn --workers 4 --bind 127.0.0.1:9001 run:app

When I tried enabling and starting the unit file, I began to experience a crash loop for both my created service and the MySQL service. An endless waltz of both services horrendously going down in flames ensued.

Running the command: ss -tln showed neither service listening or one of two running at any given time.

My question is this: Why does gunicorn with workers crash the MySQL server but gunicorn without workers does not?

m-flak
  • 1

1 Answers1

0

If the documentation is correct on http://docs.gunicorn.org/en/stable/run.html, it seems as if only the equal signs are missing, for example --workers=4

dreinull
  • 1
  • 1