2020-04-04 15:54:48 +00:00
|
|
|
assert node.has_bundle('nodejs')
|
|
|
|
|
|
|
|
directories = {
|
|
|
|
'/var/log/mx-puppet-discord': {
|
|
|
|
'owner': 'mx-puppet-discord',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
|
|
|
'/opt/mx-puppet-discord/config.yaml': {
|
|
|
|
'owner': 'mx-puppet-discord',
|
|
|
|
'content_type': 'mako',
|
|
|
|
'needs': {
|
|
|
|
'git_deploy:/opt/mx-puppet-discord',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'action:mx-puppet-discord_generate_registration',
|
2020-04-04 16:32:18 +00:00
|
|
|
'svc_systemd:mx-puppet-discord:restart',
|
2020-04-04 15:54:48 +00:00
|
|
|
},
|
|
|
|
},
|
2020-04-04 16:21:40 +00:00
|
|
|
'/etc/systemd/system/mx-puppet-discord.service': {
|
|
|
|
'source': 'service',
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
},
|
|
|
|
}
|
2020-04-04 15:54:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
|
|
|
'/opt/mx-puppet-discord': {
|
|
|
|
'repo': 'https://github.com/matrix-discord/mx-puppet-discord.git',
|
|
|
|
'rev': 'master',
|
|
|
|
'needs': {
|
|
|
|
'directory:/opt/mx-puppet-discord',
|
|
|
|
},
|
|
|
|
'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/*',
|
|
|
|
'needed_by': {
|
|
|
|
'action:mx-puppet-discord_npm_install',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
'mx-puppet-discord_npm_install': {
|
|
|
|
'command': 'cd /opt/mx-puppet-discord && sudo -u mx-puppet-discord npm install',
|
|
|
|
'needs': {
|
|
|
|
'pkg_apt:nodejs',
|
|
|
|
'user:mx-puppet-discord',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
'mx-puppet-discord_npm_build': {
|
|
|
|
'command': 'cd /opt/mx-puppet-discord && sudo -u mx-puppet-discord npm run-script build',
|
|
|
|
'needs': {
|
|
|
|
'action:mx-puppet-discord_npm_install',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
'mx-puppet-discord_generate_registration': {
|
2020-04-04 16:10:37 +00:00
|
|
|
'command': 'cd /opt/mx-puppet-discord && $(rm /opt/mx-puppet-discord/registration.yaml || true) && sudo -u mx-puppet-discord node ./build/index.js -r -c /opt/mx-puppet-discord/config.yaml -f /opt/mx-puppet-discord/registration.yaml',
|
2020-04-04 15:54:48 +00:00
|
|
|
'needs': {
|
|
|
|
'user:mx-puppet-discord',
|
|
|
|
'action:mx-puppet-discord_npm_build',
|
|
|
|
'directory:/var/log/mx-puppet-discord',
|
|
|
|
},
|
2020-04-04 16:32:18 +00:00
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:mx-puppet-discord:restart',
|
|
|
|
},
|
2020-04-04 15:54:48 +00:00
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
}
|
2020-04-04 16:21:40 +00:00
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'mx-puppet-discord': {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/systemd/system/mx-puppet-discord.service',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2020-04-05 09:38:31 +00:00
|
|
|
|
|
|
|
if node.has_bundle('matrix-synapse'):
|
|
|
|
actions['mx-puppet-discord_generate_registration']['triggers'].add('svc_systemd:matrix-synapse:restart')
|