bundles/mx-puppet-discord: put bridge repo into subdirectory

this avoids recreating config and registration on every update, which in turn
avoids restarting synapse
This commit is contained in:
Franzi 2020-11-07 09:08:10 +01:00
parent c481fc1327
commit d7f578742b
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 14 additions and 16 deletions

View file

@ -5,8 +5,8 @@ After=network.target
[Service]
User=mx-puppet-discord
Group=mx-puppet-discord
ExecStart=/usr/bin/node /opt/mx-puppet-discord/build/index.js -c config.yaml -f registration.yaml
WorkingDirectory=/opt/mx-puppet-discord/
ExecStart=/usr/bin/node /opt/mx-puppet-discord/src/build/index.js -c /opt/mx-puppet-discord/config.yaml -f /opt/mx-puppet-discord/registration.yaml
WorkingDirectory=/opt/mx-puppet-discord/src/
Restart=on-failure
[Install]

View file

@ -1,6 +1,10 @@
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',
},
@ -10,10 +14,6 @@ files = {
'/opt/mx-puppet-discord/config.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',
},
@ -21,10 +21,6 @@ files = {
'/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',
},
@ -33,12 +29,13 @@ files = {
'source': 'service',
'triggers': {
'action:systemd-reload',
'svc_systemd:mx-puppet-discord:restart',
},
}
}
git_deploy = {
'/opt/mx-puppet-discord': {
'/opt/mx-puppet-discord/src': {
'repo': 'https://github.com/matrix-discord/mx-puppet-discord.git',
'rev': 'master',
'triggers': {
@ -51,22 +48,23 @@ git_deploy = {
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',
'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 && sudo -u 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 && sudo -u mx-puppet-discord npm run-script build',
'command': 'cd /opt/mx-puppet-discord/src && sudo -u mx-puppet-discord npm run-script build',
'needs': {
'action:mx-puppet-discord_npm_install',
},