service-fastd-mesh: add fastd-limiter (dry run)

new limits are not yet used by fastd
This commit is contained in:
Julian Labus 2019-04-04 11:56:45 +02:00
parent 8a898bf339
commit a825a9bed0
No known key found for this signature in database
GPG key ID: 8AF209F2C6B3572A
6 changed files with 105 additions and 0 deletions

View file

@ -59,6 +59,48 @@
notify: restart fastd mesh instances notify: restart fastd mesh instances
loop: "{{ meshes | subelements('fastd.nodes.instances') }}" loop: "{{ meshes | subelements('fastd.nodes.instances') }}"
- name: install redis-server
apt:
name: redis-server
state: latest
default_release: stretch-backports
- name: build fastd-limiter
shell: "go get -v -u github.com/freifunk-mwu/fastd-limiter"
environment:
GOPATH: "{{ gopath }}"
- name: write fastd-limiter config
template:
src: fastd-limiter.yaml.j2
dest: /etc/fastd-limiter.yaml
owner: admin
group: admin
mode: 0644
- name: write systemd units for fastd-limiter
template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: 0644
notify: reload systemd
loop:
- fastd-limiter-limit.service
- fastd-limiter-limit.timer
- fastd-limiter-peers.service
- fastd-limiter-peers.timer
- name: configure systemd timers for fastd-limiter
systemd:
name: "{{ item }}"
enabled: yes
state: started
loop:
- fastd-limiter-limit.timer
- fastd-limiter-peers.timer
- name: write systemd unit fastd-sync-meshkeys.service - name: write systemd unit fastd-sync-meshkeys.service
template: template:
src: fastd-sync-meshkeys.service.j2 src: fastd-sync-meshkeys.service.j2

View file

@ -0,0 +1,11 @@
#
# {{ ansible_managed }}
#
[Unit]
Description=Update fastd peer limits
[Service]
Type=oneshot
ExecStart={{ gopath }}/bin/fastd-limiter limit
User=admin
Group=admin

View file

@ -0,0 +1,12 @@
#
# {{ ansible_managed }}
#
[Unit]
Description=Timer which schedules fastd-limiter-limit.service
[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,11 @@
#
# {{ ansible_managed }}
#
[Unit]
Description=Update fastd connected peers
[Service]
Type=oneshot
ExecStart={{ gopath }}/bin/fastd-limiter peers
User=admin
Group=admin

View file

@ -0,0 +1,12 @@
#
# {{ ansible_managed }}
#
[Unit]
Description=Timer which schedules fastd-limiter-peers.service
[Timer]
OnBootSec=5min
OnUnitActiveSec=1min
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,17 @@
#
# {{ ansible_managed }}
#
additional: 8
redis_db: '127.0.0.1:6379'
fastd_keys: '{{ git_path }}/peers-ffmwu'
key_ttl: 900
gateways:
{% for gateway in groups['ffmwu-gateways'] %}
- {{ gateway.rsplit('.freifunk-mwu.de')[0] }}
{% endfor %}
metrics_url: 'https://%s.freifunk-mwu.de:9281/metrics'