In this HashiQube DevOps lab, you'll get hands-on experience with Docsify - a modern documentation site generator.
Docsify generates your documentation website on the fly. Unlike traditional documentation generators, it doesn't produce static HTML files. Instead, it dynamically loads and parses your Markdown files and displays them as a website. Getting started is simple - just create an index.html
file and you're ready to deploy on platforms like GitHub Pages.
bash docsify/docsify.sh
vagrant up --provision-with basetools,docsify
docker compose exec hashiqube /bin/bash
bash hashiqube/basetools.sh
bash docsify/docsify.sh
After provisioning, you can access Docsify and HashiQube documentation at:
- Zero Static HTML Files - Generates pages on the fly
- Simple Configuration - Minimal setup required to get started
- Multiple Themes - Choose from various pre-built themes
- Plugin System - Extend functionality with plugins
- Full-Text Search - Built-in search capability
- Compatible with GitHub Pages - Deploy with ease
- Markdown Support - Write documentation in easy-to-use Markdown
- Flexible API - Customize to suit your needs
- Docsify converts your Markdown files into HTML on-demand
- It uses a single
index.html
as the entry point - When users access your documentation site, Docsify:
- Loads the requested Markdown file
- Parses it to HTML
- Renders it in the browser
- This approach means:
- No build process required
- Fast setup and development
- Easy maintenance and updates
Want to create your own documentation with Docsify? Here's a simple guide:
-
Create a new directory for your documentation:
mkdir my-docs && cd my-docs
-
Initialize Docsify:
docsify init .
-
This creates three files:
index.html
- The entry pointREADME.md
- Your homepage content.nojekyll
- Prevents GitHub Pages from ignoring files that begin with an underscore
-
Preview your site:
docsify serve
-
Start adding more Markdown files and customize your
index.html
as needed!
The script below automates the setup of Docsify in your HashiQube environment:
#!/bin/bash
# Print the commands that are run
set -x
# Stop execution if something fails
set -e
# This script provisions Docsify
if ! [ -x "$(command -v docsify)" ]; then
echo 'Docsify is not installed, installing it ...' >&2
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs && npm i docsify-cli -g && mkdir -p /vagrant/docs && cp -r /vagrant/* /vagrant/docs/ && cd /vagrant && docsify serve docs -p 3333 > /vagrant/docsify.log 2>&1 & echo 'Docsify installed'
else
echo "Docsify is already installed."
fi