From 52391e802b4caf631605102316e7cbcfce1e2d9c Mon Sep 17 00:00:00 2001 From: Archipelago automation Date: Wed, 4 Nov 2026 20:21:16 +0000 Subject: [PATCH] Initialize D-071 source registry and terra deployment --- .env.example | 6 ++++++ .gitignore | 5 +++++ README.md | 40 +++++++++++++++++++++++++++++++++++ compose.mirror.yaml | 9 ++++++++ compose.yaml | 26 +++++++++++++++++++++++ deploy/Caddyfile | 43 ++++++++++++++++++++++++++++++++++++++ deploy/bootstrap-git.sh | 21 +++++++++++++++++++ deploy/integrate-mirror.py | 39 ++++++++++++++++++++++++++++++++++ deploy/mirror-route.caddy | 8 +++++++ deploy/releases.empty.json | 1 + deploy/terra.env | 6 ++++++ portal/index.html | 20 ++++++++++++++++++ portal/mark.svg | 1 + portal/portal.js | 23 ++++++++++++++++++++ portal/style.css | 1 + 15 files changed, 249 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 README.md create mode 100644 compose.mirror.yaml create mode 100644 compose.yaml create mode 100644 deploy/Caddyfile create mode 100644 deploy/bootstrap-git.sh create mode 100644 deploy/integrate-mirror.py create mode 100644 deploy/mirror-route.caddy create mode 100644 deploy/releases.empty.json create mode 100644 deploy/terra.env create mode 100644 portal/index.html create mode 100644 portal/mark.svg create mode 100644 portal/portal.js create mode 100644 portal/style.css diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..c9b414f --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +# Use an immutable image digest; terra may use a verified local Caddy image ID. +CADDY_IMAGE=caddy@sha256:REPLACE_WITH_VERIFIED_DIGEST +PUBLIC_ROOT=/opt/archipelago/data/public +LISTEN_ADDRESS=127.0.0.1 +LISTEN_PORT=8098 +MIRROR_NETWORK=mirror_default diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f4af4eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.env +data/ +keys/ +*.secret +*.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..570f9ca --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Archipelago infrastructure + +Accepted deployment: terra, https://mirror.nw-sys.ru/archipelago/ (D-071). +Source registries: `Archipelago/core`, `Archipelago/purposes`; contracts: `Archipelago/rfc`. + +## Standalone web deployment + +1. Copy `.env.example` to `.env`, set an immutable Caddy image and `PUBLIC_ROOT`. +2. Create public `iso`, `ostree/layers`, `ostree/images`, `v1` directories. +3. Initialize `PUBLIC_ROOT/releases.json` from `deploy/releases.empty.json` only on + a fresh deployment. Never overwrite a populated catalog during code deployment. +4. `docker compose up -d web` serves the complete `/archipelago/` prefix on localhost + port 8098. Put your HTTPS reverse proxy in front; no mirror dependency is required. + +## Existing terra mirror + +Run `docker compose -f compose.yaml -f compose.mirror.yaml up -d web`, then as root +run `python3 deploy/integrate-mirror.py`. The helper backs up and validates Caddy, +inserts an explicit `/archipelago/` route before the existing fallback, reloads and +restores the original configuration on reload failure. Existing `/archlinux` and +rsync routes are preserved. The web container mounts public artifacts read-only +and never receives a Docker socket, signing key, private staging or build workspace. + +The homepage is public; private experimental ISOs must not be copied into public +storage. The initial empty catalog accurately represents the lack of eligible +testing/stable releases. Source-only Material You-inspired styling and original +artwork require no remote fonts, scripts or upstream logo redistribution. + +## Remaining pipeline work + +The existing CLI ISO experiment is not yet a YAML-driven, independently built layer +pipeline. Required sequence: strict Layer parser and locks → independent layer +build → artifact upload → image composition from registry → ISO from exact image → +validation/reproducibility → signed publication. Add builder/validator/publisher +services only with a verified worker isolation profile; do not deploy a cron job +that advertises missing CLI commands as successful work. + +Registry-backed CLI update and PackageKit/GNOME Software/KDE Discover integration +follow the staged transaction contract in RFC-0009 and D-071. Public signing keys, +release wire schemas and complete update/reapplication evidence remain required. diff --git a/compose.mirror.yaml b/compose.mirror.yaml new file mode 100644 index 0000000..c4bf76e --- /dev/null +++ b/compose.mirror.yaml @@ -0,0 +1,9 @@ +services: + web: + networks: + mirror: + aliases: [archipelago-web] +networks: + mirror: + external: true + name: ${MIRROR_NETWORK:-mirror_default} diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..c8b38b3 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,26 @@ +name: archipelago +services: + web: + image: ${CADDY_IMAGE:?Set a pinned Caddy image digest or local image ID} + restart: unless-stopped + command: [caddy, run, --config, /etc/caddy/Caddyfile, --adapter, caddyfile] + read_only: true + security_opt: [no-new-privileges:true] + cap_drop: [ALL] + # The existing Caddy binary carries this file capability even on port 8080. + cap_add: [NET_BIND_SERVICE] + tmpfs: [/tmp, /config, /data] + ports: + - "${LISTEN_ADDRESS:-127.0.0.1}:${LISTEN_PORT:-8098}:8080" + volumes: + - ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro + - ./portal:/srv/portal:ro + - ${PUBLIC_ROOT:?Set public artifact root}:/srv/artifacts:ro + networks: [web] + healthcheck: + test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:8080/archipelago/healthz] + interval: 30s + timeout: 5s + retries: 3 +networks: + web: {} diff --git a/deploy/Caddyfile b/deploy/Caddyfile new file mode 100644 index 0000000..f8ca811 --- /dev/null +++ b/deploy/Caddyfile @@ -0,0 +1,43 @@ +{ + admin off + auto_https off +} +:8080 { + header { + X-Content-Type-Options nosniff + Referrer-Policy strict-origin-when-cross-origin + Content-Security-Policy "default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'" + } + redir /archipelago /archipelago/ 308 + handle /archipelago/healthz { + respond "ok" 200 + } + handle_path /archipelago/iso/* { + root * /srv/artifacts/iso + file_server + } + handle_path /archipelago/ostree/* { + root * /srv/artifacts/ostree + header Cache-Control "no-cache" + file_server + } + handle_path /archipelago/v1/* { + root * /srv/artifacts/v1 + header Cache-Control "no-cache" + file_server + } + handle /archipelago/releases.json { + root * /srv/artifacts + rewrite * /releases.json + header Cache-Control "no-cache" + file_server + } + handle_path /archipelago/* { + root * /srv/portal + header Cache-Control "no-cache" + file_server + } + handle { + respond "Not found" 404 + } +} diff --git a/deploy/bootstrap-git.sh b/deploy/bootstrap-git.sh new file mode 100644 index 0000000..008ad2a --- /dev/null +++ b/deploy/bootstrap-git.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Initial publication only; subsequent changes use ordinary reviewed Git commits. +set -eu +base=${1:-/opt/archipelago/src} +export GIT_SSH_COMMAND=${GIT_SSH_COMMAND:-'ssh -i /opt/archipelago/keys/source-deploy -o BatchMode=yes -o ConnectTimeout=15 -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new'} +for name in core purposes infrastructure; do + repo="$base/$name" + if test -d "$repo/.git" && git -C "$repo" rev-parse --verify HEAD >/dev/null 2>&1; then + echo "Already initialized: $repo; use ordinary Git workflow" >&2 + continue + fi + git -C "$repo" init -b main + git -C "$repo" config user.name 'Archipelago automation' + git -C "$repo" config user.email 'archipelago@nw-sys.ru' + if ! git -C "$repo" remote get-url origin >/dev/null 2>&1; then + git -C "$repo" remote add origin "ssh://git@git.fasoley.net:2222/Archipelago/$name.git" + fi + git -C "$repo" add . + git -C "$repo" commit -m 'Initialize D-071 source registry and terra deployment' + git -C "$repo" push -u origin main +done diff --git a/deploy/integrate-mirror.py b/deploy/integrate-mirror.py new file mode 100644 index 0000000..0e23b1b --- /dev/null +++ b/deploy/integrate-mirror.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +"""Explicit root deployment helper on terra; validates and backs up mirror config.""" +from pathlib import Path +import os +import subprocess +import sys +import time + +config = Path(sys.argv[1] if len(sys.argv) > 1 else '/opt/mirror/caddy/Caddyfile') +original = config.read_text() +snippet = (Path(__file__).parent / 'mirror-route.caddy').read_text() +marker = ' # Preserve the existing non-Arch mirror frontend.' +if '# BEGIN ARCHIPELAGO' in original: + raise SystemExit('Archipelago route already exists; review changes explicitly') +if original.count(marker) != 1: + raise SystemExit('Unknown mirror configuration: expected exactly one fallback marker') +candidate = original.replace(marker, snippet + '\n' + marker) +temporary = config.with_name('Caddyfile.archipelago-candidate') +temporary.write_text(candidate) +try: + # Candidate is copied into the running container only for validation; live file + # remains untouched until Caddy accepts it with the real modules/environment. + subprocess.run(['docker','cp',str(temporary),'mirror-caddy:/tmp/archipelago-Caddyfile'],check=True) + subprocess.run(['docker','exec','mirror-caddy','caddy','validate','--config','/tmp/archipelago-Caddyfile','--adapter','caddyfile'],check=True) + backup = config.with_name(f'Caddyfile.before-archipelago-{time.time_ns()}') + backup.write_bytes(config.read_bytes()) + # Keep the inode: the existing Docker bind mount targets this file. + with config.open('w') as stream: + stream.write(candidate) + stream.flush() + os.fsync(stream.fileno()) + result = subprocess.run(['docker','exec','mirror-caddy','caddy','reload','--config','/etc/caddy/Caddyfile','--adapter','caddyfile']) + if result.returncode: + config.write_text(original) + subprocess.run(['docker','exec','mirror-caddy','caddy','reload','--config','/etc/caddy/Caddyfile','--adapter','caddyfile'],check=True) + raise SystemExit('Reload failed; original mirror configuration restored') + print(f'Integrated /archipelago/; backup: {backup}') +finally: + temporary.unlink(missing_ok=True) diff --git a/deploy/mirror-route.caddy b/deploy/mirror-route.caddy new file mode 100644 index 0000000..502117d --- /dev/null +++ b/deploy/mirror-route.caddy @@ -0,0 +1,8 @@ + # BEGIN ARCHIPELAGO (managed by infrastructure/deploy/integrate-mirror.py) + handle /archipelago { + redir /archipelago/ 308 + } + handle /archipelago/* { + reverse_proxy archipelago-web:8080 + } + # END ARCHIPELAGO diff --git a/deploy/releases.empty.json b/deploy/releases.empty.json new file mode 100644 index 0000000..0976651 --- /dev/null +++ b/deploy/releases.empty.json @@ -0,0 +1 @@ +{"version":1,"releases":[]} diff --git a/deploy/terra.env b/deploy/terra.env new file mode 100644 index 0000000..c5530b2 --- /dev/null +++ b/deploy/terra.env @@ -0,0 +1,6 @@ +# Verified existing local Caddy image with required modules on terra. +CADDY_IMAGE=sha256:7253722b5f5084a8b1c490f5bf9e63bfb8386b923a4a9d223b1d111519ad57f3 +PUBLIC_ROOT=/opt/archipelago/data/public +LISTEN_ADDRESS=127.0.0.1 +LISTEN_PORT=8098 +MIRROR_NETWORK=mirror_default diff --git a/portal/index.html b/portal/index.html new file mode 100644 index 0000000..7844db4 --- /dev/null +++ b/portal/index.html @@ -0,0 +1,20 @@ + + + + + + + Archipelago — система из выбранных слоёв + + + + + +
+

ARCH LINUX · OSTREE · DECLARATIVE

Ваша система.
Ваш набор слоёв.

Archipelago объединяет экосистему Arch Linux с декларативной композицией и управляемыми образами ОС. От минимального Core до рабочего стола — с явными обновлениями и возможностью отката.

Выбрать образ Изучить архитектуру ↗
+
01

Описывайте намерение

Версионированные YAML-манифесты определяют состав системы. Точные входы сборки закрепляются отдельно.

02

Обновляйте целиком

Новый deployment готовится отдельно. Текущая система продолжает работать до вашей явной перезагрузки.

03

Расширяйте локально

Host Extensions предназначены для локальных пакетов и аппаратных адаптаций. Такие композиции находятся вне официальной поддержки.

+

ISO PORTAL

Начните с Core

Проект в разработке

Публичные образы появляются после обязательных проверок и подтверждения воспроизводимости. Экспериментальные лабораторные сборки не являются релизами testing/stable.

Проверяем каталог релизов…

Core · x86_64 · UEFIGNOME · планируетсяKDE Plasma · планируется
+

OPEN BY DESIGN

Архитектура обсуждается открыто

Контракты, решения и исходники доступны в организации Archipelago. Готовность отдельных компонентов подтверждается проверками, а не только наличием спецификации.

RFC и реестр контрактов ↗
+
+ + diff --git a/portal/mark.svg b/portal/mark.svg new file mode 100644 index 0000000..69e5253 --- /dev/null +++ b/portal/mark.svg @@ -0,0 +1 @@ + diff --git a/portal/portal.js b/portal/portal.js new file mode 100644 index 0000000..2039766 --- /dev/null +++ b/portal/portal.js @@ -0,0 +1,23 @@ +"use strict"; +(async () => { + const list = document.querySelector("#release-list"); + const message = text => { const p = document.createElement("p"); p.className = "empty"; p.textContent = text; list.replaceChildren(p); }; + try { + const response = await fetch("./releases.json", {cache: "no-store"}); + if (!response.ok) throw new Error("catalog unavailable"); + const catalog = await response.json(); + if (catalog.version !== 1 || !Array.isArray(catalog.releases)) throw new Error("unknown catalog"); + if (!catalog.releases.length) { message("Публичных ISO пока нет. Идут экспериментальные проверки Core; релизы появятся здесь после прохождения всех обязательных критериев."); return; } + const cards = catalog.releases.map(release => { + if (!['testing','stable'].includes(release.channel) || !/^[0-9a-f]{64}$/.test(release.sha256)) throw new Error("invalid release"); + const url = new URL(release.url, location.href); + if (url.origin !== location.origin || !url.pathname.startsWith('/archipelago/iso/')) throw new Error("invalid artifact URL"); + const card = document.createElement('article'); card.className = 'release'; + const title = document.createElement('h3'); title.textContent = `${release.variant} · ${release.architecture} · ${release.channel}`; + const link = document.createElement('a'); link.href = url.href; link.textContent = `Скачать ISO · ${release.version}`; + const hash = document.createElement('p'); const code = document.createElement('code'); code.textContent = `SHA-256: ${release.sha256}`; hash.append(code); + card.append(title,link,hash); return card; + }); + list.replaceChildren(...cards); + } catch { message("Каталог релизов временно недоступен. Непроверенные ссылки на скачивание не отображаются."); } +})(); diff --git a/portal/style.css b/portal/style.css new file mode 100644 index 0000000..ce8c0c1 --- /dev/null +++ b/portal/style.css @@ -0,0 +1 @@ +:root{color-scheme:light dark;--bg:#f5f7f2;--ink:#182c29;--muted:#4d625b;--surface:#e4ece6;--accent:#1b6758;--soft:#cee9dd;--line:#c2d0c7;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--ink)}a{color:inherit;text-underline-offset:.25em}a:focus-visible{outline:3px solid var(--accent);outline-offset:6px}main,.navigation,footer{max-width:1200px;margin:auto;padding:24px 40px}.navigation{display:flex;align-items:center;justify-content:space-between;gap:24px}.brand{display:flex;align-items:center;gap:10px;font-weight:750;font-size:22px;text-decoration:none;letter-spacing:-.7px}nav{display:flex;gap:24px;font-size:14px}nav a{text-decoration:none}.hero{display:grid;grid-template-columns:1.5fr 1fr;align-items:center;gap:50px;padding:70px 0 80px}.eyebrow{letter-spacing:.16em;font-size:11px;font-weight:750;color:var(--accent)}h1{font-size:clamp(40px,5.5vw,68px);letter-spacing:-3px;line-height:1.08;margin:22px 0}h1 span{color:var(--accent)}.intro{font-size:18px;line-height:1.75;color:var(--muted);max-width:630px}.button{display:inline-flex;gap:32px;align-items:center;background:var(--accent);color:#fff;border-radius:36px;padding:18px 24px;text-decoration:none;font-weight:650;margin:20px 22px 12px 0}.text-link{font-size:14px;font-weight:650}.islands{display:grid;gap:18px;transform:rotate(-6deg);padding:22px}.island{border-radius:36px;padding:34px;text-align:center;font-size:23px;font-weight:750;box-shadow:0 14px 0 #163c2910}.island span{display:block;margin-top:8px;font-size:12px;letter-spacing:.04em;font-weight:450}.top{background:#d8e5ff;color:#253956;margin-left:30px}.middle{background:#f2dfbb;color:#4c3d24;margin-right:25px}.base{background:var(--soft);color:#234f40}.features{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.features article{background:var(--surface);padding:28px;border-radius:28px}.number{display:inline-grid;place-items:center;width:38px;height:38px;border:1px solid var(--line);border-radius:50%;font-size:12px}h2{font-size:25px;line-height:1.2;letter-spacing:-.7px}.features p,.downloads p,.about p,footer p{color:var(--muted);line-height:1.7}.features h2{font-size:20px}.downloads{margin:65px 0;padding:36px;border:1px solid var(--line);border-radius:36px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:20px}.section-heading h2{font-size:34px;margin:8px 0}.pill{background:var(--soft);color:var(--accent);padding:10px 16px;border-radius:30px;font-size:12px;white-space:nowrap}.empty{background:var(--surface);border-radius:20px;padding:24px;margin:28px 0}.planned{display:flex;flex-wrap:wrap;gap:10px}.planned span{font-size:12px;border:1px solid var(--line);border-radius:20px;padding:8px 12px}.release{background:var(--surface);border-radius:24px;padding:24px;margin:20px 0}.release code{overflow-wrap:anywhere;font-size:12px}.release a{display:inline-block;margin:8px 16px 8px 0}.about{max-width:730px;padding-bottom:65px}.about h2{font-size:35px}footer{border-top:1px solid var(--line);padding-top:32px;padding-bottom:40px;font-size:12px}footer p{max-width:850px}@media(max-width:800px){main,.navigation,footer{padding-left:22px;padding-right:22px}.navigation{align-items:flex-start;flex-direction:column}nav{gap:16px;flex-wrap:wrap}.hero{grid-template-columns:1fr;padding:35px 0;gap:16px}.islands{max-width:420px;margin:auto;width:100%}.island{padding:22px}.features{grid-template-columns:1fr}h1{letter-spacing:-2px}.downloads{padding:24px;margin:40px 0}.section-heading{align-items:flex-start;flex-direction:column}}@media(prefers-color-scheme:dark){:root{--bg:#101c19;--ink:#e1ece5;--muted:#b4c7bc;--surface:#20312b;--accent:#98d5b9;--soft:#274a3c;--line:#3c5347}.button{background:#a8dfc5;color:#173f31}.base{color:#cbefdc}.top{background:#334560;color:#e2eaff}.middle{background:#514735;color:#f6e6c7}}@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}.islands{transform:none}}