bundlewrap/bundles/matrix-dimension/items.py
2021-07-04 20:18:09 +02:00

72 lines
2.2 KiB
Python

repo.libs.tools.require_bundle(node, 'nodejs')
directories = {
node.metadata['matrix-dimension']['install_dir']: {
'owner': 'matrix-support',
'group': 'matrix-support',
},
}
git_deploy = {
node.metadata['matrix-dimension']['install_dir']: {
'rev': node.metadata.get('matrix-dimension', {}).get('version', 'master'), # doesn't have releases yet
'repo': 'https://github.com/turt2live/matrix-dimension.git',
'triggers': {
'action:matrix_dimension_build',
},
'needs': {
'directory:{}'.format(node.metadata['matrix-dimension']['install_dir']),
'directory:{}'.format(node.metadata['matrix-dimension']['data_dir']),
},
},
}
files = {
'{}/config/production.yaml'.format(node.metadata['matrix-dimension']['install_dir']): {
'owner': 'matrix-support',
'group': 'matrix-support',
'content_type': 'mako',
'context': {
'config': node.metadata.get('matrix-dimension', {}),
},
'needs': {
'action:element-web_yarn',
'directory:{}'.format(node.metadata['matrix-dimension']['install_dir']),
},
},
'/etc/systemd/system/matrix-dimension.service': {
'content_type': 'mako',
'context': {
'config': node.metadata.get('matrix-dimension', {}),
},
'triggers': {
'action:systemd-reload',
'svc_systemd:matrix-dimension:restart',
},
},
}
actions = {
'matrix_dimension_build': {
'command': 'cd ' + node.metadata['matrix-dimension']['install_dir'] + ' && sudo -u matrix-support npm install && sudo -u matrix-support npm run build',
'needs': {
'pkg_apt:nodejs',
},
'triggered': True,
'triggers': {
'svc_systemd:matrix-dimension:restart',
},
},
}
svc_systemd = {
'matrix-dimension': {
'needs': {
'action:matrix_dimension_build',
'file:{}/config/production.yaml'.format(node.metadata['matrix-dimension']['install_dir']),
'postgres_db:matrix-dimension',
'postgres_role:matrix-dimension',
},
},
}