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',
|
|
|
|
},
|
2022-09-10 16:10:14 +00:00
|
|
|
'/opt/mx-puppet-discord/.yarn': {
|
|
|
|
'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': {
|
2022-09-10 16:10:14 +00:00
|
|
|
'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',
|
2022-09-10 16:10:14 +00:00
|
|
|
'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': {
|
2022-09-10 16:10:14 +00:00
|
|
|
'command': ' && '.join([
|
2021-07-23 05:58:15 +00:00
|
|
|
'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/.npm',
|
2022-09-10 16:10:14 +00:00
|
|
|
'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',
|
|
|
|
]),
|
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,
|
|
|
|
},
|
2022-09-10 16:10:14 +00:00
|
|
|
'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': {
|
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,
|
|
|
|
},
|
2022-09-10 16:10:14 +00:00
|
|
|
'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': {
|
2022-09-10 16:10:14 +00:00
|
|
|
'action:mx-puppet-discord_yarn_install',
|
2020-04-04 15:54:48 +00:00
|
|
|
},
|
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': {
|
2022-09-10 16:10:14 +00:00
|
|
|
'action:mx-puppet-discord_yarn_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')
|