bundles/mx-puppet-discord: create registration.yaml using bw
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-09-26 15:34:12 +02:00
parent bf7e982fdb
commit 0784b85fbb
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 33 additions and 14 deletions

View file

@ -0,0 +1,15 @@
as_token: ${node.metadata['mx-puppet-discord']['as_token']}
hs_token: ${node.metadata['mx-puppet-discord']['hs_token']}
id: discord-puppet
namespaces:
users:
- exclusive: true
regex: '@_discordpuppet_.*'
rooms: []
aliases:
- exclusive: true
regex: '#_discordpuppet_.*'
protocols: []
rate_limited: false
sender_localpart: ${node.metadata['mx-puppet-discord']['sender_localpart']}
url: 'http://${node.metadata['mx-puppet-discord'].get('listen-addr', '127.0.0.1')}:${node.metadata['mx-puppet-discord'].get('port', 20000)}'

View file

@ -15,7 +15,17 @@ files = {
'action:mx-puppet-discord_chown', 'action:mx-puppet-discord_chown',
}, },
'triggers': { 'triggers': {
'action:mx-puppet-discord_generate_registration', 'svc_systemd:mx-puppet-discord:restart',
},
},
'/opt/mx-puppet-discord/registration.yaml': {
'owner': 'mx-puppet-discord',
'content_type': 'mako',
'needs': {
'git_deploy:/opt/mx-puppet-discord',
'action:mx-puppet-discord_chown',
},
'triggers': {
'svc_systemd:mx-puppet-discord:restart', 'svc_systemd:mx-puppet-discord:restart',
}, },
}, },
@ -62,27 +72,18 @@ actions = {
}, },
'triggered': True, 'triggered': True,
}, },
'mx-puppet-discord_generate_registration': {
'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',
'needs': {
'user:mx-puppet-discord',
'action:mx-puppet-discord_npm_build',
'directory:/var/log/mx-puppet-discord',
},
'triggers': {
'svc_systemd:mx-puppet-discord:restart',
},
'triggered': True,
},
} }
svc_systemd = { svc_systemd = {
'mx-puppet-discord': { 'mx-puppet-discord': {
'needs': { 'needs': {
'action:mx-puppet-discord_npm_build',
'file:/etc/systemd/system/mx-puppet-discord.service', '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'): if node.has_bundle('matrix-synapse'):
actions['mx-puppet-discord_generate_registration']['triggers'].add('svc_systemd:matrix-synapse:restart') files['/opt/mx-puppet-discord/registration.yaml']['triggers'].add('svc_systemd:matrix-synapse:restart')

View file

@ -16,6 +16,9 @@ defaults = {
'password': repo.vault.password_for('{} postgresql mx-puppet-discord'.format(node.name)), 'password': repo.vault.password_for('{} postgresql mx-puppet-discord'.format(node.name)),
'database': 'mx-puppet-discord', 'database': 'mx-puppet-discord',
}, },
'as_token': repo.vault.password_for('{} mx-puppet-discord as_token'.format(node.name)),
'hs_token': repo.vault.password_for('{} mx-puppet-discord hs_token'.format(node.name)),
'sender_localpart': '_discordpuppet_bot',
}, },
'postgresql': { 'postgresql': {
'users': { 'users': {