bw/bundle matrix-dimension this might actually work

This commit is contained in:
Sophie Schiller 2021-07-04 18:04:48 +02:00
parent 3b79f3973f
commit 3a26c766f9
4 changed files with 16 additions and 16 deletions

View file

@ -6,7 +6,7 @@ After=network.target
User=matrix-support User=matrix-support
Group=matrix-support Group=matrix-support
Environment="NODE_ENV=production" Environment="NODE_ENV=production"
ExecStart=/usr/bin/node /opt/matrix/matrix-dimension/build/app/index.js ExecStart=/usr/bin/node ${config['install_dir']}/build/app/index.js
WorkingDirectory=${config['install_dir']} WorkingDirectory=${config['install_dir']}
Restart=on-failure Restart=on-failure

View file

@ -2,8 +2,10 @@ repo.libs.tools.require_bundle(node, 'nodejs')
directories = { directories = {
node.metadata['matrix-dimension']['install_dir']: {}, node.metadata['matrix-dimension']['install_dir']: {
node.metadata['matrix-dimension']['data_dir']: {}, 'owner': 'matrix-support',
'group': 'matrix-support',
},
} }
git_deploy = { git_deploy = {
@ -22,6 +24,8 @@ git_deploy = {
files = { files = {
'{}/config/production.yaml'.format(node.metadata['matrix-dimension']['install_dir']): { '{}/config/production.yaml'.format(node.metadata['matrix-dimension']['install_dir']): {
'owner': 'matrix-support',
'group': 'matrix-support',
'content_type': 'mako', 'content_type': 'mako',
'context': { 'context': {
'config': node.metadata.get('matrix-dimension', {}), 'config': node.metadata.get('matrix-dimension', {}),
@ -44,8 +48,8 @@ files = {
} }
actions = { actions = {
'matrix_dimenson_build': { 'matrix_dimension_build': {
'command': 'cd ' + node.metadata['matrix-dimension']['install_dir'] + ' && npm install && npm run build', 'command': 'cd ' + node.metadata['matrix-dimension']['install_dir'] + ' && sudo -u matrix-support npm install && sudo -u matrix-support npm run build',
'needs': { 'needs': {
'pkg_apt:nodejs', 'pkg_apt:nodejs',
}, },
@ -59,7 +63,7 @@ actions = {
svc_systemd = { svc_systemd = {
'matrix-dimension': { 'matrix-dimension': {
'needs': { 'needs': {
'action:matrix-dimension_build', 'action:matrix_dimension_build',
'file:{}/config/production.yaml'.format(node.metadata['matrix-dimension']['install_dir']), 'file:{}/config/production.yaml'.format(node.metadata['matrix-dimension']['install_dir']),
'postgres_db:matrix-dimension', 'postgres_db:matrix-dimension',
'postgres_role:matrix-dimension', 'postgres_role:matrix-dimension',

View file

@ -1,7 +1,7 @@
defaults = { defaults = {
'matrix-dimension': { 'matrix-dimension': {
'install_dir': '/opt/matrix-dimension', 'install_dir': '/opt/matrix-dimension',
'data_dir': '/var/opt/dimension', 'data_dir': '/var/opt/matrix-dimension',
'database': { 'database': {
'user': 'matrix-dimension', 'user': 'matrix-dimension',
'password': repo.vault.password_for('{} postgresql matrix-dimension'.format(node.name)), 'password': repo.vault.password_for('{} postgresql matrix-dimension'.format(node.name)),
@ -20,13 +20,9 @@ defaults = {
}, },
}, },
}, },
'icinga2_api': { 'users': {
'mautrix-telegram': { 'matrix-support': {
'services': { 'home': '/var/opt/matrix-dimension',
'MAUTRIX-TELEGRAM PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -a mautrix-telegram -c 1:',
},
},
}, },
}, },
} }
@ -39,7 +35,7 @@ def nginx_config(metadata):
'nginx': { 'nginx': {
'vhosts': { 'vhosts': {
metadata.get('matrix-dimension/url'): { metadata.get('matrix-dimension/url'): {
'webroot': '/var/www/{}/webapp/'.format(metadata.get('element-web/url')), 'webroot': '/var/www/{}/webapp/'.format(metadata.get('matrix-dimension/url')),
'do_not_set_content_security_headers': True, 'do_not_set_content_security_headers': True,
'max_body_size': '50M', 'max_body_size': '50M',
'proxy': { 'proxy': {