bundles/simple-icinga-dashboard: use systemd-timers, use virtualenv
All checks were successful
bundlewrap/pipeline/head This commit looks good
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
26c2be07cf
commit
dca56140aa
4 changed files with 63 additions and 4 deletions
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=simple-icinga-dashboard
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=icinga_dashboard
|
||||
WorkingDirectory=/opt/simple-icinga-dashboard/src
|
||||
Environment=VIRTUAL_ENV=/opt/simple-icinga-dashboard/venv
|
||||
Environment=STATUSPAGE_CONFIG=/opt/simple-icinga-dashboard/config.toml
|
||||
ExecStart=/opt/simple-icinga-dashboard/venv/bin/python /opt/simple-icinga-dashboard/src/service.py
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Generate simple-icinga-dashboard
|
||||
|
||||
[Timer]
|
||||
OnCalendar=minutely
|
||||
Persistent=false
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
|
@ -1,3 +1,23 @@
|
|||
actions = {
|
||||
'simple-icinga-dashboard_create_virtualenv': {
|
||||
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/simple-icinga-dashboard/venv/',
|
||||
'unless': 'test -d /opt/simple-icinga-dashboard/venv/',
|
||||
'needs': {
|
||||
# actually /opt/simple-icinga-dashboard, but we don't create that
|
||||
'directory:/opt/simple-icinga-dashboard/src',
|
||||
},
|
||||
},
|
||||
'simple-icinga-dashboard_install_requirements': {
|
||||
'command':
|
||||
'cd /opt/simple-icinga-dashboard/src && '
|
||||
'/opt/simple-icinga-dashboard/venv/bin/pip install --upgrade pip && '
|
||||
'/opt/simple-icinga-dashboard/venv/bin/pip install --upgrade -r requirements.txt',
|
||||
'needs': {
|
||||
'action:simple-icinga-dashboard_create_virtualenv',
|
||||
},
|
||||
'triggered': True,
|
||||
},
|
||||
}
|
||||
|
||||
users = {
|
||||
'icinga_dashboard': {
|
||||
|
@ -16,11 +36,24 @@ git_deploy = {
|
|||
'/opt/simple-icinga-dashboard/src': {
|
||||
'repo': 'https://git.kunsmann.eu/sophie/simple-icinga-dashboard.git',
|
||||
'rev': 'main',
|
||||
'triggers': {
|
||||
'action:simple-icinga-dashboard_install_requirements',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
files = {
|
||||
'/opt/simple-icinga-dashboard/src/config.toml': {
|
||||
'/etc/systemd/system/simple-icinga-dashboard.service': {
|
||||
'triggers': {
|
||||
'action:systemd-reload',
|
||||
},
|
||||
},
|
||||
'/etc/systemd/system/simple-icinga-dashboard.timer': {
|
||||
'triggers': {
|
||||
'action:systemd-reload',
|
||||
},
|
||||
},
|
||||
'/opt/simple-icinga-dashboard/config.toml': {
|
||||
'content_type': 'mako',
|
||||
'needs': {
|
||||
'git_deploy:/opt/simple-icinga-dashboard/src',
|
||||
|
@ -36,3 +69,13 @@ symlinks = {
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
svc_systemd = {
|
||||
'simple-icinga-dashboard.timer': {
|
||||
'needs': {
|
||||
'action:simple-icinga-dashboard_install_requirements',
|
||||
'file:/etc/systemd/system/simple-icinga-dashboard.service',
|
||||
'file:/etc/systemd/system/simple-icinga-dashboard.timer',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
defaults = {
|
||||
'cron': {
|
||||
'simple-icinga-dashboard': '* * * * * icinga_dashboard cd /opt/simple-icinga-dashboard/src/ && ./service.py',
|
||||
},
|
||||
'postfix': {
|
||||
'aliases': {
|
||||
'icinga_dashboard': {
|
||||
|
|
Loading…
Reference in a new issue