2

(beginner question)

I've successfully setup a nginx+gunicorn+django docker image on a Digital Ocean droplet.

My Django project follows the very good Cookie-Cutter-Django pattern (see here).

In this doc, there is a description of a supervisor install.

What I'm missing here is WHERE is the supervisor supposed to be running? Local or remotely?

I understand that if I install the supervisor on my laptop it will "keep-alive" my command "docker-compose up".

But what if I take 1 week off and my laptop runs out off battery?

Will the supervisor stop its job?

If so, I need to install it on my droplet, right?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
bixente57
  • 1,328
  • 4
  • 14
  • 29

2 Answers2

2

Supervisor should run on your droplet. It will make sure that your webserver restarts automatically if it ever gets interrupted. An example configuration would be something like the following from this excellent blog post:

[program:hello]
command = /webapps/hello_django/bin/gunicorn_start                    ; Command to start app
user = hello                                                          ; User to run as
stdout_logfile = /webapps/hello_django/logs/gunicorn_supervisor.log   ; Where to write log messages
redirect_stderr = true                                                ; Save stderr in the same log
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8                       ; Set UTF-8 as default encoding
YPCrumble
  • 26,610
  • 23
  • 107
  • 172
0

I was a bit confused. This SO post was helpful : Is supervisord needed for docker+gunicorn+nginx? As for this tuto: https://blog.codeship.com/ensuring-containers-are-always-running-with-dockers-restart-policy/

I've now added a "restart: always" on my compose.yml file:

  redis:
    image: redis:latest
    restart: always
Community
  • 1
  • 1
bixente57
  • 1,328
  • 4
  • 14
  • 29