I run a python application on FreeBSD that uses PostgreSQL, Nginx, and UWSGI. UWSGI I manage with SupervisorD. My /etc/rc.conf
looks like this:
...
postgresql_enable="YES"
nginx_enable="YES"
supervisord_enable="YES"
SupervisorD starts a couple different UWSGI processes, but their config files all pretty much look like this:
[program:uwsgi]
command=/usr/local/bin/uwsgi --ini /opt/site/uwsgi/site.ini
autostart=True
autorestart=True
user=example
stopsignal=INT
redirect_stderr=True
stdout_logfile=/opt/site/log/uwsgi.log
stdout_logfile_maxbyte=5MB
stdout_logfile_backups=10
priority=300
Everything starts properly. However, I ran into a problem where when the server reboots, SupervisorD started UWSGI before PostgreSQL was finished starting up, which caused an error.
Is there a way I can make sure that my UWSGI processes do not start until PostgreSQL is brought up fully?
If it is easier to ignore UWSGI and somehow tell FreeBSD to not even start SupervisorD until PostgreSQL is ready, I'm fine with that. Or should I somehow start managing PostgreSQL with SupervisorD, and handle everything within that?