bundles/powerdnsadmin: introduce
This commit is contained in:
parent
0533e4087a
commit
9bba18d13e
5 changed files with 155 additions and 1 deletions
87
bundles/powerdnsadmin/items.py
Normal file
87
bundles/powerdnsadmin/items.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
assert node.has_bundle('nodejs')
|
||||
assert node.has_bundle('postgresql')
|
||||
|
||||
directories = {
|
||||
'/opt/powerdnsadmin/src': {},
|
||||
}
|
||||
|
||||
git_deploy = {
|
||||
'/opt/powerdnsadmin/src': {
|
||||
'repo': 'https://github.com/ngoduykhanh/PowerDNS-Admin.git',
|
||||
'rev': 'master',
|
||||
'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
|
||||
},
|
||||
},
|
||||
'powerdnsadmin_install_deps': {
|
||||
'triggered': True,
|
||||
'command': '/opt/powerdnsadmin/venv/bin/pip install -r /opt/powerdnsadmin/src/requirements.txt',
|
||||
'needs': {
|
||||
'action:powerdnsadmin_create_virtualenv',
|
||||
'pkg_apt:',
|
||||
},
|
||||
},
|
||||
'powerdnsadmin_install_deps': {
|
||||
'triggered': True,
|
||||
'command': '/opt/powerdnsadmin/venv/bin/pip install -r /opt/powerdnsadmin/src/requirements.txt',
|
||||
'needs': {
|
||||
'action:powerdnsadmin_create_virtualenv',
|
||||
'pkg_apt:',
|
||||
},
|
||||
},
|
||||
'powerdnsadmin_upgrade_database': {
|
||||
'triggered': True,
|
||||
'command': 'FLASK_CONF=/opt/powerdnsadmin/config.py FLASK_APP=/opt/powerdnsadmin/src/powerdnsadmin/__init__.py /opt/powerdnsadmin/venv/bin/flask db upgrade',
|
||||
# TODO unless
|
||||
'needs': {
|
||||
'action:powerdnsadmin_install_deps',
|
||||
'bundle:postgresql',
|
||||
'pkg_apt:',
|
||||
},
|
||||
},
|
||||
'powerdnsadmin_compile_assets': {
|
||||
'triggered': True,
|
||||
'command': 'cd /opt/powerdnsadmin/src && yarn install --pure-lockfile && FLASK_APP=/opt/powerdnsadmin/src/powerdnsadmin/__init__.py /opt/powerdnsadmin/venv/bin/flask assets build',
|
||||
'needs': {
|
||||
'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',
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue