Parasol Static Site

The following starter is two container setup works well for two docker containers for website building and webhook listener for changes.

Perhaps it can be repurposed as a recipe?!

Deploy tools with Docker

Docker setup to host a hugo static website with a nginx HTTP server. The website can be updated and built via an external HTTP request using webhookd which pulls the latest version from a .git repository.

Requirements

  • docker
  • docker-compose

Deployment

By default the hook server listens at port 8080 while the static website is hosted on port 9090, the HUGO_GIT_URL variable is set to this very repository.

It is recommended to use an reverse proxy to move both endpoints behind authentication, DNS, TLS etc.

# Start nginx server and webhook / build server in background (-d)
docker-compose up -d

# Rebuild docker files after something changed
docker-compose up --build -d

Do not forget to run the hook for the first time to trigger building the website. This does not happen automatically.

Usage

# Trigger deploy hook via HTTP request
curl -v -XPOST http://localhost:8080/deploy

It is recommended to configure your webhook endpoint to be protected by HTTP Basic authentication. To call that hook generate the header like that:

# Generate authentication token
echo -n user:password | base64

# Trigger deploy hook via authenticated HTTP request
curl -v XPOST -H "Authorization: Basic <insert token here>" https://hook.com/deploy

Private repository

In case you're pulling from a private repository, you need to point at the folder where the ssh keys live. For this, create an .env file or use the -e command line argument when launching docker:

SSH_DIR_PATH=/home/myuser/.ssh

You might want to adjust your configs as docker will not have write access to adjust known_hosts etc:

Host codeberg.org
  StrictHostKeyChecking no

Development

# Build docker image based on Dockerfile
sudo docker build . -t offline

# Run container from this image
sudo docker run \
    -p 8080:8080 \
    -v ./scripts:/scripts \
    -e WHD_SCRIPTS=/scripts \
    -e HUGO_GIT_URL=https://codeberg.org/offline/future \
    offline:latest

License

The following starter was made by @adz for offline.place with the following license:

UNIVERSAL PUBLIC DOMAIN LICENSE

This software and everything else in the universe is in the public domain. Ideas are not property.
Description
Hugo static sites with webhook updates
Readme 139 KiB
Languages
Shell 100%