diff options
Diffstat (limited to 'spreadspace')
-rw-r--r-- | spreadspace/glt-stream.yml | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/spreadspace/glt-stream.yml b/spreadspace/glt-stream.yml index 355c989f..48541d85 100644 --- a/spreadspace/glt-stream.yml +++ b/spreadspace/glt-stream.yml @@ -46,3 +46,66 @@ autoindex: {} include_role: name: nginx/vhost + + - name: install golang + apt: + name: go + state: present + + - name: create base directory for stats + file: + path: /srv/www/stats + state: directory + + - name: add user for stats + user: + name: stats + system: yes + home: /srv/www/stats + + - name: create data and gocache directories for stats + loop: + - data + - .gocache + file: + path: "/srv/www/stats/{{ item }}" + state: directory + group: stats + mode: 0775 + + - name: install stats collector script + copy: + src: "{{ global_files_dir }}/glt/stream-stats.go" + dest: /srv/www/stats/stream-stats.go + + - name: install systemd unit for stats collector + copy: + content: | + [Unit] + Description=GLT21 Stream Stats Collector + + [Service] + Type=simple + Environment="GOCACHE=/srv/www/stats/.gocache" + ExecStart=/usr/bin/go run /srv/www/stats/stream-stats.go 127.0.0.1:4200 /srv/www/stats/data/glt21.json + NoNewPrivileges=yes + PrivateTmp=yes + PrivateDevices=yes + ProtectSystem=strict + ReadWritePaths=/srv/www/stats/data /srv/www/stats/.gocache + ProtectHome=yes + ProtectKernelTunables=yes + ProtectControlGroups=yes + RestrictRealtime=yes + RestrictAddressFamilies=AF_INET + + [Install] + WantedBy=multi-user.target + dest: /etc/systemd/system/stream-stats.service + + - name: make sure stats collector service unit is enabled and started + systemd: + name: stream-stats.service + daemon_reload: yes + enabled: yes + state: started |