From d6bc5317607054dcb36908afba77a8331266c81d Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Wed, 5 Aug 2020 15:50:02 +0200 Subject: [PATCH] Add crash reporter service --- crash-reporter/files/config.json | 1 + crash-reporter/files/crashreporter.service | 13 ++++++ crash-reporter/init.sls | 53 ++++++++++++++++++++++ crash-reporter/map.jinja | 5 ++ nginx/default | 3 ++ top.sls | 1 + 6 files changed, 76 insertions(+) create mode 100644 crash-reporter/files/config.json create mode 100644 crash-reporter/files/crashreporter.service create mode 100644 crash-reporter/init.sls create mode 100644 crash-reporter/map.jinja diff --git a/crash-reporter/files/config.json b/crash-reporter/files/config.json new file mode 100644 index 000000000..18d2b6600 --- /dev/null +++ b/crash-reporter/files/config.json @@ -0,0 +1 @@ +{"port": 5004, "crash_dir": "./crashes/", "secret": "{{ pillar['crash-reporter']['secret'] }}"} diff --git a/crash-reporter/files/crashreporter.service b/crash-reporter/files/crashreporter.service new file mode 100644 index 000000000..5e75e032a --- /dev/null +++ b/crash-reporter/files/crashreporter.service @@ -0,0 +1,13 @@ +[Unit] +Description=Job that runs crash-reporter +Requires=network-online.target + +[Service] +ExecStart={{ common.servo_home }}/crash-reporter/_venv/bin/crash_reporter +Environment=HOME={{ common.servo_home }} +User=servo +Group=servo +WorkingDirectory={{ common.servo_home }}/crash-reporter + +[Install] +WantedBy=multi-user.target diff --git a/crash-reporter/init.sls b/crash-reporter/init.sls new file mode 100644 index 000000000..462481a3f --- /dev/null +++ b/crash-reporter/init.sls @@ -0,0 +1,53 @@ +{% from 'common/map.jinja' import common %} +{% from tpldir ~ '/map.jinja' import crashreporter %} + +include: + - common + - python + +crash-reporter: + virtualenv.managed: + - name: /home/servo/crash-reporter/_venv + - venv_bin: virtualenv-3.5 + - python: python3 + - system_site_packages: False + - require: + - pkg: python3 + - pip: virtualenv + pip.installed: + - pkgs: + - git+https://github.com/servo/crash-reporter@{{ crashreporter.rev }} + - bin_env: /home/servo/crash-reporter/_venv + - upgrade: True + - require: + - virtualenv: crash-reporter + service.running: + - enable: True + - name: crashreporter + - require: + - pip: crash-reporter + - watch: + - file: /home/servo/crash-reporter/config.json + - file: /lib/systemd/system/crashreporter.service + - pip: crash-reporter + +/home/servo/crash-reporter/config.json: + file.managed: + - source: salt://{{ tpldir }}/files/config.json + - template: jinja + - user: servo + - group: servo + - mode: 644 + +/lib/systemd/system/crashreporter.service: + file.managed: + - source: salt://{{ tpldir }}/files/crashreporter.service + - template: jinja + - user: root + - group: root + - mode: 644 + - context: + common: {{ common }} + - require: + - pip: crash-reporter + - file: /home/servo/crash-reporter/config.json diff --git a/crash-reporter/map.jinja b/crash-reporter/map.jinja new file mode 100644 index 000000000..f7e44b433 --- /dev/null +++ b/crash-reporter/map.jinja @@ -0,0 +1,5 @@ +{% + set crashreporter = { + 'rev': 'FIXME' + } +%} diff --git a/nginx/default b/nginx/default index f976a3c2d..0d0b57d2b 100644 --- a/nginx/default +++ b/nginx/default @@ -36,5 +36,8 @@ server { proxy_set_header X-Scheme $scheme; proxy_set_header X-Script-Name /standups; } + location /crash-reporter/ { + proxy_pass http://localhost:5004/; + } } diff --git a/top.sls b/top.sls index a03a413b6..95a6a083f 100644 --- a/top.sls +++ b/top.sls @@ -32,3 +32,4 @@ base: - nginx - salt.master - standups + - crash-reporter