2023-05-06 15:26:25 +00:00
|
|
|
directories['/opt/jugendhackt_tools/src'] = {}
|
|
|
|
|
|
|
|
git_deploy['/opt/jugendhackt_tools/src'] = {
|
2024-05-18 11:07:42 +00:00
|
|
|
'repo': 'https://github.com/sophieschi/jugendhackt_schedule.git',
|
2023-05-06 15:26:25 +00:00
|
|
|
'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',
|
2023-11-17 15:56:07 +00:00
|
|
|
'pkg_apt:python3-virtualenv',
|
2023-05-06 15:26:25 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
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',
|
2023-11-17 15:56:07 +00:00
|
|
|
'pkg_apt:python3-pip',
|
2023-05-06 15:26:25 +00:00
|
|
|
},
|
|
|
|
'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'] = {
|
2024-03-23 09:34:41 +00:00
|
|
|
'content': repo.libs.faults.dict_as_toml(node.metadata.get('jugendhackt_tools')),
|
2023-05-06 15:26:25 +00:00
|
|
|
'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',
|
|
|
|
}
|