Exploring PhotonOS
(Aug 20, 2022)
The first distribution I loaded into a virtual machine was PhotonOS.
It was super easy to install and start creating new users. I created a new sudo user with (replace user with desired username)
useradd user
usermod -aG sudo user
and then switched to the new user with
su - user
I can now use sudo to run code with root access.
Docker was really interesting to me as a tool where I can spin up mini virtual machines inside my virtual machines.
It is basically a containerized VM that uses the host machine's kernel and resources instead of needing its own. I installed
docker and got started on trying to self-host services with it. When you start a container with docker, you can choose to expose
a port with a -p flag. Then you can use those ports to access your self-hosted services.
As a beginner to self-hosted services, I didn't want to expose a bunch of ports through my router firewall, so I started with Nginx.
Nginx is a web server that can be configured to route traffic through one publicly exposed port to other ports on a local network, without
exposing the ips and ports directly. If it's set up correctly, you should reach the welcome page shown above!
Create a new docker network with
sudo docker network create networkname
and then run a new docker container inside that network while exposing a port with
sudo docker run -itd --network networkname -p 80:80 --name containername nginx
This will create a new Nginx container running in detached mode that can be accessed through port 80.
So far, I have been able to reach the Nginx web server, however, I haven't been sucessful
configuring it to route to other services. My solution at this time is to use
Nginx Proxy Manager.
Then I can reverse engineer the solution to better understand the Nginx configuration files.
Nginx Proxy Manager provides a UI for directing traffic through your Nginx proxy. I was able to set it up with docker-compose
(a plugin for building custom docker images) and connect pretty easily. As an extra layer of protection I decided to use Cloudflare to
route public traffic to my network. Using Cloudflare Tunnels and a free domain name from freenom I can route to my Nginx Proxy Manager
dashboard through the public internet by going to https://npm.mrjeffhoffman.tk.
I was pretty pleased that I was able to get this all set up and access my home network from the public internet. I can't wait to add
services for myself and give access to my friends and family. I will add more updates here as I finish projects. First, I will set up
a Don't Starve Together gaming server using docker and route UDP connections through Cloudflare and Nginx for me and friends to play together!
Don't Starve Together has a very intersting server structure where two or more servers will need to be running concurrently and players are
able to travel between them!
Check back later for more virtualization projects!