2021-04-02 16:57:13 +00:00
|
|
|
repo.libs.tools.require_bundle(node, 'nodejs')
|
|
|
|
repo.libs.tools.require_bundle(node, 'postgresql')
|
2020-10-16 18:10:34 +00:00
|
|
|
|
|
|
|
directories = {
|
|
|
|
'/opt/powerdnsadmin/src': {},
|
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
|
|
|
'/opt/powerdnsadmin/src': {
|
|
|
|
'repo': 'https://github.com/ngoduykhanh/PowerDNS-Admin.git',
|
2021-01-29 17:11:17 +00:00
|
|
|
'rev': node.metadata['powerdnsadmin']['version'],
|
2020-10-16 18:10:34 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:powerdnsadmin_install_deps',
|
|
|
|
'action:powerdnsadmin_upgrade_database',
|
|
|
|
'action:powerdnsadmin_compile_assets',
|
|
|
|
'svc_systemd:powerdnsadmin:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
|
|
|
'/opt/powerdnsadmin/config.py': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
},
|
|
|
|
'/etc/systemd/system/powerdnsadmin.service': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
actions = {
|
|
|
|
'powerdnsadmin_create_virtualenv': {
|
|
|
|
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/powerdnsadmin/venv/',
|
|
|
|
'unless': 'test -d /opt/powerdnsadmin/venv/',
|
|
|
|
'needs': {
|
|
|
|
'directory:/opt/powerdnsadmin', # provided by bundle:users
|
|
|
|
},
|
2023-01-29 09:04:47 +00:00
|
|
|
'after': {
|
|
|
|
'pkg_apt:',
|
|
|
|
},
|
2020-10-16 18:10:34 +00:00
|
|
|
},
|
|
|
|
'powerdnsadmin_install_deps': {
|
|
|
|
'triggered': True,
|
2023-01-28 16:39:07 +00:00
|
|
|
'command': '/opt/powerdnsadmin/venv/bin/pip install --upgrade psycopg2-binary -r /opt/powerdnsadmin/src/requirements.txt',
|
2020-10-16 18:10:34 +00:00
|
|
|
'needs': {
|
|
|
|
'action:powerdnsadmin_create_virtualenv',
|
|
|
|
'pkg_apt:',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'powerdnsadmin_upgrade_database': {
|
|
|
|
'triggered': True,
|
2020-12-10 21:07:26 +00:00
|
|
|
'command': 'cd /opt/powerdnsadmin/src && FLASK_CONF=/opt/powerdnsadmin/config.py FLASK_APP=/opt/powerdnsadmin/src/powerdnsadmin/__init__.py /opt/powerdnsadmin/venv/bin/flask db upgrade',
|
2020-10-16 18:10:34 +00:00
|
|
|
# TODO unless
|
|
|
|
'needs': {
|
|
|
|
'action:powerdnsadmin_install_deps',
|
|
|
|
'bundle:postgresql',
|
|
|
|
'pkg_apt:',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'powerdnsadmin_compile_assets': {
|
|
|
|
'triggered': True,
|
2021-11-09 17:08:31 +00:00
|
|
|
'command': ' && '.join([
|
|
|
|
'cd /opt/powerdnsadmin/src',
|
2022-04-03 06:16:35 +00:00
|
|
|
'yarn install --pure-lockfile --ignore-scripts',
|
2021-11-09 17:08:31 +00:00
|
|
|
'FLASK_APP=/opt/powerdnsadmin/src/powerdnsadmin/__init__.py /opt/powerdnsadmin/venv/bin/flask assets build',
|
|
|
|
'chown -R powerdnsadmin:powerdnsadmin /opt/powerdnsadmin/src/powerdnsadmin/static/',
|
|
|
|
]),
|
2020-10-16 18:10:34 +00:00
|
|
|
'needs': {
|
2022-04-03 06:38:20 +00:00
|
|
|
'action:nodejs_install_yarn',
|
2020-10-16 18:10:34 +00:00
|
|
|
'action:powerdnsadmin_install_deps',
|
|
|
|
'pkg_apt:',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'powerdnsadmin': {
|
|
|
|
'needs': {
|
|
|
|
'file:/opt/powerdnsadmin/config.py',
|
|
|
|
'file:/etc/systemd/system/powerdnsadmin.service',
|
|
|
|
'git_deploy:/opt/powerdnsadmin/src',
|
|
|
|
'action:powerdnsadmin_install_deps',
|
|
|
|
'action:powerdnsadmin_upgrade_database',
|
|
|
|
'action:powerdnsadmin_compile_assets',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|