I decided to start a home server with an internal website so I could document all of my notes and thoughts about the new technologies that I look into. I figured that it could be some good practice to test how posts look on the internal site before publishing them to this site.
Setup
I guess we can start with how I set this up in the first place. The entire server is running off of my Raspberry Pi 4. I installed the Ubuntu Server OS and started with just a couple additions to get everything set up. Installing Ubuntu Server is fairly simple on the Raspberry Pi. All you need to do it select the proper OS image from the Raspberry Pi Imager tool and flash the MicroSD card. Before you actually flash it, make sure to enable SSH via the custom settings in the Imager and make sure to copy down the credentials that you are going to connect with.
Docker
The first thing I knew I needed to install was Docker. I followed the simplified steps on the Docker Documentation https://docs.docker.com/engine/install/ubuntu/ and ran the following commands
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
# Install Docker's Software:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Add your user to the Docker group:
sudo usermod -aG docker $USER
# Verify that Docker is installed properly:
docker version
With this, we should now have Docker fully installed and ready to go. We will use Docker to download pre-built images of the software and have them containerized, for quick and easy setup and configuration.
CasaOS
I decided to use CasaOS as the home front for my home server. I used to use Portainer to configure the containers and Heimdall as the “Home Page”, but I feel that CasaOS does a better job, as it simplifies the process, by doing both jobs at the same time.
To install CasaOS, I just ran the simple command from their homepage: https://casaos.io/
curl -fsSL https://get.casaos.io | sudo bash
It might take a couple minutes to finish up, but once that’s finished, CasaOS should be ready to go for you to install some applications on it. To connect to the CasaOS, just open up the IP Address of your Raspberry Pi in your computer and it should bring you to the setup screen.
WireGuard VPN
By utilizing WireGuard VPN, I’m able to connect back to my Raspberry Pi while I’m out of the house, so I can always connect and work on what I want to.
Since we installed CasaOS, they actually show WireGuard VPN as an offered app in their built in App Store. The only thing we really need to setup on the technical side is to enable Port Forwarding on your home router to allow traffic to the Raspberry Pi from that port.
Go to your phone and install the WireGuard VPN app from the app store and click on the + button to add a new tunnel.
Then once you run WireGuard VPN and open the web client, all you have to do is scan the QR code when you add a new device and boom. All done.
WordPress
This is the final step to get the actual site up and running. There are 3 containers up and running to make this all work, but you really only need 2 of them. First, I have a MariaDB running to store all the files and posts for the site, I have the PHPMyAdmin service running, so I can view all the files of the database easily, and then the actual WordPress site.
name: wordpress
services:
phpmyadmin:
cpu_shares: 90
command: []
container_name: pma-wp
deploy:
resources:
limits:
memory: 7807M
environment:
- MYSQL_PASSWORD={PASSWORD}
- MYSQL_ROOT_PASSWORD={PASSWORD}
- MYSQL_USER={USER}
- PMA_HOST=wordpress-db:3306
hostname: pma-wp
image: phpmyadmin:latest
labels:
icon: https://icon.casaos.io/main/all/wordpress.png
ports:
- target: 80
published: "8081"
protocol: tcp
privileged: true
restart: unless-stopped
volumes: []
devices: []
cap_add: []
networks:
- wordpress-db
wordpress:
cpu_shares: 90
command: []
container_name: wordpress
depends_on:
wordpress-db:
condition: service_started
required: true
deploy:
resources:
limits:
memory: 7807M
environment:
- WORDPRESS_DB_HOST=wordpress-db:3306
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_DB_PASSWORD={PASSWORD}
- WORDPRESS_DB_USER={USER}
hostname: wordpress
image: wordpress:latest
labels:
icon: https://icon.casaos.io/main/all/wordpress.png
ports:
- target: 80
published: "8101"
protocol: tcp
privileged: true
restart: unless-stopped
volumes:
- type: bind
source: /DATA/AppData/wordpress/wp-data
target: /var/www/html
devices: []
cap_add: []
networks:
- wordpress-db
wordpress-db:
cpu_shares: 90
command: []
container_name: wordpress-db
deploy:
resources:
limits:
memory: 7807M
environment:
- MYSQL_DATABASE=wordpress
- MYSQL_PASSWORD={PASSWORD}
- MYSQL_ROOT_PASSWORD={PASSWORD}
- MYSQL_USER={USER}
hostname: wordpress-db
image: mariadb:latest
labels:
icon: https://icon.casaos.io/main/all/wordpress.png
ports:
- target: 3306
published: "3306"
protocol: tcp
privileged: true
restart: unless-stopped
volumes:
- type: bind
source: /DATA/AppData/wordpress/data-db
target: /var/lib/mysql
devices: []
cap_add: []
networks:
- wordpress-db
networks:
wordpress-db:
name: wordpress-db
x-casaos:
architectures:
- amd64
- arm64
author: Labarta
category: Utilities
description:
en_us: WordPress for CasaOS.
hostname: ""
icon: https://icon.casaos.io/main/all/wordpress.png
index: /
is_uncontrolled: false
port_map: "8101"
scheme: http
store_app_id: wordpress
tagline:
en_us: Provides additional features to CasaOS.
title:
custom: WordPress