|
|
|
@@ -1,15 +1,22 @@
|
|
|
|
|
# Parasol Static Site :open_umbrella: :spider_web:
|
|
|
|
|
|
|
|
|
|
[](https://build.coopcloud.tech/coop-cloud/parasol-static-site)
|
|
|
|
|
|
|
|
|
|
A recipe for generating static websites with [Hugo](https://gohugo.io) and a listener service which triggers git pulls and builds via [webhookd](https://github.com/ncarlier/webhookd)
|
|
|
|
|
|
|
|
|
|
<!-- metadata -->
|
|
|
|
|
|
|
|
|
|
* **Maintainer**: [@stevensting](https://git.coopcloud.tech/stevensting)
|
|
|
|
|
* **Category**: Development
|
|
|
|
|
* **Status**: 0, dev
|
|
|
|
|
* **Image**: [site-badger](https://codeberg.org/eotl/site-badger)
|
|
|
|
|
* **Healthcheck**: {{ .Healthcheck }}
|
|
|
|
|
* **Backups**: No
|
|
|
|
|
* **Email**: No
|
|
|
|
|
* **Status**: 3, stable
|
|
|
|
|
* **Image**: [site-badger](https://git.coopcloud.tech/toolshed/site-badger)
|
|
|
|
|
* **Healthcheck**: yes
|
|
|
|
|
* **Backups**: not necessary
|
|
|
|
|
* **Email**: not necessary
|
|
|
|
|
* **Tests**: No
|
|
|
|
|
* **SSO**: No
|
|
|
|
|
* **SSO**: not necessary
|
|
|
|
|
|
|
|
|
|
<!-- endmetadata -->
|
|
|
|
|
|
|
|
|
|
## Quick start
|
|
|
|
|
|
|
|
|
@@ -17,13 +24,11 @@ A recipe for generating static websites with [Hugo](https://gohugo.io) and a lis
|
|
|
|
|
* `abra app config <app-site-name>`
|
|
|
|
|
* `abra app deploy <app-site-name>`
|
|
|
|
|
|
|
|
|
|
This will deploys a public website built from a Hugo site stored in a **public
|
|
|
|
|
git repository.** If you need various private modes, there are four different
|
|
|
|
|
deployment scenarios supported:
|
|
|
|
|
This will deploy a **public website** built from a Hugo site stored in a **git repository.** If you need various private modes, there are different deployment options supported:
|
|
|
|
|
|
|
|
|
|
- Public Site & Public Repo
|
|
|
|
|
- HTTP Basic Auth & Public Repo
|
|
|
|
|
- Public Site & Private Repo
|
|
|
|
|
- Public Git Repo
|
|
|
|
|
- Private Git Repo with deploy key
|
|
|
|
|
- /deploy endpoint protected with HTTP Basic Auth
|
|
|
|
|
- HTTP Basic Auth & Private Repo
|
|
|
|
|
|
|
|
|
|
### Public Site & Public Repo
|
|
|
|
@@ -31,12 +36,12 @@ deployment scenarios supported:
|
|
|
|
|
The default deployment is a **fully public** site and **public git repository.**
|
|
|
|
|
|
|
|
|
|
* `/`: the Hugo site is served
|
|
|
|
|
* `/deploy`: triggers `webhookd` to re-build the site, **includes publicly viewable build logs**
|
|
|
|
|
* `/deploy`: triggers `webhookd` to re-build the site, includes publicly viewable build logs. ⚠️ **Be aware that misuse could lead to constant CPU usage on your server, as /deploy is not rate limited. This mode is not recommended**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### HTTP Basic Auth
|
|
|
|
|
### Use HTTP Basic Auth for `/deploy` endpoint
|
|
|
|
|
|
|
|
|
|
To enable a password protected site built from a public git repo, uncomment the
|
|
|
|
|
To enable a password protected /deploy endpoint, uncomment the
|
|
|
|
|
following lines in your `.env` file:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
@@ -48,13 +53,19 @@ SECRET_AUTH_PASSWORD_VERSION=v1
|
|
|
|
|
|
|
|
|
|
Then run `abra app secret generate -a <domain>` command.
|
|
|
|
|
|
|
|
|
|
When you deploy:
|
|
|
|
|
### Use automatic deployment with your GIT instance
|
|
|
|
|
|
|
|
|
|
* `/`: the Hugo site is served
|
|
|
|
|
* `/deploy`: the webhook is behind HTTP Basic Auth
|
|
|
|
|
Depending on which git platform you use, adding the auth information might be a little different. This is how it works with Forgejo/Codeberg.
|
|
|
|
|
Generate a bas64 coded token for the protected endpoint:
|
|
|
|
|
```
|
|
|
|
|
echo -n '<username>:<SECRET_AUTH_PASSWORD>' | base64
|
|
|
|
|
```
|
|
|
|
|
Create a webhook which triggers the endpoint <your-domain>/deploy on push events for your git branch and add the following to the field authentication header:
|
|
|
|
|
```
|
|
|
|
|
Basic <bas64-coded-token>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Private Repository
|
|
|
|
|
### Us a Private Repository
|
|
|
|
|
|
|
|
|
|
If you enable the following lines in your `.env` file:
|
|
|
|
|
|
|
|
|
@@ -67,18 +78,16 @@ SECRET_DEPLOY_KEY_VERSION=v1
|
|
|
|
|
Then you need to generate a SSH key:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ ssh-keygen -a 100 -t ed25519
|
|
|
|
|
$ ssh-keygen -a 100 -t ed25519 -C <domainname>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Then, insert the secret:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ abra secret insert <domain> deploy_key v1 -f -t <ssh-private-key-file>
|
|
|
|
|
$ abra secret insert <domain> deploy_key v1 -f -t <path-to/ssh-private-key-file>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
You now need to upload the Public SSH key to the Git repository settings
|
|
|
|
|
as a `Deploy Key` at which forge website you use. This is usually
|
|
|
|
|
located in some web UI flow like:
|
|
|
|
|
You now need to upload the Public SSH key to the Git repository settings as a `Deploy Key` at the forge website you use. This is usually located in some web UI flow like:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Repository -> Settings > Deploy keys
|
|
|
|
@@ -95,22 +104,12 @@ https://codeberg.org/user/website-repo/settings/keys
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
You can then deploy the abra recipe and the deploy key will be loaded before cloning the
|
|
|
|
|
private repository and all should nicely.
|
|
|
|
|
private repository and all should work nicely.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ abra app deploy example.org
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### HTTP Basic Auth & Private Repository
|
|
|
|
|
|
|
|
|
|
You need to edit the `COMPOSE_FILE=` line to include the following `.yml` files:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
COMPOSE_FILE="compose.yml:compose.auth.yml:compose.private.yml"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
To trigger the deploy webhook with normal HTTP request
|
|
|
|
|