Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to daemonize superset process #2123

Closed
3 tasks done
zhangjiajie023 opened this issue Feb 7, 2017 · 20 comments
Closed
3 tasks done

How to daemonize superset process #2123

zhangjiajie023 opened this issue Feb 7, 2017 · 20 comments

Comments

@zhangjiajie023
Copy link

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

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • 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?

@zhangjiajie023
Copy link
Author

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?

@xrmx
Copy link
Contributor

xrmx commented Feb 7, 2017

What about letting your init system take care of superset?

@xrmx xrmx added the question label Feb 7, 2017
@petroswork
Copy link

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

@xrmx
Copy link
Contributor

xrmx commented Feb 9, 2017

@petroswork 👍

@zhangjiajie023
Copy link
Author

@petroswork nice

@xrmx xrmx closed this as completed Mar 6, 2017
@nobodhi
Copy link

nobodhi commented May 29, 2017

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

@petroswork
Copy link

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

@fuzaro
Copy link

fuzaro commented May 30, 2017

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

@mistercrunch
Copy link
Member

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 :)

@pastarace
Copy link

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

@liptanbiswas
Copy link

liptanbiswas commented Feb 19, 2018

@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

@mistercrunch
Copy link
Member

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

@nagaraju02
Copy link

@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

@liptanbiswas
Copy link

liptanbiswas commented Sep 27, 2018

@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.

@nagaraju02
Copy link

nagaraju02 commented Sep 28, 2018

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

Thanks It worked!

@jonathangueedes
Copy link

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

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • 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 &

@Aabhusan
Copy link

Aabhusan commented Dec 6, 2019

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

@GOPIPACHA
Copy link

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

@Neel-rishabhsoft
Copy link

@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

@jcalhinho
Copy link

the .service file must be in /etc/systemd/system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests