Drop Playwright, run Firefox Marionette

Running Voonex (Python), Playwight (Node.js), and Firefox simultaneously
takes way too much memory.  Using the NBD swap prevents hard lockups and
crashes in OOM situations, but it makes the machine *incredibly* slow.
To avoid needing to push anything into the network swap, I want to try
and reduce the memory footprint as much as possible.  To that end, we
will go back to running just Firefox.  To control it, we will use the
Marionette protocol.

Firefox only allows control via Marionette over the loopback interface.
This is hard-coded in the Marionette server, and cannot be changed at
runtime.  To allow a remote machine (running Voonex) to control it, we
need to expose the socket to the network.  Fortunately, *systemd*
includes a tool for exactly this purpose: `systemd-socket-proxyd`.
This commit is contained in:
2022-04-05 15:23:22 -05:00
parent 2a0737ab78
commit e055500476
6 changed files with 24 additions and 23 deletions

View File

@@ -1,7 +0,0 @@
[Unit]
Description=Basement HUD
[Service]
Type=simple
Environment=PLAYWRIGHT_BROWSERS_PATH=/usr/local/ms-playwright
ExecStart=/usr/local/bin/basementhud

View File

@@ -0,0 +1,7 @@
[Unit]
Description=Firefox marionette reverse proxy
Requires=firefox-marionette.socket
Requires=firefox.service
[Service]
ExecStart=/usr/lib/systemd/systemd-socket-proxyd 127.0.0.1:2828

View File

@@ -0,0 +1,5 @@
[Unit]
Description=Firefox Marionette socket
[Socket]
ListenStream=[::]:2829

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Firefox web browser
Wants=firefox-marionette.socket
[Service]
Type=simple
ExecStart=/usr/bin/firefox -marionette
Restart=always
StandardInput=null
StandardOutput=journal