0

I've been trying to work out how best to productionise superset, or at least getting it running in a daemon. I created a SystemD service with the following:

[Unit]
Description=Superset

[Service]
Type=simple
WorkingDirectory=/home/XXXX/Documents/superset/venv
ExecStart=/home/XXXX/Documents/superset/venv/bin/superset runserver

[Install]
WantedBy=multi-user.target

And the last error I got to was gunicorn cannot be found. I don't know what else I am missing or is there another way to set it up?

TylerH
  • 20,799
  • 66
  • 75
  • 101
user3508995
  • 187
  • 1
  • 1
  • 13

1 Answers1

0

I was able to set it up, after a bunch of searching and trial and error with supervisor, which is a python 2 program, but you can run any command (including other python version in other virtual environments).

I'm running it on an ubuntu 16 VPS. After creating an environment and installing supervisor, you create a configuration file and mine looks like this:

[supervisord]
logfile = %(ENV_HOME)s/sdaprod/supervisor/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = %(ENV_HOME)s/sdaprod/supervisor/supervisord.pid
nodaemon = false
minfds = 1024
minprocs = 200
umask = 022
identifier = supervisor
directory = %(ENV_HOME)s/sdaprod/supervisor
nocleanup = true
childlogdir = %(ENV_HOME)s/sdaprod/supervisor
strip_ansi = false


[unix_http_server]
file=/tmp/supervisor.sock 
chmod = 0777


[supervisorctl]
serverurl=unix:///tmp/supervisor.sock 


[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface


[program:superset]
command = %(ENV_HOME)s/miniconda3/envs/superset/bin/superset runserver 
directory = %(ENV_HOME)s/sdaprod
environment = PATH='%(ENV_PATH)s:%(ENV_HOME)s/miniconda3/envs/superset/bin',PYTHONPATH='%(ENV_PYTHONPATH)s:%(ENV_HOME)s/sdacore:%(ENV_HOME)s/sdaprod'

And then you just run supervisord from an environment that has it installed

The %(ENV_<>)s are environment variables. This is my first time doing this, so I absolutely can not vouch for this approach's efficiency, but it does work.

evariste galois
  • 135
  • 1
  • 5