From 7f0a4e5ca999189527bf0739467787fe74a51f8a Mon Sep 17 00:00:00 2001 From: crapStone Date: Wed, 15 Nov 2023 17:59:04 +0000 Subject: [PATCH] small cleanup (#259) Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/259 Co-authored-by: crapStone Co-committed-by: crapStone --- FEATURES.md | 14 +++++++--- README.md | 27 +++++++++---------- .../haproxy-sni}/.gitignore | 0 .../haproxy-sni}/README.md | 0 .../haproxy-sni}/dhparam.pem | 0 .../haproxy-sni}/docker-compose.yml | 0 .../haproxy-sni}/gitea-www/index.html | 0 .../haproxy-sni}/gitea.Caddyfile | 0 .../haproxy-certificates/codeberg.org.pem | 0 .../haproxy-certificates/codeberg.org.pem.key | 0 .../haproxy-sni}/haproxy.cfg | 0 .../haproxy-sni}/pages-www/index.html | 0 .../haproxy-sni}/pages.Caddyfile | 0 {haproxy-sni => examples/haproxy-sni}/test.sh | 0 14 files changed, 23 insertions(+), 18 deletions(-) rename {haproxy-sni => examples/haproxy-sni}/.gitignore (100%) rename {haproxy-sni => examples/haproxy-sni}/README.md (100%) rename {haproxy-sni => examples/haproxy-sni}/dhparam.pem (100%) rename {haproxy-sni => examples/haproxy-sni}/docker-compose.yml (100%) rename {haproxy-sni => examples/haproxy-sni}/gitea-www/index.html (100%) rename {haproxy-sni => examples/haproxy-sni}/gitea.Caddyfile (100%) rename {haproxy-sni => examples/haproxy-sni}/haproxy-certificates/codeberg.org.pem (100%) rename {haproxy-sni => examples/haproxy-sni}/haproxy-certificates/codeberg.org.pem.key (100%) rename {haproxy-sni => examples/haproxy-sni}/haproxy.cfg (100%) rename {haproxy-sni => examples/haproxy-sni}/pages-www/index.html (100%) rename {haproxy-sni => examples/haproxy-sni}/pages.Caddyfile (100%) rename {haproxy-sni => examples/haproxy-sni}/test.sh (100%) diff --git a/FEATURES.md b/FEATURES.md index 7560a1d..3d2f394 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -2,13 +2,19 @@ ## Custom domains -... +Custom domains can be used by creating a `.domains` file with the domain name, e.g.: + +```text +codeberg.page +``` + +You also have to set some DNS records, see the [Codeberg Documentation](https://docs.codeberg.org/codeberg-pages/using-custom-domain/). ## Redirects Redirects can be created with a `_redirects` file with the following format: -``` +```text # Comment from to [status] ``` @@ -30,7 +36,7 @@ from to [status] Redirects all paths to `/index.html` for single-page apps. -``` +```text /* /index.html 200 ``` @@ -38,7 +44,7 @@ Redirects all paths to `/index.html` for single-page apps. Redirects every path under `/articles` to `/posts` while keeping the path. -``` +```text /articles/* /posts/:splat 302 ``` diff --git a/README.md b/README.md index 9ec3aab..39caa24 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,7 @@ It is suitable to be deployed by other Gitea instances, too, to offer static pag **End user documentation** can mainly be found at the [Wiki](https://codeberg.org/Codeberg/pages-server/wiki/Overview) and the [Codeberg Documentation](https://docs.codeberg.org/codeberg-pages/). - - Get It On Codeberg + Get It On Codeberg ## Quickstart @@ -61,18 +60,18 @@ but if you want to run it on a shared IP address (and not a standalone), you'll need to configure your reverse proxy not to terminate the TLS connections, but forward the requests on the IP level to the Pages Server. -You can check out a proof of concept in the `haproxy-sni` folder, -and especially have a look at [this section of the haproxy.cfg](https://codeberg.org/Codeberg/pages-server/src/branch/main/haproxy-sni/haproxy.cfg#L38). +You can check out a proof of concept in the `examples/haproxy-sni` folder, +and especially have a look at [this section of the haproxy.cfg](https://codeberg.org/Codeberg/pages-server/src/branch/main/examples/haproxy-sni/haproxy.cfg#L38). -### Environment +### Environment Variables - `HOST` & `PORT` (default: `[::]` & `443`): listen address. - `PAGES_DOMAIN` (default: `codeberg.page`): main domain for pages. -- `RAW_DOMAIN` (default: `raw.codeberg.page`): domain for raw resources. +- `RAW_DOMAIN` (default: `raw.codeberg.page`): domain for raw resources (must be subdomain of `PAGES_DOMAIN`). - `GITEA_ROOT` (default: `https://codeberg.org`): root of the upstream Gitea instance. - `GITEA_API_TOKEN` (default: empty): API token for the Gitea instance to access non-public (e.g. limited) repos. -- `RAW_INFO_PAGE` (default: https://docs.codeberg.org/pages/raw-content/): info page for raw resources, shown if no resource is provided. -- `ACME_API` (default: https://acme-v02.api.letsencrypt.org/directory): set this to https://acme.mock.director to use invalid certificates without any verification (great for debugging). +- `RAW_INFO_PAGE` (default: ): info page for raw resources, shown if no resource is provided. +- `ACME_API` (default: ): set this to to use invalid certificates without any verification (great for debugging). ZeroSSL might be better in the future as it doesn't have rate limits and doesn't clash with the official Codeberg certificates (which are using Let's Encrypt), but I couldn't get it to work yet. - `ACME_EMAIL` (default: `noreply@example.email`): Set the email sent to the ACME API server to receive, for example, renewal reminders. - `ACME_EAB_KID` & `ACME_EAB_HMAC` (default: don't use EAB): EAB credentials, for example for ZeroSSL. @@ -80,10 +79,9 @@ and especially have a look at [this section of the haproxy.cfg](https://codeberg - `ACME_USE_RATE_LIMITS` (default: true): Set this to false to disable rate limits, e.g. with ZeroSSL. - `ENABLE_HTTP_SERVER` (default: false): Set this to true to enable the HTTP-01 challenge and redirect all other HTTP requests to HTTPS. Currently only works with port 80. - `DNS_PROVIDER` (default: use self-signed certificate): Code of the ACME DNS provider for the main domain wildcard. - See https://go-acme.github.io/lego/dns/ for available values & additional environment variables. + See for available values & additional environment variables. - `LOG_LEVEL` (default: warn): Set this to specify the level of logging. - ## Contributing to the development The Codeberg team is very open to your contribution. @@ -119,7 +117,8 @@ Make sure you have [golang](https://go.dev) v1.20 or newer and [just](https://ju run `just dev` now this pages should work: - - https://cb_pages_tests.localhost.mock.directory:4430/images/827679288a.jpg - - https://momar.localhost.mock.directory:4430/ci-testing/ - - https://momar.localhost.mock.directory:4430/pag/@master/ - - https://mock-pages.codeberg-test.org:4430/README.md + +- +- +- +- diff --git a/haproxy-sni/.gitignore b/examples/haproxy-sni/.gitignore similarity index 100% rename from haproxy-sni/.gitignore rename to examples/haproxy-sni/.gitignore diff --git a/haproxy-sni/README.md b/examples/haproxy-sni/README.md similarity index 100% rename from haproxy-sni/README.md rename to examples/haproxy-sni/README.md diff --git a/haproxy-sni/dhparam.pem b/examples/haproxy-sni/dhparam.pem similarity index 100% rename from haproxy-sni/dhparam.pem rename to examples/haproxy-sni/dhparam.pem diff --git a/haproxy-sni/docker-compose.yml b/examples/haproxy-sni/docker-compose.yml similarity index 100% rename from haproxy-sni/docker-compose.yml rename to examples/haproxy-sni/docker-compose.yml diff --git a/haproxy-sni/gitea-www/index.html b/examples/haproxy-sni/gitea-www/index.html similarity index 100% rename from haproxy-sni/gitea-www/index.html rename to examples/haproxy-sni/gitea-www/index.html diff --git a/haproxy-sni/gitea.Caddyfile b/examples/haproxy-sni/gitea.Caddyfile similarity index 100% rename from haproxy-sni/gitea.Caddyfile rename to examples/haproxy-sni/gitea.Caddyfile diff --git a/haproxy-sni/haproxy-certificates/codeberg.org.pem b/examples/haproxy-sni/haproxy-certificates/codeberg.org.pem similarity index 100% rename from haproxy-sni/haproxy-certificates/codeberg.org.pem rename to examples/haproxy-sni/haproxy-certificates/codeberg.org.pem diff --git a/haproxy-sni/haproxy-certificates/codeberg.org.pem.key b/examples/haproxy-sni/haproxy-certificates/codeberg.org.pem.key similarity index 100% rename from haproxy-sni/haproxy-certificates/codeberg.org.pem.key rename to examples/haproxy-sni/haproxy-certificates/codeberg.org.pem.key diff --git a/haproxy-sni/haproxy.cfg b/examples/haproxy-sni/haproxy.cfg similarity index 100% rename from haproxy-sni/haproxy.cfg rename to examples/haproxy-sni/haproxy.cfg diff --git a/haproxy-sni/pages-www/index.html b/examples/haproxy-sni/pages-www/index.html similarity index 100% rename from haproxy-sni/pages-www/index.html rename to examples/haproxy-sni/pages-www/index.html diff --git a/haproxy-sni/pages.Caddyfile b/examples/haproxy-sni/pages.Caddyfile similarity index 100% rename from haproxy-sni/pages.Caddyfile rename to examples/haproxy-sni/pages.Caddyfile diff --git a/haproxy-sni/test.sh b/examples/haproxy-sni/test.sh similarity index 100% rename from haproxy-sni/test.sh rename to examples/haproxy-sni/test.sh