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:
16
mkrootfs.sh
16
mkrootfs.sh
@@ -19,6 +19,7 @@ echo install_weak_deps=False >> "${destdir}"/etc/dnf/dnf.conf
|
||||
dnf --installroot "${destdir}" install -y \
|
||||
bcm2711-firmware \
|
||||
dracut-network \
|
||||
firefox \
|
||||
hostname \
|
||||
kmod \
|
||||
mesa-dri-drivers \
|
||||
@@ -62,21 +63,6 @@ chroot "${destdir}" systemctl enable \
|
||||
systemd-timesyncd \
|
||||
xinit@user
|
||||
|
||||
if ! [ -f "${destdir}"/usr/local/bin/playwright ]; then
|
||||
python3 -m pip \
|
||||
install \
|
||||
--prefix "${destdir}"/usr/local \
|
||||
playwright
|
||||
fi
|
||||
if ! [ -d "${destdir}"/usr/local/ms-playwright ]; then
|
||||
py_site_dir=$(
|
||||
"${destdir}"/usr/bin/python3 -c 'import site;print(site.getsitepackages()[0])'
|
||||
)
|
||||
PLAYWRIGHT_BROWSERS_PATH="${destdir}"/usr/local/ms-playwright \
|
||||
PYTHONPATH="${destdir}${py_site_dir}" \
|
||||
python3 -m playwright install firefox
|
||||
fi
|
||||
|
||||
umask 0022
|
||||
mksquashfs "${destdir}" "${destdir}/boot/${dest}" \
|
||||
-comp lz4 \
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[Unit]
|
||||
Description=Basement HUD
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=PLAYWRIGHT_BROWSERS_PATH=/usr/local/ms-playwright
|
||||
ExecStart=/usr/local/bin/basementhud
|
||||
7
overlay/etc/systemd/user/firefox-marionette.service
Normal file
7
overlay/etc/systemd/user/firefox-marionette.service
Normal 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
|
||||
5
overlay/etc/systemd/user/firefox-marionette.socket
Normal file
5
overlay/etc/systemd/user/firefox-marionette.socket
Normal file
@@ -0,0 +1,5 @@
|
||||
[Unit]
|
||||
Description=Firefox Marionette socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=[::]:2829
|
||||
10
overlay/etc/systemd/user/firefox.service
Normal file
10
overlay/etc/systemd/user/firefox.service
Normal 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
|
||||
@@ -3,5 +3,5 @@
|
||||
xset s off
|
||||
xset -dpms
|
||||
systemctl --user import-environment DISPLAY
|
||||
systemctl --user start basementhud.service
|
||||
systemctl --user start firefox-marionette.socket
|
||||
exec openbox
|
||||
|
||||
Reference in New Issue
Block a user