Deploying Jekyll on Hop3¶
This guide deploys with the build-on-server strategy — Hop3 runs the generator on each deploy. For the concepts and the alternative (build your site at the source and deploy the assets), see the Static Sites overview.
This guide walks you through deploying a Jekyll static site on Hop3. Jekyll is a simple, blog-aware static site generator, powering GitHub Pages.
Prerequisites¶
Before you begin, ensure you have:
- A Hop3 server - Follow the Installation Guide
- The Hop3 CLI - Installed on your local machine
- Ruby 3.0+ - Install via your package manager
- Jekyll - Install with
gem install jekyll bundler - Git - For version control and deployment
Installing Ruby and Jekyll¶
# macOS (Homebrew)
brew install ruby
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
gem install jekyll bundler
# Ubuntu/Debian
sudo apt install ruby ruby-dev build-essential
gem install jekyll bundler
# Verify installation
jekyll -v
Verify your local setup:
Step 1: Install Jekyll and Create Site¶
Install Jekyll and Bundler if not already installed:
Add gem binary path to PATH and verify Jekyll is available:
Create a new Jekyll site:
Install dependencies:
Step 2: Configure the Site¶
Update _config.yml:
title: My Jekyll Site
description: A Jekyll site deployed on Hop3
baseurl: ""
url: "https://hop3-tuto-jekyll.example.com"
# Build settings
markdown: kramdown
theme: minima
# Exclude from build
exclude:
- Gemfile
- Gemfile.lock
- node_modules
- vendor
# Plugins
plugins:
- jekyll-feed
- jekyll-seo-tag
Step 3: Create Content¶
Update the home page:
---
layout: home
title: Welcome to Hop3!
---
Your Jekyll site is running on Hop3.
Jekyll is a simple, blog-aware static site generator perfect for personal projects, documentation, and blogs.
Create an about page:
---
layout: page
title: About
permalink: /about/
---
## About This Site
This Jekyll site demonstrates static site deployment on Hop3.
### Features
- **Simple** - Write in Markdown
- **Blog-aware** - Built-in support for posts
- **Customizable** - Liquid templates and themes
Create a blog post:
---
layout: post
title: "Hello World"
date: 2024-01-01 12:00:00 -0000
categories: blog
---
Welcome to our Jekyll site on Hop3!
## Getting Started
Create new posts in the `_posts` directory:
Step 4: Build and Test¶
Build the site:
Verify the build:
Test locally:
bundle exec jekyll serve &
APP_PID=$!
sleep 5
curl -s http://localhost:4000/ | head -5 || echo "Test completed"
kill "$APP_PID" 2>/dev/null || true
Step 5: Create Deployment Configuration¶
# Pre-build: Install gems and build site
prebuild: bundle install && bundle exec jekyll build
# Serve static files
web: npx serve _site -l $PORT
[metadata]
id = "hop3-tuto-jekyll"
version = "1.0.0"
title = "Hop3 Tutorial - Jekyll"
[build]
before-build = ["bundle install", "bundle exec jekyll build"]
packages = ["ruby", "ruby-dev", "nodejs", "npm"]
[run]
start = "npx serve _site -l $PORT"
[port]
web = 3000
[healthcheck]
path = "/"
timeout = 30
interval = 60
Deploy to Hop3¶
The following steps require a Hop3 server.
Initialize (First Time Only)¶
Deploy¶
Deploy the application (first deployment creates the app):
Set Hostname¶
Configure the hostname for nginx proxy:
Apply Configuration¶
Redeploy to apply the hostname configuration:
Verify Deployment¶
Managing Your Application¶
# Restart the application
hop3 app restart --app hop3-tuto-jekyll
# View logs
hop3 app logs --app hop3-tuto-jekyll
# View/set environment variables
hop3 config show --app hop3-tuto-jekyll
hop3 config set --app hop3-tuto-jekyll NEW_VAR=value
# Scale workers
hop3 ps scale --app hop3-tuto-jekyll web=2
Advanced Configuration¶
Custom Theme¶
# Use a gem-based theme
bundle add just-the-docs
# Or use remote theme (GitHub Pages compatible)
# In _config.yml:
remote_theme: pmarsceill/just-the-docs
Collections¶
Pagination¶
Drafts¶
Multilingual¶
Adding Search (Lunr.js)¶
Troubleshooting¶
Gem Errors¶
Update bundler:
Build Failures¶
Check Ruby version:
Missing Posts¶
Ensure date in filename matches frontmatter.
Example hop3.toml¶
[metadata]
id = "hop3-tuto-jekyll"
version = "1.0.0"
title = "My Jekyll Site"
[build]
before-build = ["bundle install", "JEKYLL_ENV=production bundle exec jekyll build"]
packages = ["ruby", "ruby-dev", "nodejs", "npm"]
[run]
start = "npx serve _site -l $PORT -s"
[port]
web = 3000
[healthcheck]
path = "/"