Files
compiler-explorer/docs/SystemdSocketActivation.md
Rupert Tombs 83e06b0424 Update .js to .ts in documentation (#5558)
While reading the (excellent) documentation here, I noticed a few stale
references to `.js` files that are now implemented in TypeScript.

* Update `*.js` to `*.ts` in Markdown documentation.

* Update `app.js` to `out/dist/app.js` in
`docs/SystemdSocketActivation.md`.
_I managed to follow these instructions and locally run Compiler
Explorer through socket activation after that change._

* Update `*.js` to `*.ts` in the GitHub labeller config
`.github/labeler.yml`.
_Also correct some misnamed files here. I have checked the new version
with `ls $(grep -E "^ - " .github/labeler.yml | sed "s/ - //g")`. If I
were more familiar here, I would have liked to add a similar check to
the automated tests._

- Sheepishly add myself to the contributors list, despite this being a
tiny find-and-replace change.

---------

Co-authored-by: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com>
2023-10-04 20:27:06 -04:00

47 lines
1.1 KiB
Markdown

# Using Systemd socket based activation to start Compiler Explorer
This document gives a short overview of how to use Systemd to automatically start Compiler Explorer when the
web-interface is accessed.
You'll need to create two files in `/etc/systemd/system/`:
compiler-explorer.socket:
```
[Socket]
ListenStream=10240
[Install]
WantedBy=sockets.target
```
compiler-explorer.service:
```
[Service]
Type=simple
WorkingDirectory={{path_to_installation_directory}}/compiler-explorer
ExecStart=/usr/bin/node {{path_to_installation_directory}}/compiler-explorer/out/dist/app.js
TimeoutStartSec=60
TimeoutStopSec=60
User={{run_as_this_user}}
Group={{run_as_this_group}}
```
Replace the bracketed `{{}}` placeholders with your system specifics.
Once the two above files are created Systemd needs to be made aware of the changes:
```sh
sudo systemctl daemon-reload
```
Now all that remains is to enable and start the new service:
```sh
sudo systemctl enable compiler-explorer.socket
sudo systemctl start compiler-explorer.socket
```
If all goes well you can now open the web-interface.