Pages
Pages publishes a branch of a repository as a static website. Forgejo has no equivalent, so everything on this page is specific to Arbinel. This page is for site administrators. For repository owners, see Publish a site with Pages.
Arbinel does not serve the sites itself. It sends the content to a separate Pages backend and notifies the backend when a site changes. Arbinel supports two backends:
- git-pages runs on your own servers. It uses git-pages, the software behind Codeberg Pages.
- StaticHost is the hosted service at statichost.eu. It needs a StaticHost team and API key.
Only git-pages supports additional branches.
Enable Pages
Section titled “Enable Pages”Pages is configured in the web interface, not in app.ini.
The settings are stored in the database, so every node of a high availability cluster sees the same values.
- Open Site administration > Integrations > Pages (
/admin/pages). - Select Enable Pages.
- Select the Pages Backend and fill in its section.
- Set the Pages Domain under Common.
- Select Save Settings.
When Pages is enabled, repository admins see a Pages tab in the repository settings. The form does not save an enabled configuration if a field that the selected backend needs is empty.
Arbinel encrypts secrets in the database. To keep a stored secret, leave its field empty when you save.
git-pages settings
Section titled “git-pages settings”| Field | Setting key | Default | Meaning |
|---|---|---|---|
| git-pages Endpoints | pages.gitpages_endpoints |
empty | Comma-separated base URLs of the git-pages nodes, for example http://10.0.0.1:3000, http://10.0.0.2:3000. |
| git-pages Wildcard Domain | pages.gitpages_domain |
empty | The domain git-pages serves sites under, the same as the [[wildcard]] domain in its own configuration. |
| Forge token | pages.gitpages_forge_token |
empty | The token sent with every publish. See Forge token. |
StaticHost settings
Section titled “StaticHost settings”| Field | Setting key | Default | Meaning |
|---|---|---|---|
| StaticHost Team ID | pages.statichost_team_id |
empty | The team identifier from StaticHost, such as team_01k6f.... |
| StaticHost API Key | pages.statichost_api_key |
empty | The API key of that team. |
| Forgejo Username | pages.forgejo_username |
empty | Required by the form when StaticHost is selected. |
| Forgejo Access Token | pages.forgejo_access_token |
empty | Stored with the StaticHost settings. |
The StaticHost API address is https://builder.statichost.eu unless the pages.statichost_api setting contains a different address.
Common settings
Section titled “Common settings”| Field | Setting key | Default | Meaning |
|---|---|---|---|
| Enable Pages | pages.enabled |
off | Shows the Pages tab in repository settings. |
| Pages Backend | pages.backend |
statichost |
gitpages or statichost. |
| Pages Domain | pages.domain |
codefloe.page |
The domain sites are served under. Change it for your instance, for example to pages.example.com. |
| Custom domain activation time (minutes) | pages.domain_activation_minutes |
0 |
The longest time a verified custom domain can take to serve its site. See Custom domain activation time. |
Custom domain activation time
Section titled “Custom domain activation time”Set Custom domain activation time (minutes) when your edge proxy loads new custom domains and issues their certificates on a schedule instead of right away.
Use the longest time a verified domain can take to serve its site, which is usually the interval of that schedule.
For example, use 15 for an edge proxy that fetches the site map every 15 minutes.
Repository owners then see this time below their custom domains in Settings > Pages.
The success message after Verify domains, or after adding a custom domain, shows it too.
With 0, Arbinel shows no notice.
The form accepts only a whole number of minutes, 0 or more.
git-pages publishing
Section titled “git-pages publishing”flowchart LR F["Arbinel"] N1["git-pages node 1"] N2["git-pages node 2"] E["edge proxy<br/>TLS, site map"] V["visitor"] F -->|"PUT archive"| N1 F -->|"PUT archive"| N2 N1 -.->|"checks the forge token"| F V --> E E --> N1 E --> N2
- A user pushes to a repository’s Pages branch, or enables Pages, or publishes an additional branch.
- Arbinel archives that branch as a gzipped tar and uploads it to every node in git-pages Endpoints, one after the other.
The request carries the site’s hostname in the
Hostheader and the forge token in theForge-Authorizationheader. - Each node asks Arbinel’s API whether the token has push access to the repository that the hostname and path identify. It accepts the upload only if the answer is yes.
- Visitors reach the nodes through an edge proxy that you run.
The nodes never clone the repository, so private repositories are published the same way as public ones, without a deploy key. Every node keeps its own full copy of every site. If a publish fails on some nodes, Arbinel logs the names of those nodes. The nodes then serve different content until the next publish succeeds.
The nodes must not be reachable from the internet. Anyone who can reach a node’s endpoint can try to publish to it.
Arbinel stops an upload to a node after 10 minutes. The size of a site is limited by git-pages, not by Arbinel, so set the limit in the git-pages configuration.
Arbinel archives the branch as it is and runs no build.
If the branch contains a statichost.yml, statichost.yaml, .statichost.yml or .statichost.yaml file with a public key, only that directory is published.
This way, sites that were set up for StaticHost keep working.
Forge token
Section titled “Forge token”The forge token must grant push access to every repository that can host a site.
In practice, this is a site administrator’s token.
A token of a regular account can publish only that account’s repositories, and every other site fails with no push permission.
Arbinel accepts the token with or without its scheme, such as token <value> or Bearer <value>.
Arbinel sends a token without a scheme as token <value>.
Addresses
Section titled “Addresses”git-pages serves an owner’s sites under one hostname per owner:
| Repository | Address |
|---|---|
alice/blog |
https://alice.pages.example.com/blog/ |
alice/pages |
https://alice.pages.example.com/ |
alice/blog, branch dev |
https://alice.pages.example.com/blog@dev/ |
The owner’s hostname is the owner name in lower case and otherwise unchanged.
An owner whose name contains a dot cannot publish, because the dot would split the hostname into two labels that a wildcard certificate does not cover.
The nodes must accept underscores in hostnames, which git-pages calls its relaxed-idna feature.
Edge proxy and site map
Section titled “Edge proxy and site map”The edge proxy in front of the nodes handles TLS and custom domains, not Arbinel or git-pages. The edge proxy must:
- terminate TLS for
*.<Pages Domain>and for every custom domain users add, - rewrite hostnames that git-pages does not know to the location where the site is stored.
Arbinel provides the rewrite table as an HAProxy map file:
The endpoint needs a site administrator’s token with the read:admin scope.
It answers 503 while Pages is off or when the backend is not git-pages.
Each line maps a public hostname to <owner>.<Pages Domain> or <owner>.<Pages Domain>/<repo>:
The map lists every custom domain and the older addresses of each site.
Every site has a line for <repo>.<owner>.<Pages Domain>, which was the site address under StaticHost.
Sites that also had a flat <owner>-<repo>.<Pages Domain> address have a line for it too.
The current address of a site has no line, because it already matches the location where the site is stored.
Fetch the map regularly, because it changes whenever a user adds or removes a custom domain.
The map lists a custom domain only after Arbinel has verified that the user controls it. Arbinel also refuses a custom domain that another site already uses.
The pages_domain_verify cron task checks every custom domain again, every hour by default.
A domain whose records are gone stops being listed, and a domain whose record has appeared since it was added is listed.
The repository settings only say that domains are checked again when this task is enabled.
Edge sync
Section titled “Edge sync”An edge proxy that fetches the site map on a schedule serves a new custom domain only at its next fetch. To skip that wait, give Arbinel a URL to call when the custom domains in the map change. For an edge proxy that a Crow CI cron job deploys, this is the URL that runs the cron job right away:
crow repo show -o json <owner>/<repo> prints the repository ID as id, and crow repo cron ls <owner>/<repo> prints the ID of each cron job.
Use a Crow personal access token of a user who can run that cron job.
| Field | Setting key | Default | Meaning |
|---|---|---|---|
| Edge sync URL | pages.edge_sync_url |
empty | The http or https URL that Arbinel sends a POST request to. Empty turns the request off. |
| Edge sync token | pages.edge_sync_token |
empty | Sent as Authorization: Bearer <token>. Without a token, Arbinel sends no Authorization header. |
Arbinel stores the token encrypted and never shows it in the form. Leave the field empty to keep the stored token.
Arbinel sends the request when one of these changes the map:
- a custom domain passes or fails verification, through Verify domains, the API or the
pages_domain_verifycron task, - a user removes or renames a verified custom domain,
- a user enables or disables Pages for a repository,
- Arbinel removes the site of a deleted repository,
- Arbinel moves a site after its repository is renamed or transferred,
- a site administrator changes Enable Pages, Pages Backend, Pages Domain or Edge sync URL.
A domain that is not verified yet is not in the map, so adding one sends no request. Saving a new Edge sync URL sends one request, which lets you check that the URL works.
Arbinel waits 10 seconds after a change and sends one request for every change in that time. A change during a request leads to exactly one more request after it. On a cluster, the node where the change happens sends the request.
Arbinel sends the request in the background and stops it after 15 seconds. When the request fails, Arbinel logs a warning and does not retry. Keep the schedule of the edge proxy, so that its next run still loads any change that a failed request missed.
StaticHost publishing
Section titled “StaticHost publishing”StaticHost creates one site per repository and clones the repository over SSH.
When Pages is enabled, Arbinel adds a deploy key named CodeFloe Pages to the repository.
On every push to the Pages branch, Arbinel asks StaticHost to build the site again.
Each site gets its own hostname, <repo>.<owner>.<Pages Domain>.
StaticHost issues the TLS certificate on the first HTTPS request after a successful deployment.
Custom domains are registered with StaticHost.
StaticHost redirects the other domains of a site to the primary domain.
Additional branches
Section titled “Additional branches”With git-pages, a repository can publish up to five branches besides its main Pages branch. Each one is a separate site, so it uses its own storage on every node. A branch site is republished on every push to the branch and unpublished when the branch is deleted. StaticHost does not support additional branches, so the repository settings do not show this section for StaticHost.
Site removal
Section titled “Site removal”A site is unpublished when the repository admin disables Pages, or when the repository is deleted.
Some deletions, such as purging a user or an organization, do not notify Pages, and a backend can also fail to answer.
The pages_teardown_sweep cron task handles both cases.
It unpublishes every site whose repository no longer exists, and then removes its records.
It runs every 10 minutes. On a cluster, only the leader runs it. You can change the schedule like any other cron task:
A site created on one backend stays on it when you switch the instance to the other backend. Arbinel still deletes it on the backend that created it, as long as that backend is still configured. If you remove the credentials of the old backend, delete its remaining sites there by hand.
Limits
Section titled “Limits”| Limit | Value |
|---|---|
| Additional branches per repository | 5 |
| Custom domains per site | 20 |
| Branch name of an additional branch | Letters, digits, ., _ and -, up to 100 characters |
| Upload timeout per node | 10 minutes |
| Site size | Set in git-pages |
When quotas are on, the API refuses to enable Pages or publish an additional branch for an owner who is over the repository size quota.
Smoke test
Section titled “Smoke test”The repository contains contrib/pages-ci/run.ts, which runs a scheduled end-to-end check of Pages.
It targets codefloe.com and a fixed test repository, so change both before you use it on another instance.