bundles/element-web: move to /opt (and zfs, if we have that)

This commit is contained in:
Franzi 2021-07-15 18:40:48 +02:00
parent afdfc0f8f2
commit f7098b0d35
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 20 additions and 8 deletions

View file

@ -2,14 +2,12 @@ from bundlewrap.metadata import metadata_to_json
repo.libs.tools.require_bundle(node, 'nodejs')
element_web_root = '/var/www/{}'.format(node.metadata['element-web']['url'])
directories = {
element_web_root: {}
'/opt/element-web': {}
}
git_deploy = {
element_web_root: {
'/opt/element-web': {
'rev': node.metadata['element-web']['version'],
'repo': 'https://github.com/vector-im/element-web.git',
'triggers': {
@ -19,7 +17,7 @@ git_deploy = {
}
files = {
element_web_root + '/webapp/config.json': {
'/opt/element-web/webapp/config.json': {
'content': metadata_to_json(node.metadata['element-web']['config']),
'needs': {
'action:element-web_yarn',
@ -29,7 +27,7 @@ files = {
actions = {
'element-web_yarn': {
'command': 'cd ' + element_web_root + ' && npm install yarn && node_modules/yarn/bin/yarn install && node_modules/yarn/bin/yarn build',
'command': 'cd /opt/element-web && npm install yarn && node_modules/yarn/bin/yarn install && node_modules/yarn/bin/yarn build',
'needs': {
'pkg_apt:nodejs',
},

View file

@ -1,3 +1,16 @@
defaults = {
'zfs': {
'datasets': {
'tank/element-web': {
'mountpoint': '/opt/element-web',
'needed_by': {
'directory:/opt/element-web',
},
},
},
},
}
@metadata_reactor.provides(
'nginx/vhosts',
)
@ -5,8 +18,9 @@ def nginx_config(metadata):
return {
'nginx': {
'vhosts': {
metadata.get('element-web/url'): {
'webroot': '/var/www/{}/webapp/'.format(metadata.get('element-web/url')),
'element-web': {
'domain': metadata.get('element-web/url'),
'webroot': '/opt/element-web',
},
},
},