====== Self-hosted Firefox ======
check [[https://github.com/jlesage/docker-firefox|this]] out... a containerized Firefox that you can self host and run in a browser!
Why? to navigate from your server wherever you are:
* Bypass local filters/censorship
* Browse websites like you do from home
* Levergae your home ad-block setup
* Keep your browsing history totally private and secure
You will be able to acces your own firefox instance via any other web browser. Inside, it uses a VNC server/client, but toward outside it's just a plain webpage with firefox inside.
===== Installation =====
This is one of those use cases where a container is the perfect choice. The stack needed to achieve all this is not trivial and would be potentially not a good idea to set it up server-wide on your home server.
Now, if you plan to use firefox with multiple users you will need to replicate this setup for every user as you will need to spin up a separate container for each one. I will assume that **user** is the user you want your firefox to run as.
As **user** create the **/home/user/docker-compose.yml** file:
version: '3'
services:
firefox:
image: jlesage/firefox
environments:
- USER_ID=1000
- GROUP_ID=1000
ports:
- "5800:5800"
volumes:
- "/home/user/firefox:/config:rw"
Adapt your port (5800) and the USER_ID and GROUP_ID for **user**. You also need to specify a **config** folder, wihch must be existing and writable by **user**.
Then the usual:
su - user
podman compose pull
==== Reverse Proxy ====
Create the following NGINX config:
location /firefox/ {
rewrite ^/firefox/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://127.0.0.1:5800;
proxy_redirect http://127.0.0.1:5800 /firefox;
proxy_cookie_path / /firefox/;
}
See [[selfhost:nginx|The Reverse Proxy concept]] for more info.
==== Autostart ====
To start it, and set it up on boot, as usual follow my indications [[gentoo:containers|Using Containers on Gentoo]], so link the **user-containers** init script:
ln -s /etc/init.d/user-containers /etc/init.d/user-containers.firefox
and create the following config file:
USER=user
DESCRIPTION="Firefox in a box"
Add the service to the default runlevel and start it now:
rc-update add user-containers.firefox default
rc-service user-containers.firefox start
Of course, you will want to adapt for multiple users, maybe.