Incubator-superset: How to daemonize superset process

Created on 7 Feb 2017  路  19Comments  路  Source: apache/incubator-superset

Make sure these boxes are checked before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if any
  • [x] I have reproduced the issue with at least the latest released version of superset
  • [x] I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.15.0

Expected results

Detaches the server from the controlling terminal and enters the background

Actual results

can't realize running superset at backend

Steps to reproduce

gunicorn is superset's server, I add the parameter -D --daemon in bin.superset.run_server(), but don't work.
Is there any other way s to detaches the server from the controlling terminal and enters the background?

Most helpful comment

Would recommend using a straight gunicorn in place of superset runserver to allow for more control and avoid an extra level of shelling

All 19 comments

I found that I can close the controlling terminal and the gunicorn still run as a daemon.
But there is no order to stop/restart superset, have to kill the superset process, right? Or exist other ways?

What about letting your init system take care of superset?

I've written a simple systemd service:

[Unit]
Description=Visualization platform by Airbnb

[Service]
Type=simple
ExecStart=/usr/local/bin/superset runserver -p 8088 -t 300

@petroswork 馃憤

@petroswork nice

Thanks for this. I had to make the following change on Azure:

[Service]
Type=simple
User=username
ExecStart=/usr/local/bin/superset runserver -p 8088 -t 300

@josebrwn Mine was meant as a user service, i.e. appears in systemctl --user.

With few improvements works well for me.

superset.service

#

[Unit]
Description=Visualization platform by Airbnb
After=multi-user.target

[Service]
Type=simple
User=USER
ExecStart=/opt/superset/venv/bin/superset runserver

[Install]
WantedBy=default.target

For the record we use chef/runit at Airbnb. Hopefully we get to ship with some Linux distros that will take care of that eventualy :)

Hi running the script from @fuzaro I'm getting /bin/sh: 1: gunicorn: not found message, that's due to the virtualenv is not active, I guess.. Any clue on how to solve?
Thanks

@pastarace change /var/superset/superset/ with path to your Virtualenv. It's working I checked. You can also remove PYTHONPATH line. I added it because I am using local configuration file.

[Unit]
Description=Superset service 
After=network.target

[Service]
Type=simple
User=superset 
Group=superset 
Environment=PATH=/var/superset/superset/bin:$PATH
Environment=PYTHONPATH=/var/superset/superset:$PYTHONPATH
ExecStart=/var/superset/superset/bin/superset runserver

[Install]
WantedBy=multi-user.target

Would recommend using a straight gunicorn in place of superset runserver to allow for more control and avoid an extra level of shelling

@liptanbiswas can I use my own configuration file as well? Does this work?? please assist
like this:
[unit]
Description=SUPERSET systemd service script
After=network.target

[Service]
Type=simple
User=root
Environment=PATH=/opt/venv/bin:$PATH
Environment=PYTHONPATH=/opt/superset/superset_config.py:$PYTHONPATH
ExecStart=/opt/venv/bin/superset runserver
Restart=always

[Install]
WantedBy=multi-user.target

@nagaraju02 Yes you can. You see in the script I pasted above, I am putting superset_config.py in /var/superset/superset dir. You don't need to put the whole path.

Environment=PYTHONPATH=/opt/superset:$PYTHONPATH will do fine.

However, since you have installed the application in /opt/venv, I would recommend you to put the superset_config.py in this dir and make it Environment=PYTHONPATH=/opt/venv:$PYTHONPATH.

@liptanbiswas thanks a lot!
I will give a try.

Thanks It worked!

Make sure these boxes are checked before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if any
  • [x] I have reproduced the issue with at least the latest released version of superset
  • [x] I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.15.0

Expected results

Detaches the server from the controlling terminal and enters the background

Actual results

can't realize running superset at backend

Steps to reproduce

gunicorn is superset's server, I add the parameter -D --daemon in bin.superset.run_server(), but don't work.
Is there any other way s to detaches the server from the controlling terminal and enters the background?

Use the comando nohup before the command and put & in the final

example: nohup superset runserver -p 8088 &

I've written a simple systemd service:

[Unit]
Description=Visualization platform by Airbnb

[Service]
Type=simple
ExecStart=/usr/local/bin/superset runserver -p 8088 -t 300

where to add this file and what is the case of the virtual environment??
any help is appreciated asap

Can any one help me out what what in case supercet Is running on python virtual environment?

how we can get into python virtual environment and how we can setup this process

@GOPIPACHA The python environment can be specified in the .service file as "Environment=PYTHONPATH=/home/rspl_test/venv_s/bin:$PYTHONPATH" similar to what is done in above examples. The service file will automatically activate this environment

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josephtyler picture josephtyler  路  3Comments

eliab picture eliab  路  3Comments

sashank picture sashank  路  3Comments

gbrian picture gbrian  路  3Comments

deity-bram picture deity-bram  路  3Comments