bundlewrap/bundles/hedgedoc/items.py
2022-10-19 15:24:39 +02:00

84 lines
1.9 KiB
Python

repo.libs.tools.require_bundle(node, 'nodejs')
git_deploy = {
'/opt/hedgedoc': {
'rev': node.metadata.get('hedgedoc/version'),
'repo': 'https://github.com/hedgedoc/hedgedoc.git',
'needs': {
'directory:/opt/hedgedoc',
},
'triggers': {
'action:hedgedoc_yarn',
'svc_systemd:hedgedoc:restart',
},
},
}
files = {
'/opt/hedgedoc/config.json': {
'content_type': 'mako',
'needs': {
'git_deploy:/opt/hedgedoc',
},
'triggers': {
'svc_systemd:hedgedoc:restart',
},
},
'/etc/systemd/system/hedgedoc.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:hedgedoc:restart',
},
}
}
directories = {
'/opt/hedgedoc': {},
'/var/opt/hedgedoc': {
'owner': 'hedgedoc',
'group': 'hedgedoc',
},
'/opt/hedgedoc/.yarn': {
'owner': 'hedgedoc',
'group': 'hedgedoc',
'needs': {
'git_deploy:/opt/hedgedoc',
},
},
}
actions = {
'hedgedoc_yarn': {
'command': ' && '.join([
'cd /opt/hedgedoc',
'yarn install --production=true --pure-lockfile --ignore-scripts',
'yarn install --ignore-scripts',
'yarn build',
]),
'needs': {
'action:nodejs_install_yarn',
'file:/opt/hedgedoc/config.json',
'git_deploy:/opt/hedgedoc',
'pkg_apt:nodejs',
},
'triggered': True,
},
}
svc_systemd = {
'hedgedoc': {
'needs': {
'file:/opt/hedgedoc/config.json',
'directory:/var/opt/hedgedoc',
'directory:/opt/hedgedoc/.yarn',
'action:hedgedoc_yarn',
'postgres_db:hedgedoc',
},
},
}
users = {
'hedgedoc': {
'home': '/opt/hedgedoc',
},
}