Skip to content

Commit

Permalink
Systemd thing
Browse files Browse the repository at this point in the history
  • Loading branch information
virtulis committed Nov 2, 2024
1 parent beb2324 commit 5dfe43f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pong/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { WebSocketServer } from 'ws';

const verbose = !!process.env.WS_VERBOSE;
const port = process.env.WS_PORT ? Number(process.env.WS_PORT) : 1234;
const wss = new WebSocketServer({ port });
const wss = new WebSocketServer({ port, host: '127.0.0.1' });

const timeoutMs = 60_000;
let connId = 1;
Expand Down
12 changes: 12 additions & 0 deletions this-computer-pong.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=This.Computer Pong Server

[Service]
WorkingDirectory=/srv/this-computer
Environment="WS_PORT=1234"
ExecStart=/usr/bin/node pong/server.js
Restart=on-failure

[Install]
WantedBy=default.target

0 comments on commit 5dfe43f

Please sign in to comment.