bundlewrap/bundles/mx-puppet-discord/items.py
Franziska Kunsmann 6cd02dc563
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
bundles: move non-login users to items.py
2020-11-10 13:24:07 +01:00

93 lines
2.5 KiB
Python

assert node.has_bundle('nodejs')
directories = {
'/opt/mx-puppet-discord/src': {
'owner': 'mx-puppet-discord',
'group': 'mx-puppet-discord',
},
'/var/log/mx-puppet-discord': {
'owner': 'mx-puppet-discord',
},
}
users = {
'mx-puppet-discord': {
'home': '/opt/mx-puppet-discord',
},
}
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',
},
},
'/etc/systemd/system/mx-puppet-discord.service': {
'source': 'service',
'triggers': {
'action:systemd-reload',
'svc_systemd:mx-puppet-discord:restart',
},
}
}
git_deploy = {
'/opt/mx-puppet-discord/src': {
'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',
},
'triggered': True,
},
'mx-puppet-discord_npm_install': {
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord npm install',
'needs': {
'action:mx-puppet-discord_chown',
'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',
'needs': {
'action:mx-puppet-discord_npm_install',
},
'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',
},
},
}
if node.has_bundle('matrix-synapse'):
files['/opt/mx-puppet-discord/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')