astrapi-mirror 26.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- astrapi_mirror-26.4.1/.claude-memory.md +178 -0
- astrapi_mirror-26.4.1/.github/workflows/publish.yml +31 -0
- astrapi_mirror-26.4.1/.gitignore +7 -0
- astrapi_mirror-26.4.1/CLAUDE.md +3 -0
- astrapi_mirror-26.4.1/PKG-INFO +17 -0
- astrapi_mirror-26.4.1/README.md +93 -0
- astrapi_mirror-26.4.1/astrapi_mirror/__init__.py +0 -0
- astrapi_mirror-26.4.1/astrapi_mirror/_app.py +66 -0
- astrapi_mirror-26.4.1/astrapi_mirror/_cli.py +15 -0
- astrapi_mirror-26.4.1/astrapi_mirror/_paths.py +28 -0
- astrapi_mirror-26.4.1/astrapi_mirror/api/__init__.py +0 -0
- astrapi_mirror-26.4.1/astrapi_mirror/api/fastapi_app.py +28 -0
- astrapi_mirror-26.4.1/astrapi_mirror/api/repo.py +284 -0
- astrapi_mirror-26.4.1/astrapi_mirror/app.yaml +3 -0
- astrapi_mirror-26.4.1/astrapi_mirror/config.yaml +3 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/__init__.py +0 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/__init__.py +19 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/_seed.py +395 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/api.py +91 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/engine.py +280 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/icon-outline.svg +1 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/icon.svg +1 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/jobs.py +253 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/modul.yaml +32 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/schema.yaml +80 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/settings.yaml +65 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/storage.py +4 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/templates/modals/log.html +30 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/templates/modals/sources_list.html +35 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/templates/modals/validate.html +36 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/templates/partials/card_body.html +35 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/templates/partials/list_header.html +3 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/templates/partials/list_row.html +14 -0
- astrapi_mirror-26.4.1/astrapi_mirror/modules/debian/ui.py +115 -0
- astrapi_mirror-26.4.1/astrapi_mirror/navigation.yaml +3 -0
- astrapi_mirror-26.4.1/astrapi_mirror.egg-info/PKG-INFO +17 -0
- astrapi_mirror-26.4.1/astrapi_mirror.egg-info/SOURCES.txt +61 -0
- astrapi_mirror-26.4.1/astrapi_mirror.egg-info/dependency_links.txt +1 -0
- astrapi_mirror-26.4.1/astrapi_mirror.egg-info/entry_points.txt +2 -0
- astrapi_mirror-26.4.1/astrapi_mirror.egg-info/requires.txt +12 -0
- astrapi_mirror-26.4.1/astrapi_mirror.egg-info/top_level.txt +1 -0
- astrapi_mirror-26.4.1/pyproject.toml +41 -0
- astrapi_mirror-26.4.1/requirements.txt +42 -0
- astrapi_mirror-26.4.1/setup.cfg +4 -0
- astrapi_mirror-26.4.1/skel/dl.cloudsmith.io/public/caddy/stable/deb/debian/dists/any-version/InRelease +202 -0
- astrapi_mirror-26.4.1/skel/dl.cloudsmith.io/public/caddy/stable/deb/debian/dists/any-version/Release +183 -0
- astrapi_mirror-26.4.1/skel/dl.cloudsmith.io/public/caddy/stable/deb/debian/dists/any-version/Release.gpg +16 -0
- astrapi_mirror-26.4.1/skel/dl.cloudsmith.io/public/caddy/stable/deb/debian/dists/any-version/main/binary-amd64/Packages +507 -0
- astrapi_mirror-26.4.1/skel/dl.cloudsmith.io/public/caddy/stable/deb/debian/dists/any-version/main/binary-amd64/Packages.gz +0 -0
- astrapi_mirror-26.4.1/skel/dl.cloudsmith.io/public/caddy/stable/deb/debian/dists/any-version/main/binary-amd64/Release +6 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/InRelease +37 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/Packages +138 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/Packages.gz +0 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/Release +22 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/Release.gpg +12 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/Sources +49 -0
- astrapi_mirror-26.4.1/skel/download.opensuse.org/repositories/home:/Masgalor:/LLDAP/Debian_12/Sources.gz +0 -0
- astrapi_mirror-26.4.1/skel/repo.jellyfin.org/debian/dists/bookworm/InRelease +124 -0
- astrapi_mirror-26.4.1/skel/repo.jellyfin.org/debian/dists/bookworm/Release +107 -0
- astrapi_mirror-26.4.1/skel/repo.jellyfin.org/debian/dists/bookworm/Release.gpg +14 -0
- astrapi_mirror-26.4.1/skel/repo.jellyfin.org/debian/dists/bookworm/main/binary-amd64/Packages +1302 -0
- astrapi_mirror-26.4.1/skel/repo.jellyfin.org/debian/dists/bookworm/main/binary-amd64/Packages.gz +0 -0
- astrapi_mirror-26.4.1/skel/repo.jellyfin.org/debian/dists/bookworm/main/binary-amd64/Release +5 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# astrapi-mirror – Claude Memory
|
|
2
|
+
|
|
3
|
+
Projektkontext für Claude Code. Wird im Repo versioniert, damit es auf jedem PC verfügbar ist.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Was ist astrapi-mirror?
|
|
8
|
+
|
|
9
|
+
Web-UI zur Verwaltung und Spiegelung von Linux-Paketrepositorys, aufgebaut auf **astrapi-core**.
|
|
10
|
+
Synchronisiert Repos via **refrapt** (Subprocess), prüft Vollständigkeit nach dem Sync
|
|
11
|
+
und stellt den Mirror unter `/repo/<os>/` bereit. Caddy terminiert TLS extern.
|
|
12
|
+
|
|
13
|
+
Erster OS-Typ: **Debian** (`/repo/debian/`). Architektur erlaubt spätere Erweiterung
|
|
14
|
+
um RPM, Alpine o.ä. als eigene Module.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Stack
|
|
19
|
+
|
|
20
|
+
| Komponente | Details |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Basis | astrapi-core (FastAPI + HTMX + Jinja2) |
|
|
23
|
+
| Sync-Tool | refrapt ≥ 0.4.10 (Subprocess: `refrapt --conf <tempfile>`) |
|
|
24
|
+
| Persistenz | SQLite via `YamlStorage` (astrapi-core) |
|
|
25
|
+
| Serving | Custom FastAPI-Router `/repo/debian/{path:path}` mit Directory-Listing |
|
|
26
|
+
| Port | 5002 (Standard) |
|
|
27
|
+
| Python | ≥ 3.11 |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Verzeichnisstruktur
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
astrapi_mirror/
|
|
35
|
+
├── _app.py # ASGI-App-Factory (analog astrapi-packages)
|
|
36
|
+
├── _cli.py # Console-Script: astrapi-mirror --work-dir … --port 5002
|
|
37
|
+
├── _paths.py # mirror_path(), skel_path(), var_path() – aus Settings-Registry
|
|
38
|
+
├── app.yaml # version, name, display_name
|
|
39
|
+
├── config.yaml # {"app": {"name": "astrapi-mirror", "lang": "de"}}
|
|
40
|
+
├── navigation.yaml # Modulreihenfolge im Menü
|
|
41
|
+
├── api/
|
|
42
|
+
│ ├── fastapi_app.py # FastAPI-Factory (registriert Module + repo-Router)
|
|
43
|
+
│ └── repo.py # /repo/ + /repo/debian/{path:path} – File-Serving + Listing
|
|
44
|
+
└── modules/
|
|
45
|
+
└── debian/
|
|
46
|
+
├── __init__.py # load_modul() + auto_seed() + scheduler register_action
|
|
47
|
+
├── _seed.py # 30 initiale Repos aus refrapt-Config (wird bei leerem Store eingespielt)
|
|
48
|
+
├── api.py # CRUD + /sync-all, /{id}/sync, /{id}/validate, /{id}/sources-list, /refrapt-config
|
|
49
|
+
├── ui.py # CRUD-UI + Sync/Validate/sources.list/Log-Modals
|
|
50
|
+
├── engine.py # Config-Generierung, Validierung (InRelease + Dateigrößen), sources.list
|
|
51
|
+
├── jobs.py # sync_all(), sync_repo() – blockierend; *_async()-Wrapper
|
|
52
|
+
├── storage.py # store = YamlStorage("debian")
|
|
53
|
+
├── schema.yaml # Formularfelder (id, label, url, suites, components, architectures, …)
|
|
54
|
+
├── modul.yaml # label, nav_group, card_actions (kein settings_button)
|
|
55
|
+
├── settings.yaml # mirror_path, skel_path, var_path, threads, limit_rate, language, …
|
|
56
|
+
├── icon.svg # Debian-Swirl-Logo (Simple Icons, currentColor)
|
|
57
|
+
├── icon-outline.svg # Debian-Swirl-Logo (inactive)
|
|
58
|
+
└── templates/
|
|
59
|
+
├── partials/
|
|
60
|
+
│ ├── card_body.html # meta-grid: URL, Anbieter, Suites, Arch, Probleme
|
|
61
|
+
│ ├── list_header.html # URL | Anbieter | Suites
|
|
62
|
+
│ └── list_row.html
|
|
63
|
+
└── modals/
|
|
64
|
+
├── sources_list.html # apt sources.list-Snippet mit Copy-Button
|
|
65
|
+
├── validate.html # Validierungsbericht (InRelease + Dateigrößen)
|
|
66
|
+
└── log.html # Letzter Sync-Status + Validierungsprobleme
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Datenmodell: Debian-Repo-Eintrag
|
|
72
|
+
|
|
73
|
+
Ein Eintrag = ein Provider/URL mit optionalen mehreren Suites.
|
|
74
|
+
Erzeugt beim Config-Export N `deb`-Zeilen in der refrapt.conf.
|
|
75
|
+
|
|
76
|
+
| Feld | Typ | Beispiel |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `id` | str (Key) | `debian-bookworm` |
|
|
79
|
+
| `label` | text | `Debian Bookworm` |
|
|
80
|
+
| `provider_group` | text | `Debian`, `Proxmox`, … |
|
|
81
|
+
| `url` | text | `http://deb.debian.org/debian` |
|
|
82
|
+
| `repo_type` | select | `deb` / `deb-src` |
|
|
83
|
+
| `suites` | list | `["bookworm", "bookworm-updates"]` |
|
|
84
|
+
| `components` | list | `["main", "contrib", "non-free"]` |
|
|
85
|
+
| `architectures` | list | `["amd64", "arm64"]` |
|
|
86
|
+
| `is_flat` | boolean | `false` (Flat-Repos: keine Suite/Komponenten) |
|
|
87
|
+
| `enabled` | boolean | `true` |
|
|
88
|
+
| `last_run` | str | Sync-Zeitstempel (core-Standard) |
|
|
89
|
+
| `last_status` | str | `ok` / `error` / `syncing` (core-Standard) |
|
|
90
|
+
| `last_sync_issues` | list | Validierungsfehler (fehlende Dateien, Größen) |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Sync-Ablauf
|
|
95
|
+
|
|
96
|
+
1. `engine.generate_refrapt_config(repos)` → temp. `refrapt-*.conf`
|
|
97
|
+
2. `refrapt --conf <tempfile>` als Subprocess (Timeout 12h, stdout → Activity-Log)
|
|
98
|
+
3. `engine.validate_repo()` pro Repo: parst `InRelease`, prüft alle referenzierten Dateien auf Existenz + Dateigröße
|
|
99
|
+
4. Status + Issues in Store speichern; Notify senden
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Serving unter /repo/debian/
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
GET /repo/debian/ → Directory-Listing (Provider-Ebene)
|
|
107
|
+
GET /repo/debian/{host}/{path}/ → Directory-Listing
|
|
108
|
+
GET /repo/debian/{host}/{path}/file → FileResponse
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Mirror-Pfad: `{mirror_path}/{hostname}/{url-pfad}/` (refrapt-Standard-Layout)
|
|
112
|
+
|
|
113
|
+
Client-sources.list-Snippet:
|
|
114
|
+
```
|
|
115
|
+
deb https://mirror.example.com/repo/debian/deb.debian.org/debian bookworm main contrib
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Settings (Modul debian)
|
|
121
|
+
|
|
122
|
+
Gespeichert in Settings-Registry unter Modul-Key `debian`.
|
|
123
|
+
Kein `settings_button` in der Modul-Karte – Zugriff über globale App-Einstellungen.
|
|
124
|
+
|
|
125
|
+
| Key | Default | Bedeutung |
|
|
126
|
+
|---|---|---|
|
|
127
|
+
| `mirror_path` | `{work_dir}/mirror` | Hauptverzeichnis (groß, ext. Laufwerk) |
|
|
128
|
+
| `skel_path` | `{work_dir}/skel` | Index-Dateien (SSD empfohlen) |
|
|
129
|
+
| `var_path` | `{work_dir}/var` | Logs + Locks (SSD empfohlen) |
|
|
130
|
+
| `threads` | `4` | Parallele wget-Prozesse |
|
|
131
|
+
| `limit_rate` | `200m` | Bandbreite pro Thread (wget-Syntax) |
|
|
132
|
+
| `language` | `de_DE, en` | Translation-Dateien |
|
|
133
|
+
| `contents` | `True` | Contents-[arch].* laden |
|
|
134
|
+
| `no_check_cert` | `False` | SSL-Zertifikat ignorieren |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Auto-Seed
|
|
139
|
+
|
|
140
|
+
`_seed.py` enthält 30 vorkonfigurierte Repos aus der produktiven refrapt-Config
|
|
141
|
+
(Debian, Proxmox, PostgreSQL, Docker, NodeJS, Grafana, InfluxDB, …).
|
|
142
|
+
Wird in `__init__.py` via `auto_seed(store)` beim ersten Start eingespielt (nur wenn Store leer).
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Icons
|
|
147
|
+
|
|
148
|
+
Jedes OS-Modul bringt `icon.svg` + `icon-outline.svg` mit (Brand-Logo).
|
|
149
|
+
- `debian/`: Offizielles Debian-Swirl (Simple Icons, `currentColor`)
|
|
150
|
+
- Zukünftige Module (RPM, Alpine, …): analog eigene Brand-Icons
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Erweiterung um weitere OS-Typen
|
|
155
|
+
|
|
156
|
+
Neues Modul `astrapi_mirror/modules/rpm/` (oder `alpine/`):
|
|
157
|
+
- Eigenes sync-Tool statt refrapt
|
|
158
|
+
- Eigene Routen unter `/repo/rpm/`
|
|
159
|
+
- Eigenes Brand-Icon
|
|
160
|
+
- Kein Framework-Umbau nötig
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Starten (Entwicklung)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
python -m venv .venv
|
|
168
|
+
source .venv/bin/activate
|
|
169
|
+
pip install -r requirements.txt # enthält -e ../astrapi-core
|
|
170
|
+
pip install -e .
|
|
171
|
+
astrapi-mirror --work-dir ./data --port 5002
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Versionsschema
|
|
177
|
+
|
|
178
|
+
CalVer identisch zu astrapi-core: `YY.MM.patch.devN`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0 # nötig für setuptools-scm
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Build
|
|
24
|
+
run: |
|
|
25
|
+
pip install --quiet build
|
|
26
|
+
python -m build --wheel --sdist
|
|
27
|
+
|
|
28
|
+
- name: Publish to PyPI
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
30
|
+
with:
|
|
31
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: astrapi-mirror
|
|
3
|
+
Version: 26.4.1
|
|
4
|
+
Summary: Mirror Control – Web-UI für Debian-Repository-Spiegel
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: fastapi>=0.115
|
|
7
|
+
Requires-Dist: uvicorn[standard]>=0.30
|
|
8
|
+
Requires-Dist: jinja2>=3.1
|
|
9
|
+
Requires-Dist: APScheduler>=3.10
|
|
10
|
+
Requires-Dist: pyyaml>=6.0
|
|
11
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
12
|
+
Requires-Dist: cryptography>=42.0
|
|
13
|
+
Requires-Dist: requests>=2.32
|
|
14
|
+
Requires-Dist: urllib3>=2.2
|
|
15
|
+
Requires-Dist: psutil>=6.0
|
|
16
|
+
Requires-Dist: astrapi-core>=26.4.3
|
|
17
|
+
Requires-Dist: refrapt>=0.4.10
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Astrapi Mirror Control
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
|
8
|
+
|
|
9
|
+
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
|
10
|
+
|
|
11
|
+
## Add your files
|
|
12
|
+
|
|
13
|
+
* [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files
|
|
14
|
+
* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
cd existing_repo
|
|
18
|
+
git remote add origin https://gitlab.com/astrapi-os/ctl/astrapi-mirror.git
|
|
19
|
+
git branch -M main
|
|
20
|
+
git push -uf origin main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Integrate with your tools
|
|
24
|
+
|
|
25
|
+
* [Set up project integrations](https://gitlab.com/astrapi-os/ctl/astrapi-mirror/-/settings/integrations)
|
|
26
|
+
|
|
27
|
+
## Collaborate with your team
|
|
28
|
+
|
|
29
|
+
* [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/)
|
|
30
|
+
* [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
|
|
31
|
+
* [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically)
|
|
32
|
+
* [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/)
|
|
33
|
+
* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
|
|
34
|
+
|
|
35
|
+
## Test and Deploy
|
|
36
|
+
|
|
37
|
+
Use the built-in continuous integration in GitLab.
|
|
38
|
+
|
|
39
|
+
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/)
|
|
40
|
+
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/)
|
|
41
|
+
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/)
|
|
42
|
+
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/)
|
|
43
|
+
* [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/)
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
# Editing this README
|
|
48
|
+
|
|
49
|
+
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
|
50
|
+
|
|
51
|
+
## Suggestions for a good README
|
|
52
|
+
|
|
53
|
+
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
|
54
|
+
|
|
55
|
+
## Name
|
|
56
|
+
Choose a self-explaining name for your project.
|
|
57
|
+
|
|
58
|
+
## Description
|
|
59
|
+
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
|
60
|
+
|
|
61
|
+
## Badges
|
|
62
|
+
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
|
63
|
+
|
|
64
|
+
## Visuals
|
|
65
|
+
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
|
72
|
+
|
|
73
|
+
## Support
|
|
74
|
+
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
|
75
|
+
|
|
76
|
+
## Roadmap
|
|
77
|
+
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
State if you are open to contributions and what your requirements are for accepting them.
|
|
81
|
+
|
|
82
|
+
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
|
83
|
+
|
|
84
|
+
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
|
85
|
+
|
|
86
|
+
## Authors and acknowledgment
|
|
87
|
+
Show your appreciation to those who have contributed to the project.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
For open source projects, say how it is licensed.
|
|
91
|
+
|
|
92
|
+
## Project status
|
|
93
|
+
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""astrapi_mirror._app – ASGI-App-Factory.
|
|
2
|
+
|
|
3
|
+
Start:
|
|
4
|
+
uvicorn astrapi_mirror._app:app
|
|
5
|
+
astrapi-mirror --work-dir /opt/astrapi-mirror --port 5002
|
|
6
|
+
"""
|
|
7
|
+
import time
|
|
8
|
+
|
|
9
|
+
from astrapi_core.system.paths import configure as _configure_paths
|
|
10
|
+
_configure_paths("astrapi-mirror")
|
|
11
|
+
|
|
12
|
+
from fastapi import FastAPI
|
|
13
|
+
from fastapi.staticfiles import StaticFiles
|
|
14
|
+
|
|
15
|
+
from astrapi_core.ui import create as create_ui
|
|
16
|
+
from astrapi_core.ui.module_registry import load_modules
|
|
17
|
+
from astrapi_core.ui.settings_registry import init as settings_init
|
|
18
|
+
from astrapi_core.system.health import register_health
|
|
19
|
+
from astrapi_core.system.systemd import sd_notify, start_watchdog
|
|
20
|
+
from astrapi_core.system.version import get_display_name
|
|
21
|
+
from astrapi_core.modules.settings.engine import configure as configure_settings
|
|
22
|
+
from astrapi_core.modules.system.updater import configure as configure_updater
|
|
23
|
+
|
|
24
|
+
from astrapi_mirror._paths import package_dir, work_dir, db_path
|
|
25
|
+
from astrapi_mirror.api.fastapi_app import create as create_api
|
|
26
|
+
|
|
27
|
+
_START_TIME = time.time()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _db_check() -> tuple[bool, dict]:
|
|
31
|
+
from astrapi_core.system.db import _conn
|
|
32
|
+
try:
|
|
33
|
+
_conn().execute("SELECT 1").fetchone()
|
|
34
|
+
return True, {"db": True}
|
|
35
|
+
except Exception:
|
|
36
|
+
return False, {"db": False}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def create_app() -> FastAPI:
|
|
40
|
+
_pkg = package_dir()
|
|
41
|
+
configure_settings(health_fn=_db_check, app_name=get_display_name(_pkg))
|
|
42
|
+
configure_updater(_pkg)
|
|
43
|
+
|
|
44
|
+
from astrapi_core.system.db import configure as _configure_db, create_all_registered_tables
|
|
45
|
+
_configure_db(db_path())
|
|
46
|
+
create_all_registered_tables()
|
|
47
|
+
|
|
48
|
+
settings_init(work_dir())
|
|
49
|
+
|
|
50
|
+
modules, _ = load_modules(_pkg)
|
|
51
|
+
api = create_api(modules=modules)
|
|
52
|
+
|
|
53
|
+
import astrapi_core.ui
|
|
54
|
+
from pathlib import Path
|
|
55
|
+
core_static = Path(astrapi_core.ui.__file__).parent / "static"
|
|
56
|
+
api.mount("/static", StaticFiles(directory=str(core_static)), name="static")
|
|
57
|
+
|
|
58
|
+
create_ui(api, app_root=_pkg, modules=modules)
|
|
59
|
+
|
|
60
|
+
register_health(api, check_fn=_db_check, start_time=_START_TIME)
|
|
61
|
+
start_watchdog(check_fn=lambda: _db_check()[0])
|
|
62
|
+
sd_notify("READY=1")
|
|
63
|
+
return api
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
app = create_app()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""astrapi_mirror._cli – Console-Script-Einstiegspunkt.
|
|
2
|
+
|
|
3
|
+
Start:
|
|
4
|
+
astrapi-mirror --work-dir /opt/astrapi-mirror --port 5002
|
|
5
|
+
astrapi-mirror --work-dir /opt/astrapi-mirror --port 5002 --debug
|
|
6
|
+
"""
|
|
7
|
+
from astrapi_core.system.paths import run_app
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main() -> None:
|
|
11
|
+
run_app("astrapi_mirror._app:app", "astrapi-mirror", default_port=5002)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
main()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# astrapi_mirror/_paths.py
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from astrapi_core.system.paths import work_dir, db_path, log_dir # noqa: F401 – re-export
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def package_dir() -> Path:
|
|
8
|
+
"""Pfad zum installierten Package – für app.yaml, Templates, Modul-YAMLs."""
|
|
9
|
+
return Path(__file__).resolve().parent
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def mirror_path() -> Path:
|
|
13
|
+
"""Wurzelverzeichnis des Debian-Spiegels (aus Settings oder Standard)."""
|
|
14
|
+
from astrapi_core.ui.settings_registry import get_module
|
|
15
|
+
raw = get_module("debian", "mirror_path", default="")
|
|
16
|
+
return Path(raw).resolve() if raw else work_dir().resolve() / "mirror"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def skel_path() -> Path:
|
|
20
|
+
from astrapi_core.ui.settings_registry import get_module
|
|
21
|
+
raw = get_module("debian", "skel_path", default="")
|
|
22
|
+
return Path(raw).resolve() if raw else work_dir().resolve() / "skel"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def var_path() -> Path:
|
|
26
|
+
from astrapi_core.ui.settings_registry import get_module
|
|
27
|
+
raw = get_module("debian", "var_path", default="")
|
|
28
|
+
return Path(raw).resolve() if raw else work_dir().resolve() / "var"
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""astrapi_mirror.api.fastapi_app – FastAPI-Factory."""
|
|
2
|
+
from fastapi import FastAPI
|
|
3
|
+
from astrapi_core.system.version import get_app_version
|
|
4
|
+
|
|
5
|
+
from astrapi_mirror._paths import package_dir
|
|
6
|
+
|
|
7
|
+
APP_ROOT = package_dir()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def create(modules: list | None = None) -> FastAPI:
|
|
11
|
+
_version = get_app_version(APP_ROOT, default="1.0.0")
|
|
12
|
+
app = FastAPI(
|
|
13
|
+
title="Mirror Control API",
|
|
14
|
+
version=_version,
|
|
15
|
+
docs_url="/api/docs",
|
|
16
|
+
redoc_url="/api/redoc",
|
|
17
|
+
openapi_url="/api/openapi.json",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from astrapi_core.ui.module_registry import load_modules, register_fastapi_modules
|
|
21
|
+
if modules is None:
|
|
22
|
+
modules, _ = load_modules(APP_ROOT)
|
|
23
|
+
register_fastapi_modules(app, modules)
|
|
24
|
+
|
|
25
|
+
from astrapi_mirror.api.repo import router as repo_router
|
|
26
|
+
app.include_router(repo_router)
|
|
27
|
+
|
|
28
|
+
return app
|