actions['matrix-registration_create_virtualenv'] = { 'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/matrix-registration/venv/', 'unless': 'test -d /opt/matrix-registration/venv/', 'needs': { # actually /opt/matrix-registration, but we don't create that 'directory:/opt/matrix-registration/src', }, } actions['matrix-registration_install'] = { 'command': ' && '.join([ 'cd /opt/matrix-registration/src', '/opt/matrix-registration/venv/bin/pip install psycopg2-binary', '/opt/matrix-registration/venv/bin/pip install -e .', ]), 'needs': { 'action:matrix-registration_create_virtualenv', }, 'triggered': True, } users['matrix-registration'] = { 'home': '/opt/matrix-registration', } directories['/opt/matrix-registration/src'] = {} git_deploy['/opt/matrix-registration/src'] = { 'repo': 'https://github.com/zeratax/matrix-registration.git', 'rev': 'master', 'triggers': { 'action:matrix-registration_install', 'svc_systemd:matrix-registration:restart', }, } files['/opt/matrix-registration/config.yaml'] = { 'content_type': 'mako', 'context': { 'admin_secret': node.metadata.get('matrix-registration/admin_secret'), 'base_url': node.metadata.get('matrix-registration/base_path', ''), 'client_redirect': node.metadata.get('matrix-registration/client_redirect'), 'database': node.metadata.get('matrix-registration/database'), 'reg_secret': node.metadata.get('matrix-synapse/registration_shared_secret'), 'server_name': node.metadata.get('matrix-synapse/server_name'), }, 'triggers': { 'svc_systemd:matrix-registration:restart', }, } files['/usr/local/lib/systemd/system/matrix-registration.service'] = { 'triggers': { 'action:systemd-reload', 'svc_systemd:matrix-registration:restart', }, } svc_systemd['matrix-registration'] = { 'needs': { 'action:matrix-registration_install', 'file:/opt/matrix-registration/config.yaml', 'file:/usr/local/lib/systemd/system/matrix-registration.service', }, }