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] [Service]
User=mx-puppet-discord User=mx-puppet-discord
Group=mx-puppet-discord Group=mx-puppet-discord
ExecStart=/usr/bin/node /opt/mx-puppet-discord/build/index.js -c config.yaml -f registration.yaml 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/ WorkingDirectory=/opt/mx-puppet-discord/src/
Restart=on-failure Restart=on-failure
[Install] [Install]

View file

@ -1,6 +1,10 @@
assert node.has_bundle('nodejs') assert node.has_bundle('nodejs')
directories = { directories = {
'/opt/mx-puppet-discord/src': {
'owner': 'mx-puppet-discord',
'group': 'mx-puppet-discord',
},
'/var/log/mx-puppet-discord': { '/var/log/mx-puppet-discord': {
'owner': 'mx-puppet-discord', 'owner': 'mx-puppet-discord',
}, },
@ -10,10 +14,6 @@ files = {
'/opt/mx-puppet-discord/config.yaml': { '/opt/mx-puppet-discord/config.yaml': {
'owner': 'mx-puppet-discord', 'owner': 'mx-puppet-discord',
'content_type': 'mako', 'content_type': 'mako',
'needs': {
'git_deploy:/opt/mx-puppet-discord',
'action:mx-puppet-discord_chown',
},
'triggers': { 'triggers': {
'svc_systemd:mx-puppet-discord:restart', 'svc_systemd:mx-puppet-discord:restart',
}, },
@ -21,10 +21,6 @@ files = {
'/opt/mx-puppet-discord/registration.yaml': { '/opt/mx-puppet-discord/registration.yaml': {
'owner': 'mx-puppet-discord', 'owner': 'mx-puppet-discord',
'content_type': 'mako', 'content_type': 'mako',
'needs': {
'git_deploy:/opt/mx-puppet-discord',
'action:mx-puppet-discord_chown',
},
'triggers': { 'triggers': {
'svc_systemd:mx-puppet-discord:restart', 'svc_systemd:mx-puppet-discord:restart',
}, },
@ -33,12 +29,13 @@ files = {
'source': 'service', 'source': 'service',
'triggers': { 'triggers': {
'action:systemd-reload', 'action:systemd-reload',
'svc_systemd:mx-puppet-discord:restart',
}, },
} }
} }
git_deploy = { git_deploy = {
'/opt/mx-puppet-discord': { '/opt/mx-puppet-discord/src': {
'repo': 'https://github.com/matrix-discord/mx-puppet-discord.git', 'repo': 'https://github.com/matrix-discord/mx-puppet-discord.git',
'rev': 'master', 'rev': 'master',
'triggers': { 'triggers': {
@ -51,22 +48,23 @@ git_deploy = {
actions = { actions = {
'mx-puppet-discord_chown': { 'mx-puppet-discord_chown': {
'command': 'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/*', 'command': 'chown -R mx-puppet-discord:mx-puppet-discord /opt/mx-puppet-discord/src',
'needed_by': { 'needs': {
'action:mx-puppet-discord_npm_install', 'user:mx-puppet-discord',
}, },
'triggered': True, 'triggered': True,
}, },
'mx-puppet-discord_npm_install': { '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': { 'needs': {
'action:mx-puppet-discord_chown',
'pkg_apt:nodejs', 'pkg_apt:nodejs',
'user:mx-puppet-discord', 'user:mx-puppet-discord',
}, },
'triggered': True, 'triggered': True,
}, },
'mx-puppet-discord_npm_build': { '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': { 'needs': {
'action:mx-puppet-discord_npm_install', 'action:mx-puppet-discord_npm_install',
}, },