2021-07-04 14:36:43 +00:00
|
|
|
repo.libs.tools.require_bundle(node, 'nodejs')
|
|
|
|
|
|
|
|
|
|
|
|
directories = {
|
2021-07-04 16:04:48 +00:00
|
|
|
node.metadata['matrix-dimension']['install_dir']: {
|
2021-07-04 18:38:27 +00:00
|
|
|
'owner': 'matrix-dimension',
|
|
|
|
'group': 'matrix-dimension',
|
2021-07-04 16:04:48 +00:00
|
|
|
},
|
2021-07-04 14:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
|
|
|
node.metadata['matrix-dimension']['install_dir']: {
|
2021-07-04 19:11:23 +00:00
|
|
|
'rev': node.metadata.get('matrix-dimension/version', 'master'), # doesn't have releases yet
|
2021-07-04 14:36:43 +00:00
|
|
|
'repo': 'https://github.com/turt2live/matrix-dimension.git',
|
|
|
|
'triggers': {
|
|
|
|
'action:matrix_dimension_build',
|
|
|
|
},
|
|
|
|
'needs': {
|
2021-07-04 19:32:10 +00:00
|
|
|
'directory:{}'.format(node.metadata.get('matrix-dimension/install_dir')),
|
|
|
|
'directory:{}'.format(node.metadata.get('matrix-dimension/data_dir')),
|
2021-07-04 14:36:43 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
2021-07-04 19:32:10 +00:00
|
|
|
'{}/config/production.yaml'.format(node.metadata.get('matrix-dimension/install_dir')): {
|
2021-07-04 18:38:27 +00:00
|
|
|
'owner': 'matrix-dimension',
|
|
|
|
'group': 'matrix-dimension',
|
2021-07-04 14:36:43 +00:00
|
|
|
'content_type': 'mako',
|
|
|
|
'context': {
|
|
|
|
'config': node.metadata.get('matrix-dimension', {}),
|
|
|
|
},
|
|
|
|
'needs': {
|
2021-07-04 19:32:10 +00:00
|
|
|
'directory:{}'.format(node.metadata.get('matrix-dimension/install_dir')),
|
2021-07-04 14:36:43 +00:00
|
|
|
},
|
2021-07-04 19:06:51 +00:00
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:matrix-dimension:restart',
|
|
|
|
},
|
2021-07-04 14:36:43 +00:00
|
|
|
},
|
|
|
|
'/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 = {
|
2021-07-04 16:04:48 +00:00
|
|
|
'matrix_dimension_build': {
|
2021-07-04 19:11:23 +00:00
|
|
|
'command': 'cd ' + node.metadata.get('matrix-dimension/install_dir') + ' && sudo -u matrix-dimension npm install && sudo -u matrix-dimension npm run build',
|
2021-07-04 14:36:43 +00:00
|
|
|
'needs': {
|
|
|
|
'pkg_apt:nodejs',
|
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:matrix-dimension:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'matrix-dimension': {
|
|
|
|
'needs': {
|
2021-07-04 16:04:48 +00:00
|
|
|
'action:matrix_dimension_build',
|
2021-07-04 19:32:10 +00:00
|
|
|
'file:{}/config/production.yaml'.format(node.metadata.get('matrix-dimension/install_dir')),
|
2021-07-04 14:36:43 +00:00
|
|
|
'postgres_db:matrix-dimension',
|
|
|
|
'postgres_role:matrix-dimension',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|