webvirtcloud icon indicating copy to clipboard operation
webvirtcloud copied to clipboard

Time to move on systemd =)

Open savichev opened this issue 10 years ago • 2 comments

Please test it on Ubuntu/Debian

stop application

supervisorctl stop webvirtcloud
supervisorctl stop novnc

create file webvirtcloud.service

[Unit]
Description=WebVirtCloud Core Service
Requires=novnc.service
Before=novnc.service
AssertPathExists=
AssertPathExists=/var/www/webvirtcloud/venv

[Service]
#Type=simple
User=www-data
Group=www-data
WorkingDirectory=/var/www/webvirtcloud
ExecStart=/var/www/webvirtcloud/venv/bin/gunicorn webvirtcloud.wsgi:application -c /var/www/webvirtcloud/gunicorn.conf.py
StandardOutput=syslog
StandardError=syslog
Restart=always
RestartSec=30
#KillMode=process
#IgnoreSIGPIPE=no
#SendSIGHUP=yes

[Install]
WantedBy=multi-user.target

and create file create file novnc.service

[Unit]
Description=WebVirtCloud NoVNC Service
Requires=webvirtcloud.service
After=webvirtcloud.service
AssertPathExists=
AssertPathExists=/var/www/webvirtcloud/venv

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/webvirtcloud
ExecStart=/var/www/webvirtcloud/venv/bin/python /var/www/webvirtcloud/console/novncd
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

copy file webvirtcloud.service and novnc.service to /lib/systemd/system/

sudo cp webvirtcloud.service /lib/systemd/system/
sudo cp novnc.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable webvirtcloud
sudo systemctl enable novnc

(Output):

Created symlink from /etc/systemd/system/multi-user.target.wants/webvirtcloud.service to /lib/systemd/system/webvirtcloud.service.
sudo systemctl start webvirtcloud

sudo systemctl status webvirtcloud

(Output):

webvirtcloud.service - WebVirtCloud Core Service
   Loaded: loaded (/lib/systemd/system/webvirtcloud.service; enabled)
   Active: active (running) since Чт 2015-10-22 12:47:19 YEKT; 28min ago
 Main PID: 28325 (gunicorn)
   CGroup: /system.slice/webvirtcloud.service

...(cut)
sudo systemctl status novnc

output

novnc.service - WebVirtCloud NoVNC Service
   Loaded: loaded (/lib/systemd/system/novnc.service; enabled)
   Active: active (running) since Пт 2015-10-23 16:51:38 YEKT; 4min 6s ago

savichev avatar Oct 22 '15 08:10 savichev

test

sudo systemctl stop novnc
sudo systemctl stop webvirtcloud

sudo systemctl start webvirtcloud
sudo systemctl status novnc

output

novnc.service - WebVirtCloud NoVNC Service
   Loaded: loaded (/lib/systemd/system/novnc.service; enabled)
   Active: active (running) since Пт 2015-10-23 16:37:32 YEKT; 3min 4s ago
sudo systemctl stop webvirtcloud
sudo systemctl status novnc

output

● novnc.service - WebVirtCloud NoVNC Service
   Loaded: loaded (/lib/systemd/system/novnc.service; enabled)
   Active: inactive (dead) since Пт 2015-10-23 16:41:53 YEKT; 44s ago
sudo systemctl start webvirtcloud
sudo systemctl status webvirtcloud

output

webvirtcloud.service - WebVirtCloud Core Service
   Loaded: loaded (/lib/systemd/system/webvirtcloud.service; enabled)
   Active: active (running) since Пт 2015-10-23 16:51:38 YEKT; 3min 12s ago
sudo systemctl status novnc

output

novnc.service - WebVirtCloud NoVNC Service
   Loaded: loaded (/lib/systemd/system/novnc.service; enabled)
   Active: active (running) since Пт 2015-10-23 16:51:38 YEKT; 4min 6s ago

final remove conf in superviserd

rm /etc/supervisor/conf.d/webvirtcloud.conf

savichev avatar Oct 23 '15 11:10 savichev

Hello,

I've installed this tool on ubuntu 22.04 ahead of reading this and wrote some nice service files utilizing environment variables for path configurations.

https://github.com/retspen/webvirtcloud/pull/646

ckbaker10 avatar May 28 '24 09:05 ckbaker10