@@ -44,37 +44,10 @@ electron.crashReporter.start({
44
44
})
45
45
```
46
46
47
- ### Unit file
48
- ``` service
49
- [Unit]
50
- Description=Container myalpine
51
-
52
- [Service]
53
- Environment=NODE_ENV=production
54
- Environment=PORT=8081
55
- Environment=CRASH_REPORTS_PATH=/root/reports
56
- ExecStart=/usr/bin/systemd-nspawn \
57
- --quiet \
58
- --keep-unit \
59
- --boot \
60
- --link-journal=try-guest \
61
- --directory=/var/lib/container/electron-crash-reporter-service \
62
- --network-macvlan=eth0 \
63
- /usr/bin/env node \
64
- /usr/root/electron-crash-reporter-service/index.js
65
- KillMode=mixed
66
- Type=notify
67
- RestartForceExitStatus=133
68
- SuccessExitStatus=133
69
-
70
- [Install]
71
- WantedBy=multi-user.target
72
- ```
73
-
74
47
## Environment variables
75
48
``` sh
76
49
PORT [80] # Set the port the service should listen to
77
- CRASH_REPORTS_PATH [/var/crash-reports] # Location to store crash reports
50
+ STORAGE_PATH [/var/crash-reports] # Location to store crash reports
78
51
NODE_ENV [production] # production|development
79
52
```
80
53
@@ -87,6 +60,37 @@ NODE_ENV [production] # production|development
87
60
## Peer Dependencies
88
61
None
89
62
63
+ ## Unit file
64
+ Save the unit file as ` /etc/systemd/system/electron-crash-reporter.service ` ,
65
+ and the application image as ` /images/electron-crash-report-service.aci `
66
+
67
+ ``` unit
68
+ [Unit]
69
+ Description=electron-crash-report-service
70
+ Requires=network-online.target
71
+ After=network-online.target
72
+
73
+ [Service]
74
+ Slice=machine.slice
75
+ Delegate=true
76
+ CPUQuota=10%
77
+ MemoryLimit=1G
78
+ Environment=PORT=80
79
+ Environment=STORAGE_PATH=/var/crash-reports
80
+ Environment=NODE_ENV=production
81
+ ExecStart=/usr/bin/rkt run --inherit-env /images/electron-crash-report-service.aci
82
+ ExecStopPost=/usr/bin/rkt gc --mark-only
83
+ KillMode=mixed
84
+ Restart=always
85
+ ```
86
+
87
+ You can then run it using ` systemctl ` :
88
+ ``` sh
89
+ $ sudo systemctl start etcd.service
90
+ $ sudo systemctl stop etcd.service
91
+ $ sudo systemctl restart etcd.service
92
+ ```
93
+
90
94
## See Also
91
95
- [ electron/api/crash-reporters] ( https://github.com/electron/electron/blob/master/docs/api/crash-reporter.md )
92
96
- [ feross/webtorrent.io] ( https://github.com/feross/webtorrent.io/blob/master/server/desktop-api.js )
0 commit comments