Reputation: 49
I have configured my superset in Virtual env want to run it as a service I have tried using below config but its not working
[Unit]
Description=superset service
After=network.target
[Service]
Type=simple
User=superset
Group=superset
Environment=PATH=/home/ubuntu/code/superset:$PATH
Environment=PYTHONPATH=/var/superset/superset:$PYTHONPATH
ExecStart=/home/ubuntu/code/superset/superset runserver
[Install]
WantedBy=multi-user.target
Virtual Env folder is Superset
I get the below error
/etc/init.d/superset: 1: /etc/init.d/superset: [Unit]: not found Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ] /etc/init.d/superset: 5: /etc/init.d/superset: [Service]: not found
Upvotes: 2
Views: 7605
Reputation: 733
Actually the superset runserver
is used for development mode and it is highly recommended other tools like gunicorn for production.
Anyway, the main problem is that superset path on the virutalenv is $VENV_PATH/bin/superset
(in general the applications that treat like binary applications like superset or airflow, etc servers on this path: $VENV_PATH/bin
and the easy way to find the path of any application on Linux systems is to use which command that in this case, you can use which superset
to find the superset path ).
This is the superset service file that I use it on the production, hope to useful:
[Unit]
Description = Apache Superset Webserver Daemon
After = network.target
[Service]
PIDFile = /home/superset/superset-webserver.PIDFile
User = superset
Group = superset
Environment=SUPERSET_HOME=/home/superset
Environment=PYTHONPATH=/home/superset
WorkingDirectory = /home/superset
ExecStart =/home/superset/venv/bin/python3.7 /home/superset/venv/bin/gunicorn --workers 8 --worker-class gevent --bind 0.0.0.0:8888 --pid /home/superset/superset-webserver.PIDFile superset:app
ExecStop = /bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
Upvotes: 5