Old Laptop, Let's Use It
The project came to my mind after discovering the existence of media-serving solutions like Plex or Jellyfin. I was also interested in polishing my skills on Docker containers, so I picked up my old laptop, the chosen "server", and started playing.
Docker? Containers?
For those who don't know what I am talking about, _Docker is an open source platform that enables developers to build, deploy, run, and manage containers, standardized and executable components that combine the application source code, the software dependencies, and the operating system (OS) required to run the application in any environment.
With fewer words, Docker allows you to build your program in a standalone and secure environment with an already integrated OS. This translates to:
- Easier software distribution;
- Assurance of the host machine setup. With Docker you will never hear again "but it works on my machine".
With respect to Virtual Machines, which are tricked by the hypervisor layer to run on real hardware, Docker containers are more friendly with the host and just emulate a minimal file system. They need less time to startup and are typically faster.
Docker is also incredibly easy to use. To make you understand the potential of what I am talking about, the following snippet shows how to start a bash session in a container based on the Ubuntu image. To run it, only 10 seconds were necessary!
ubuntu@victus:~$ docker run -it ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
bccd10f490ab: Pull complete
Digest: sha256:77906da86b60585ce12215807090eb327e7386c8fafb5402369e421f44eff17e
Status: Downloaded newer image for ubuntu:latest
root@062f46837057:/#
A container based on an Ubuntu may not sound so revolutionary. But on top of this image you could add other software components, from a simple python application to whole frontend/backend solutions. From this, you could then create your own personalized Docker image and distribute it, with the only requirement that the system must host the Docker engine.
Following this line of thought, lots of open-source Docker images were developed. You can take a look at some of them at Docker Hub if you are curious.
The most mind-blowing project I found is dockur/windows, a Docker image which allows you to host Windows (from XP to W11) inside a container in a legal way using free-trial licenses, and automating the windows tedious installation process. It saved me when I needed to configure some old IT hardware with software compatible only with Windows XP.
Enough for the introduction, let's get to the server.
System
The system I am using is my first laptop, which retired after 5 stressful long years of Computer Science University. It is equipped with an Intel i5 8th gen processor, 8 GB of ram DDR4, an SSD of 128 GB and HHD of 1 TB. After setting up the OS and installing an SSH server, I removed the laptop screen to reduce the system power consumption and to make it as less invasive as possible. I set it up with a static IP, placed the sever near my home modem-router and connect it via Ethernet cable.
Installation
The system runs on an Ubuntu server image. I don't need the system to run 24/7 since I mainly use it when I am home at night. The only automation I implemented is the system automatic shutdown scheduled for every day at 01:30 AM.
The services hosted by the server were all installed using Docker. To make things maintainable, I created a script that automatically set up the system by:
- Installing the Docker engine and the SSH server;
- Setting up the system automatic shutdown;
- Installing the services via a Docker Compose file.
You can find the setup script on my GitHub repo.
Services
The server hosts a discrete number of applications. I'll quickly list them:
- Jellyfin is a media serving solution. It allows you to share your media over the network;
- Filebrowser is exactly what you expect, a file explorer on the system that exposes a web-UI to perform file-management operations;
- Photoprism is an app that allows you to easily manage and organize your photos. I use it to back up all my phone photos exploiting the mobile app Photosync and the compatible synchronization via WebDAV;
- qBittorrent Torrent client to download whatever you want;
- Sonarr and Radarr are two apps for respectively managing shows and movies;
- Pi-hole is an application that functions both as an ad-blocker for my network and as a local DNS server;
- Homer is a simple app developed by bastienwirtz that allows you to access your server services from a single page.
Performance
Sometimes Jellyfin struggles to serve some media files, thus resulting in a stuttering video. This is probably due to the format in which some videos are encoded and to the relative old CPU. This occurred to me maybe twice since I set up the system one year ago, so nothing too impactful. Apart from this, I never had major problems.
To Do
There are other things I would like to add on a future version of the server.
- Set up the system in a raid configuration;
- Expose the system to the internet safely for hosting a file sharing solution, i.e., Nextcloud, and have a local instance of Bitwarden and GitHub.
External References
- My GitHub repo with the project source code.