bundles/infobeamer-cms: move static files outside repo root

This commit is contained in:
Franzi 2023-12-29 08:16:58 +01:00
parent 8dde3dba0b
commit ec1efaafcc
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 16 additions and 9 deletions

View file

@ -1,8 +1,4 @@
actions = { actions = {
'infobeamer-cms_set_directory_permissions': {
'triggered': True,
'command': 'chown -R infobeamer-cms:infobeamer-cms /opt/infobeamer-cms/src/static/'
},
'infobeamer-cms_create_virtualenv': { 'infobeamer-cms_create_virtualenv': {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/infobeamer-cms/venv/', 'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/infobeamer-cms/venv/',
'unless': 'test -d /opt/infobeamer-cms/venv/', 'unless': 'test -d /opt/infobeamer-cms/venv/',
@ -12,7 +8,11 @@ actions = {
}, },
}, },
'infobeamer-cms_install_requirements': { 'infobeamer-cms_install_requirements': {
'command': 'cd /opt/infobeamer-cms/src && /opt/infobeamer-cms/venv/bin/pip install --upgrade pip gunicorn -r requirements.txt', 'command': ' && '.join([
'cd /opt/infobeamer-cms/src',
'/opt/infobeamer-cms/venv/bin/pip install --upgrade pip gunicorn -r requirements.txt',
'rsync /opt/infobeamer-cms/src/static/* /opt/infobeamer-cms/static/',
]),
'needs': { 'needs': {
'action:infobeamer-cms_create_virtualenv', 'action:infobeamer-cms_create_virtualenv',
}, },
@ -29,7 +29,6 @@ git_deploy = {
}, },
'triggers': { 'triggers': {
'svc_systemd:infobeamer-cms:restart', 'svc_systemd:infobeamer-cms:restart',
'action:infobeamer-cms_set_directory_permissions',
'action:infobeamer-cms_install_requirements', 'action:infobeamer-cms_install_requirements',
}, },
}, },
@ -37,6 +36,9 @@ git_deploy = {
directories = { directories = {
'/opt/infobeamer-cms/src': {}, '/opt/infobeamer-cms/src': {},
'/opt/infobeamer-cms/static': {
'owner': 'infobeamer-cms',
},
} }
config = node.metadata.get('infobeamer-cms/config', {}) config = node.metadata.get('infobeamer-cms/config', {})
@ -109,7 +111,7 @@ svc_systemd = {
'infobeamer-cms': { 'infobeamer-cms': {
'needs': { 'needs': {
'action:infobeamer-cms_install_requirements', 'action:infobeamer-cms_install_requirements',
'action:infobeamer-cms_set_directory_permissions', 'directory:/opt/infobeamer-cms/static',
'file:/etc/systemd/system/infobeamer-cms.service', 'file:/etc/systemd/system/infobeamer-cms.service',
'file:/opt/infobeamer-cms/settings.toml', 'file:/opt/infobeamer-cms/settings.toml',
'git_deploy:/opt/infobeamer-cms/src', 'git_deploy:/opt/infobeamer-cms/src',
@ -117,8 +119,12 @@ svc_systemd = {
}, },
'infobeamer-cms-runperiodic.timer': { 'infobeamer-cms-runperiodic.timer': {
'needs': { 'needs': {
'file:/etc/systemd/system/infobeamer-cms-runperiodic.timer', 'action:infobeamer-cms_install_requirements',
'directory:/opt/infobeamer-cms/static',
'file:/etc/systemd/system/infobeamer-cms-runperiodic.service', 'file:/etc/systemd/system/infobeamer-cms-runperiodic.service',
'file:/etc/systemd/system/infobeamer-cms-runperiodic.timer',
'file:/opt/infobeamer-cms/settings.toml',
'git_deploy:/opt/infobeamer-cms/src',
}, },
}, },
} }

View file

@ -6,6 +6,7 @@ defaults = {
'MAX_UPLOADS': 5, 'MAX_UPLOADS': 5,
'PREFERRED_URL_SCHEME': 'https', 'PREFERRED_URL_SCHEME': 'https',
'SESSION_COOKIE_NAME': '__Host-sess', 'SESSION_COOKIE_NAME': '__Host-sess',
'STATIC_PATH': '/opt/infobeamer-cms/static',
'URL_KEY': repo.vault.password_for(f'{node.name} infobeamer-cms url key'), 'URL_KEY': repo.vault.password_for(f'{node.name} infobeamer-cms url key'),
'VERSION': 1, 'VERSION': 1,
}, },
@ -30,7 +31,7 @@ def nginx(metadata):
'target': 'http://127.0.0.1:8000', 'target': 'http://127.0.0.1:8000',
}, },
'/static': { '/static': {
'alias': '/opt/infobeamer-cms/src/static', 'alias': '/opt/infobeamer-cms/static',
}, },
}, },
'website_check_path': '/', 'website_check_path': '/',