bundlewrap/bundles/mx-puppet-discord/items.py

116 lines
3.4 KiB
Python
Raw Normal View History

repo.libs.tools.require_bundle(node, 'nodejs')
2020-04-04 15:54:48 +00:00
directories = {
2021-07-23 05:58:15 +00:00
'/opt/mx-puppet-discord': {},
'/opt/mx-puppet-discord/.npm': {
'owner': 'mx-puppet-discord',
'group': 'mx-puppet-discord',
},
'/opt/mx-puppet-discord/.yarn': {
'owner': 'mx-puppet-discord',
'group': 'mx-puppet-discord',
},
'/opt/mx-puppet-discord/src': {
'owner': 'mx-puppet-discord',
'group': 'mx-puppet-discord',
},
2020-04-04 15:54:48 +00:00
'/var/log/mx-puppet-discord': {
'owner': 'mx-puppet-discord',
},
}
users = {
'mx-puppet-discord': {
'home': '/opt/mx-puppet-discord',
},
}
2020-04-04 15:54:48 +00:00
files = {
'/opt/mx-puppet-discord/config.yaml': {
'owner': 'mx-puppet-discord',
'content_type': 'mako',
'triggers': {
'svc_systemd:mx-puppet-discord:restart',
},
},
'/opt/mx-puppet-discord/registration.yaml': {
'owner': 'mx-puppet-discord',
'content_type': 'mako',
'triggers': {
'svc_systemd:mx-puppet-discord:restart',
2020-04-04 15:54:48 +00:00
},
},
'/etc/systemd/system/mx-puppet-discord.service': {
'source': 'service',
'triggers': {
'action:systemd-reload',
'svc_systemd:mx-puppet-discord:restart',
},
}
2020-04-04 15:54:48 +00:00
}
git_deploy = {
'/opt/mx-puppet-discord/src': {
'repo': 'https://gitlab.com/mx-puppet/discord/mx-puppet-discord.git',
'rev': node.metadata.get('mx-puppet-discord/version', 'main'),
2020-04-04 15:54:48 +00:00
'triggers': {
'action:mx-puppet-discord_chown',
'action:mx-puppet-discord_yarn_install',
'action:mx-puppet-discord_yarn_build',
2020-04-04 15:54:48 +00:00
},
},
}
actions = {
'mx-puppet-discord_chown': {
'command': ' && '.join([
2021-07-23 05:58:15 +00:00
'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/.npm',
'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/.yarn',
'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/src',
]),
'needs': {
2021-07-23 05:58:15 +00:00
'directory:/opt/mx-puppet-discord/.npm',
'user:mx-puppet-discord',
2020-04-04 15:54:48 +00:00
},
'triggered': True,
},
'mx-puppet-discord_yarn_install': {
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord yarn install',
2020-04-04 15:54:48 +00:00
'needs': {
'action:mx-puppet-discord_chown',
'pkg_apt:libcairo2-dev',
'pkg_apt:libgif-dev',
'pkg_apt:libpango1.0-dev',
'pkg_apt:libpixman-1-dev',
2020-04-04 15:54:48 +00:00
'pkg_apt:nodejs',
'pkg_apt:pkg-config',
2020-04-04 15:54:48 +00:00
'user:mx-puppet-discord',
},
'triggered': True,
},
'mx-puppet-discord_yarn_build': {
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord yarn build',
2020-04-04 15:54:48 +00:00
'needs': {
'action:mx-puppet-discord_yarn_install',
2020-04-04 15:54:48 +00:00
},
'triggers': {
'svc_systemd:mx-puppet-discord:restart',
},
2020-04-04 15:54:48 +00:00
'triggered': True,
},
}
svc_systemd = {
'mx-puppet-discord': {
'needs': {
'action:mx-puppet-discord_yarn_build',
'file:/etc/systemd/system/mx-puppet-discord.service',
'file:/opt/mx-puppet-discord/config.yaml',
'file:/opt/mx-puppet-discord/registration.yaml',
},
},
}
2020-04-05 09:38:31 +00:00
if node.has_bundle('matrix-synapse'):
files['/opt/mx-puppet-discord/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')