Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crash reporter service #1005

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crash-reporter/files/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"port": 5004, "crash_dir": "./crashes/", "read_secret": "{{ pillar['crash-reporter']['read_secret'] }}", "write_secret": "{{ pillar['crash-reporter']['write_secret'] }}" }
13 changes: 13 additions & 0 deletions crash-reporter/files/crashreporter.service
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions crash-reporter/init.sls
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the shared secret, we will want to add:

- context:
    secret: {{ pillars['crash-reporter']['secret'] }}

We will also need to add /srv/pillar/crash-reporter.sls on the main machine, and add the following fake crash-reporter.sls to .travis/test_pillars/:

'crash-reporter':
  'secret': 'TEST-CRASH-REPORTER-SECRET'

- 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
5 changes: 5 additions & 0 deletions crash-reporter/map.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{%
set crashreporter = {
'rev': 'FIXME'
}
%}
3 changes: 3 additions & 0 deletions nginx/default
Original file line number Diff line number Diff line change
Expand Up @@ -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/;
}
}

1 change: 1 addition & 0 deletions top.sls
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ base:
- nginx
- salt.master
- standups
- crash-reporter