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

97 lines
2.6 KiB
Python
Raw Normal View History

repo.libs.tools.require_bundle(node, 'nodejs')
2020-04-04 15:54:48 +00:00
directories = {
'/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': {
2020-04-04 15:54:48 +00:00
'repo': 'https://github.com/matrix-discord/mx-puppet-discord.git',
'rev': 'master',
'triggers': {
'action:mx-puppet-discord_chown',
'action:mx-puppet-discord_npm_install',
'action:mx-puppet-discord_npm_build',
},
},
}
actions = {
'mx-puppet-discord_chown': {
'command': 'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/src',
'needs': {
'user:mx-puppet-discord',
2020-04-04 15:54:48 +00:00
},
'triggered': True,
},
'mx-puppet-discord_npm_install': {
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord npm install',
2020-04-04 15:54:48 +00:00
'needs': {
'action:mx-puppet-discord_chown',
2020-04-04 15:54:48 +00:00
'pkg_apt:nodejs',
'user:mx-puppet-discord',
},
'triggered': True,
},
'mx-puppet-discord_npm_build': {
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord npm run-script build',
2020-04-04 15:54:48 +00:00
'needs': {
'action:mx-puppet-discord_npm_install',
},
'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_npm_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')