Installation de git-pages#
Pages#
D’abord, on va télécharger le binaire et le poser au bon endroit.
wget https://codeberg.org/git-pages/git-pages/releases/download/latest/git-pages.linux-amd64
chmod +x git-pages.linux-amd64
cp git-pages.linux-amd64 /usr/local/bin/git-pages
mkdir /var/lib/pages
Ensuite on va configurer le soft.
/etc/pages#
log-format = "json"
[server]
pages = "tcp/localhost:3000"
caddy = "tcp/localhost:3001"
metrics = "tcp/localhost:3002"
[storage]
type = "fs"
[storage.fs]
root = "/var/lib/pages"
[limits]
allowed-repository-url-prefixes = ["https://git.domain.example/"]
allow-basic-auth = false
[[wildcard]]
domain = "pages.domain.example"
clone-url = "https://git.domain.example/<user>/<project>.git"
index-repo = "<user>.pages.domain.example"
index-repo-branch = "pages"
authorization = "forgejo"
Et maintenant, on ajoute le service systemd :
/etc/systemd/system/pages.service#
[Unit]
Description=git-pages static site server
After=network-online.target
Requires=network-online.target
[Install]
WantedBy=multi-user.target
[Service]
ExecStart=/usr/local/bin/git-pages -config /etc/pages
Restart=on-failure
RestartSec=5s
Caddy#
Maintenant, tu vas configurer Caddy pour le TLS.
dnf copr enable @caddy/caddy
dnf install caddy
/etc/caddy/Caddyfile#
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
{
email admin@domain.example
admin off
persist_config off
on_demand_tls {
permission http http://127.0.0.1:3001
}
}
https:// {
tls {
on_demand
}
reverse_proxy 127.0.0.1:3000
}
Finalisation#
Et donc tu peux démarrer le tout.
systemctl enable --now pages
systemctl enable --now caddy
Côté DNS, il faut configurer un wildcard pour *.pages.domain.example :
*.pages.domain.example IN A 203.0.113.15
pages.domain.example IN A 203.0.113.15