77 lines
2.5 KiB
Python
77 lines
2.5 KiB
Python
directories['/opt/jugendhackt_tools/src'] = {}
|
|
|
|
git_deploy['/opt/jugendhackt_tools/src'] = {
|
|
'repo': 'https://github.com/Kunsi/jugendhackt_schedule.git',
|
|
'rev': 'main',
|
|
'triggers': {
|
|
'action:jugendhackt_tools_install',
|
|
'action:jugendhackt_tools_migrate',
|
|
'svc_systemd:jugendhackt_tools:restart',
|
|
},
|
|
}
|
|
|
|
actions['jugendhackt_tools_create_virtualenv'] = {
|
|
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/jugendhackt_tools/venv/',
|
|
'unless': 'test -d /opt/jugendhackt_tools/venv/',
|
|
'needs': {
|
|
# actually /opt/jugendhackt_tools, but we don't create that
|
|
'directory:/opt/jugendhackt_tools/src',
|
|
'pkg_apt:python3-virtualenv',
|
|
},
|
|
}
|
|
|
|
actions['jugendhackt_tools_install'] = {
|
|
'command': ' && '.join([
|
|
'cd /opt/jugendhackt_tools/src',
|
|
'/opt/jugendhackt_tools/venv/bin/pip install --upgrade pip wheel gunicorn psycopg2-binary',
|
|
'/opt/jugendhackt_tools/venv/bin/pip install --upgrade -r requirements.txt',
|
|
]),
|
|
'needs': {
|
|
'action:jugendhackt_tools_create_virtualenv',
|
|
'pkg_apt:python3-pip',
|
|
},
|
|
'triggered': True,
|
|
}
|
|
|
|
actions['jugendhackt_tools_migrate'] = {
|
|
'command': ' && '.join([
|
|
'cd /opt/jugendhackt_tools/src',
|
|
'CONFIG_PATH=/opt/jugendhackt_tools/config.toml /opt/jugendhackt_tools/venv/bin/python manage.py migrate',
|
|
'CONFIG_PATH=/opt/jugendhackt_tools/config.toml /opt/jugendhackt_tools/venv/bin/python manage.py collectstatic --noinput',
|
|
]),
|
|
'needs': {
|
|
'action:jugendhackt_tools_install',
|
|
'file:/opt/jugendhackt_tools/config.toml',
|
|
'postgres_db:jugendhackt_tools',
|
|
'postgres_role:jugendhackt_tools',
|
|
},
|
|
'triggered': True,
|
|
}
|
|
|
|
files['/opt/jugendhackt_tools/config.toml'] = {
|
|
'content': repo.libs.faults.dict_as_toml(node.metadata.get('jugendhackt_tools')),
|
|
'triggers': {
|
|
'svc_systemd:jugendhackt_tools:restart',
|
|
},
|
|
}
|
|
|
|
files['/usr/local/lib/systemd/system/jugendhackt_tools.service'] = {
|
|
'triggers': {
|
|
'action:systemd-reload',
|
|
'svc_systemd:jugendhackt_tools:restart',
|
|
},
|
|
}
|
|
|
|
svc_systemd['jugendhackt_tools'] = {
|
|
'needs': {
|
|
'action:jugendhackt_tools_migrate',
|
|
'file:/opt/jugendhackt_tools/config.toml',
|
|
'file:/usr/local/lib/systemd/system/jugendhackt_tools.service',
|
|
'git_deploy:/opt/jugendhackt_tools/src',
|
|
'user:jugendhackt_tools',
|
|
},
|
|
}
|
|
|
|
users['jugendhackt_tools'] = {
|
|
'home': '/opt/jugendhackt_tools/src',
|
|
}
|