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') repo.libs.tools.require_bundle(node, 'nodejs')
element_web_root = '/var/www/{}'.format(node.metadata['element-web']['url'])
directories = { directories = {
element_web_root: {} '/opt/element-web': {}
} }
git_deploy = { git_deploy = {
element_web_root: { '/opt/element-web': {
'rev': node.metadata['element-web']['version'], 'rev': node.metadata['element-web']['version'],
'repo': 'https://github.com/vector-im/element-web.git', 'repo': 'https://github.com/vector-im/element-web.git',
'triggers': { 'triggers': {
@ -19,7 +17,7 @@ git_deploy = {
} }
files = { files = {
element_web_root + '/webapp/config.json': { '/opt/element-web/webapp/config.json': {
'content': metadata_to_json(node.metadata['element-web']['config']), 'content': metadata_to_json(node.metadata['element-web']['config']),
'needs': { 'needs': {
'action:element-web_yarn', 'action:element-web_yarn',
@ -29,7 +27,7 @@ files = {
actions = { actions = {
'element-web_yarn': { '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': { 'needs': {
'pkg_apt:nodejs', '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( @metadata_reactor.provides(
'nginx/vhosts', 'nginx/vhosts',
) )
@ -5,8 +18,9 @@ def nginx_config(metadata):
return { return {
'nginx': { 'nginx': {
'vhosts': { 'vhosts': {
metadata.get('element-web/url'): { 'element-web': {
'webroot': '/var/www/{}/webapp/'.format(metadata.get('element-web/url')), 'domain': metadata.get('element-web/url'),
'webroot': '/opt/element-web',
}, },
}, },
}, },