Hugo static sites with webhook updates
Go to file
basebuilder 020db14b1e Update README.md 2024-04-03 17:47:13 +00:00
.env.sample feat: private repos 2024-03-23 13:25:32 +01:00
README.md Update README.md 2024-04-03 17:47:13 +00:00
abra.sh feat: entrypoint basic auth generation 2024-03-23 12:56:39 +01:00
app-entrypoint.sh.tmpl feat: entrypoint basic auth generation 2024-03-23 12:56:39 +01:00
badger-entrypoint.sh.tmpl feat: private repos 2024-03-23 13:25:32 +01:00
compose.auth.yml feat: entrypoint basic auth generation 2024-03-23 12:56:39 +01:00
compose.private.yml feat: private repos 2024-03-23 13:25:32 +01:00
compose.yml feat: private repos 2024-03-23 13:25:32 +01:00
default.conf.tmpl feat: entrypoint basic auth generation 2024-03-23 12:56:39 +01:00
deploy.sh.tmpl feat: follow entrypoint orthodoxy 2024-03-23 11:39:37 +01:00
deploy_key.tmpl wip: running pass on remaining features 2024-03-22 00:00:14 +01:00
ssh_config.tmpl wip: running pass on remaining features 2024-03-22 00:00:14 +01:00

README.md

Parasol Static Site

A recipe for generating static websites with Hugo and a listener service which triggers git pulls and builds via webhookd

  • Category: Development
  • Status: 0, dev
  • Image: site-badger
  • Healthcheck: {{ .Healthcheck }}
  • Backups: No
  • Email: No
  • Tests: No
  • SSO: No

Quick start

  • abra app new parasol-static-site --secrets
  • abra app config <app-site-name>
  • abra app deploy <app-site-name>

For more, see docs.coopcloud.tech.

Modes

There are three different types of deployments currently supported:

  • Public Site & Repo
  • Public Site & Private Repo
  • Private Site & Repo

Public

The default deployment is fully public:

  • /: the Hugo site is served
  • /deploy: triggers webhookd to re-build the site, includes publicly viewable build logs

HTTP Basic Auth

If you enable this in your .env file:

COMPOSE_FILE="compose.yml:compose.auth.yml"
AUTH_ENABLED=1
AUTH_USERNAME=foobar
SECRET_AUTH_PASSWORD_VERSION=v1

Then you can run abra app secret generate -a <domain>.

When you deploy:

  • /: the Hugo site is served
  • /deploy: the webhook is behind HTTP basic auth

Private Repository

If you enable this in your .env file:

COMPOSE_FILE="compose.yml:compose.private.yml"
PRIVATE_ENABLED=1
SECRET_DEPLOY_KEY_VERSION=v1

Then you need to generate a SSH key:

$ ssh-keygen -a 100 -t ed25519

Then, you need to remove the final newline of the file:

$ truncate -s -1 <ssh-private-key-file>

Due to a limitation in abra (can't insert files yet), you'll have to manually ingest the privater key file with this command:

$ DOCKER_CONTEXT=example.org docker secret create example_org_deploy_key_v1 /path/to/ssh-private-key

Assuming that completes with no errors, run the following command to confirm the key was written to the server and look for true in the far right column:

$ abra app secret ls example.org

Assuming the previous steps were correct, you should see true in the far right column.

+------------+---------+----------------------------+-------------------+
|    NAME    | VERSION |       GENERATED NAME       | CREATED ON SERVER |
+------------+---------+----------------------------+-------------------+
| deploy_key | v1      | example_org_deploy_key_v1  | true              |
+------------+---------+----------------------------+-------------------+

Then, you need to upload the public SSH key part to the Git repository settings as a "Deploy key". In Gitea, that is located in:

Repository Settings > Deploy keys

You can then deploy and the deploy key will be loaded before cloning the private repository and all should nicely.

HTTP Basic Auth & Private Repository

Combine them with the COMPOSE_FILE technique:

COMPOSE_FILE="compose.yml:compose.auth.yml:compose.private.yml"

Troubleshooting

This is a WIP, there are likely dragons and foot cannons. Ye be warned.

Site not generating?

You can manually trigger the site build yourself:

abra app run <domain> badger sh
sh /root/scripts/deploy.sh

SSH keys not working?

You can get in and inspect the SSH keys via the following:

abra app run <domain> badger sh
ls /root/.ssh

HTTP Basic auth not working?

Best to check the generated password file:

abra app run <domain> badger sh
cat /etc/nginx/.htpasswd

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.