Skip to content

Commit

Permalink
Merge pull request #149 from DasSkelett/wgkex-venv
Browse files Browse the repository at this point in the history
Deploy wgkex on workers in a venv
  • Loading branch information
DasSkelett authored Jan 6, 2024
2 parents 2f12677 + 952c9bc commit f25a14e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
29 changes: 17 additions & 12 deletions wgkex/init.sls
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
{%- if 'nextgen-gateway' in salt['pillar.get']('netbox:role:name') %}

python3-pyroute2:
python3-virtualenv:
pkg.installed

/srv/wgkex:
file.directory:
- mode: "0755"
- user: wgkex
- group: wgkex

/srv/wgkex/wgkex:
git.latest:
- name: https://github.com/freifunkMUC/wgkex
- target: /srv/wgkex
- name: https://github.com/freifunkMUC/wgkex.git
- rev: main
- target: /srv/wgkex/wgkex
- user: wgkex

/srv/wgkex/wgkex/venv:
virtualenv.managed:
- name: /srv/wgkex/wgkex/venv
- requirements: /srv/wgkex/wgkex/requirements.txt
- user: wgkex

/etc/systemd/system/wgkex.service:
file.managed:
- source: salt://wgkex/wgkex.service
Expand All @@ -16,7 +30,6 @@ python3-pyroute2:
file.managed:
- source: salt://wgkex/wgkex.yaml


wgkex-service:
service.running:
- name: wgkex
Expand All @@ -26,12 +39,4 @@ wgkex-service:
- watch:
- file: /etc/wgkex.yaml

systemd-reload-wgkex:
cmd.run:
- name: systemctl --system daemon-reload
- onchanges:
- file: /etc/systemd/system/wgkex.service
- watch_in:
- service: wgkex-service

{% endif %}
4 changes: 2 additions & 2 deletions wgkex/wgkex.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ After=network-online.target

[Service]
User=wgkex
WorkingDirectory=/srv/wgkex
ExecStart=/usr/bin/python3 -u -m wgkex.worker.app
WorkingDirectory=/srv/wgkex/wgkex
ExecStart=/srv/wgkex/wgkex/venv/bin/python3 -u -m wgkex.worker.app
Restart=on-failure

# Enable Logging
Expand Down

0 comments on commit f25a14e

Please sign in to comment.