0

我一直在努力研究如何最好地生产超集,或者至少让它在守护进程中运行。我使用以下内容创建了一个 SystemD 服务:

[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

我遇到的最后一个错误是找不到gunicorn。我不知道我还缺少什么,或者有其他方法可以设置它吗?

谢谢

4

1 回答 1

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.

于 2018-01-25T02:43:09.893 回答