diff --git a/bundles/phanpy/items.py b/bundles/phanpy/items.py new file mode 100644 index 0000000..dfbb0e5 --- /dev/null +++ b/bundles/phanpy/items.py @@ -0,0 +1,29 @@ +repo.libs.tools.require_bundle(node, 'nodejs') + +directories = { + '/opt/phanpy': {} +} + +git_deploy = { + '/opt/phanpy': { + 'rev': node.metadata.get('phanpy/version'), + 'repo': 'https://github.com/cheeaun/phanpy.git', + 'triggers': { + 'action:phanpy_build', + }, + }, +} + +actions = { + 'phanpy_build': { + 'command': ' && '.join([ + 'cd /opt/phanpy', + 'npm install ', + 'npm run build', + ]), + 'needs': { + 'pkg_apt:nodejs', + }, + 'triggered': True, + }, +} diff --git a/bundles/phanpy/metadata.py b/bundles/phanpy/metadata.py new file mode 100644 index 0000000..4bc56a0 --- /dev/null +++ b/bundles/phanpy/metadata.py @@ -0,0 +1,46 @@ +defaults = { + 'zfs': { + 'datasets': { + 'tank/phanpy': { + 'mountpoint': '/opt/phanpy', + 'needed_by': { + 'directory:/opt/phanpy', + }, + }, + }, + }, +} + +@metadata_reactor.provides( + 'nginx/vhosts/phanpy', +) +def nginx_config(metadata): + return { + 'nginx': { + 'vhosts': { + 'phanpy': { + 'domain': metadata.get('phanpy/url'), + 'webroot': '/opt/phanpy/dist/', + }, + }, + }, + } + + +@metadata_reactor.provides( + 'icinga2_api/phanpy/services', +) +def icinga_check_for_new_release(metadata): + return { + 'icinga2_api': { + 'phanpy': { + 'services': { + 'PHANPY UPDATE': { + 'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_github_for_new_release cheeaun/phanpy {}'.format(metadata.get('phanpy/version')), + 'vars.notification.mail': True, + 'check_interval': '60m', + }, + }, + }, + }, + } diff --git a/nodes/htz-cloud/miniserver.py b/nodes/htz-cloud/miniserver.py index dd34bf5..e4d44a2 100644 --- a/nodes/htz-cloud/miniserver.py +++ b/nodes/htz-cloud/miniserver.py @@ -9,6 +9,7 @@ nodes['htz-cloud.miniserver'] = { 'nodejs', 'ntfy', 'mautrix-telegram', + 'phanpy', 'postgresql', 'zfs', }, @@ -204,6 +205,10 @@ nodes['htz-cloud.miniserver'] = { 'domain': 'ntfy.sophies-kitchen.eu', 'allow_unauthorized_write': True, }, + 'phanpy': { + 'url': 'phanpy.sophies-kitchen.eu', + 'version': '2023.10.07.9b1800d', + }, 'postgresql': { 'version': '11', },