Self-Hosting Jekyll on Raspberry Pi
It’s been only a few weeks since I started setting up my production env on my Raspberry Pi, and I’m already loving it! Configuring the firewall and applying port forwarding gave me some hard time but everything is working great now. Over the past years, I’ve tried different cloud services but running a home production server feels like a whole new level of control and satisfaction. Plus, no bills is an extra bonus!
So far, my progress has been rewarding. I’ve successfully have my Jekyll site running and it’s now open to the web. Here’s a flowchart of how the site is served from my machine:
I also automated the deployment process so pushing changes to GitHub magically updates the production site.
to generate static site GitHub->>Pi: Use ssh and scp to copy
static site files Pi->>Nginx: Update static site content Nginx->>User: Serve updated site
Here’s the GitHub Action file that makes the magic happen:
name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
name: Build Jekyll Site
runs-on: ubuntu-latest
steps:
# Step 1: Checkout repo
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.6
bundler-cache: true # Cache dependencies
# Step 3: Install dependencies
- name: Install dependencies
run: bundle install
# Step 4: Build Jekyll site
- name: Build Jekyll Site
run: bundle exec jekyll build
# Step 5: Deploy built site to Raspberry Pi
- name: Deploy to Raspberry Pi
uses: appleboy/[email protected]
with:
host: $
username: $
key: $
port: 22
source: ./_site
target: /home/tae/Projects/my_blog
After hosting a home server, I feel a growing desire to learn more about Linux for good reasons. I know most of production servers are running on Linux but it seems like not many developers (myself included) actually use it for development. As a big fan of Apple, my Mac has been serving me well and I still love it. However, I can’t ignore the fact that the best way to learn something is to just dive in and use it every day. Maybe now’s a good time to give it a try? 🤷♂️