Set up your own personal browser in the Cloud
Tags: cloud, docker, browser, tutorial
Published: 2024-03-17 08:22:35

In the age of internet surveillance and data breaches, maintaining privacy and security online has never been more critical. Thankfully, with modern cloud technologies and a bit of ingenuity, creating a private and secure browsing environment is not only possible but also quite straightforward. This article guides you through setting up your own personal browser in the cloud, leveraging a Docker container with Firefox installed on a fly.io virtual machine (VM). The process is surprisingly simple and offers numerous benefits, including enhanced security, privacy, and high-speed internet access, no matter where you are in the world.

I don't want to waste your time, just clone the following [repo](https://github.com/dhanushreddy291/flyio-browser). Its a very simple config which sets up a docker daemon on fly VM. Offcourse you can run firefox as a standalone container image on VM, but good luck deploying it. I had a lot of errors related to `s6-overlay-suexec`. So what I am doing now, is just deploying this firefox container on a VM which has docker installed as a simple workaround/hack.

Offcourse I am not building the image for firefox, I will be just using the [kasm firefox image](https://docs.linuxserver.io/images/docker-firefox) from [linuxserver.io](https://linuxserver.io) instead.

## Demo of what we are building
{% embed https://twitter.com/dhanushreddy291/status/1769008521142493360 %}

## Deploy

[Fly.io](https://fly.io/) is a platform that helps you run your apps and databases closer to your users all around the world. It takes your app code, packages it up neatly, and puts it on virtual machines that can be quickly started or stopped. This makes your app faster for users and more reliable. Fly.io is easy to use, works well for small projects or personal apps. It's a great way to make sure your app runs smoothly for people no matter where they are.

### Pros of using a cloud browser

-   **Private and Secure**: Your browsing environment is isolated, reducing the risk of malware and eavesdropping.
-   **High-Speed Internet**: Utilize the high bandwidth of remote servers for faster browsing, especially beneficial for bandwidth-intensive tasks.
-   **Easy Deployment**: With my guide, deploying your cloud browser is a breeze.
-   **Persistent Data**: By mounting a volume to the VM, your browser history and data remain intact between sessions.

### Deployment Steps

1.  **Configure the `fly.toml` File**: Begin by cloning the provided [repository](https://github.com/dhanushreddy291/flyio-browser). Edit the `fly.toml` file to change the app name to something unique and select your preferred region for deployment to minimize latency. I used `sin` for Singapore, but Fly.io offers a wide range of [regions](https://fly.io/docs/reference/regions) you can choose from. Chose whichever thats closest to you to decrease the latency.
    
2.  **Set Up Authentication**: Modify the default username and password in the `deploy.sh` script to ensure your browser is secure.
    
3.  **Launch Your Cloud Browser**: Run the `deploy.sh` script. This script will install `flyctl` (if not already installed), authenticate your Fly.io account, and handle the deployment of your Firefox container to your selected region. Follow the on-screen prompts during deployment.
    

### Accessing Your Cloud Browser

Once deployment is complete, Fly.io will provide a URL for accessing your cloud browser. Navigate to this URL and log in with the username and password you set earlier. Just like that, you're ready to enjoy a secure, private browsing experience from anywhere.

### Managing Costs

Running a 2 GB instance on Fly.io costs approximately $0.01476 per hour or around $10.7 per month. To manage expenses, you can stop the VM when it's not in use, as Fly.io bills to the second, allowing for precise control over your spending.

### Advanced Features

#### Custom Domain

For a more personalized browsing experience, Fly.io supports setting up custom domains for your apps. Follow the [custom domain guide](https://fly.io/docs/reference/regions) for detailed instructions.

#### Automation with Telegram Bot

Included in the repository is a bonus feature: a Telegram bot for automating the start and stop of your VM, helping you manage usage and costs effectively. Setting up the bot takes just a few minutes, and you can control your cloud browser directly from Telegram, ensuring it's running only when you need it.

### Wrapping Up

What we have setup is a DIY version of [neverinstall.com](https://neverinstall.com/), which allows running applications on remote machines. Now that you have set up a browser for yourself, you can deploy any apps you can imagine, just do a simple Google Search for KASM [NAME_OF_APP_YOU_WANT], suppose you want to deploy Ubuntu Desktop, you can search on Google "[Kasm Ubuntu Docker image](https://hub.docker.com/r/kasmweb/desktop)" and deploy that image to get a full fledged desktop in the cloud.

In case if you still have any questions regarding this post or want to discuss something with me feel free to connect on [LinkedIn](https://www.linkedin.com/in/dhanushreddy29/) or [Twitter](https://twitter.com/dhanushreddy291).

> If you run an organization and want me to write for you, please connect with me on my Socials 🙃