2021-04-02 16:57:13 +00:00
|
|
|
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',
|
|
|
|
},
|
2020-11-07 08:08:10 +00:00
|
|
|
'/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',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-11-10 12:23:22 +00:00
|
|
|
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': {
|
2020-09-26 13:34:12 +00:00
|
|
|
'svc_systemd:mx-puppet-discord:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/opt/mx-puppet-discord/registration.yaml': {
|
|
|
|
'owner': 'mx-puppet-discord',
|
|
|
|
'content_type': 'mako',
|
|
|
|
'triggers': {
|
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-11-07 08:08:10 +00:00
|
|
|
'svc_systemd:mx-puppet-discord:restart',
|
2020-04-04 16:21:40 +00:00
|
|
|
},
|
|
|
|
}
|
2020-04-04 15:54:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
2020-11-07 08:08:10 +00:00
|
|
|
'/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': {
|
2021-07-23 05:58:15 +00:00
|
|
|
'command':
|
|
|
|
'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/src && '
|
|
|
|
'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/.npm',
|
2020-11-07 08:08:10 +00:00
|
|
|
'needs': {
|
2021-07-23 05:58:15 +00:00
|
|
|
'directory:/opt/mx-puppet-discord/.npm',
|
2020-11-07 08:08:10 +00:00
|
|
|
'user:mx-puppet-discord',
|
2020-04-04 15:54:48 +00:00
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
'mx-puppet-discord_npm_install': {
|
2020-11-07 08:08:10 +00:00
|
|
|
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord npm install',
|
2020-04-04 15:54:48 +00:00
|
|
|
'needs': {
|
2020-11-07 08:08:10 +00:00
|
|
|
'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': {
|
2020-11-07 08:08:10 +00:00
|
|
|
'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',
|
|
|
|
},
|
2020-11-13 08:26:34 +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': {
|
2020-09-26 13:34:12 +00:00
|
|
|
'action:mx-puppet-discord_npm_build',
|
2020-04-04 16:21:40 +00:00
|
|
|
'file:/etc/systemd/system/mx-puppet-discord.service',
|
2020-09-26 13:34:12 +00:00
|
|
|
'file:/opt/mx-puppet-discord/config.yaml',
|
|
|
|
'file:/opt/mx-puppet-discord/registration.yaml',
|
2020-04-04 16:21:40 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2020-04-05 09:38:31 +00:00
|
|
|
|
|
|
|
if node.has_bundle('matrix-synapse'):
|
2020-09-26 13:34:12 +00:00
|
|
|
files['/opt/mx-puppet-discord/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')
|