Configuration
Mirror.py Configuration Guide
This document describes how to write config.json for each sync method, and
ends with an AI Assistant Protocol you can hand to an AI so it collects the
right information and emits a ready-to-use config block on its own.
config.jsonis read-only at runtime. Onlymirror setupever writes it. Runtime state (status, error counts, timestamps) lives instat.json, not here.
1. Top-level structure
{
"mirrorname": "KAIST FTP",
"hostname": "ftp.kaist.ac.kr",
"settings": { ... },
"packages": {
"<package-id>": { ... },
"<package-id>": { ... }
}
}
Key |
Type |
Description |
|---|---|---|
|
string |
Human-readable mirror name (shown in the web UI). |
|
string |
This mirror’s own FQDN. Used as the ftpsync trace host. |
|
object |
Global daemon settings (see §2). |
|
object |
Map of |
2. Global settings
"settings": {
"logfolder": "/mirror/logs",
"webroot": "/var/www/mirror",
"statusfile": "/var/www/mirror/status.json",
"statfile": "/var/lib/mirror/stat.json",
"uid": 0,
"gid": 0,
"localtimezone": "Asia/Seoul",
"errorcontinuetime": 60,
"max_runtime": "PT12H",
"maintainer": { "name": "Roul", "email": "roul@ftp.kaist.ac.kr" },
"logger": { ... },
"ftpsync": { ... },
"plugins": {},
"socket": { "mode": "0770" }
}
Key |
Type |
Notes |
|---|---|---|
|
path |
Base directory for daemon logs. |
|
path |
Web root for the status UI. |
|
path |
Web status JSON output path. |
|
path |
Persistent package state ( |
|
int |
UID/GID that sync subprocesses drop to. |
|
string |
IANA timezone name. |
|
int |
Seconds to wait before retrying after an error. |
|
string |
ISO 8601 duration; a sync running longer is killed. Below |
|
object |
|
|
object |
Log levels, formats, and file rotation (see |
|
object |
Global ftpsync defaults (see §4.2). |
|
object |
Enable-only plugin map: |
|
object |
Master control socket ownership/permissions (see §2.2). Optional. |
The logger block is rarely changed; copy it verbatim from config-example.json.
2.1 Global settings.ftpsync
Defaults applied to every ftpsync package; per-package options override
each key individually.
"ftpsync": {
"maintainer": "KAIST FTP Maintainers <ftp@ftp.kaist.ac.kr>",
"sponsor": "KAIST <https://ftp.kaist.ac.kr> SPARCS <https://sparcs.org>",
"country": "KR",
"location": "Daejeon",
"throughput": "10Gb",
"include": "",
"exclude": ""
}
2.2 Global settings.socket
Ownership and permissions of the master control socket (master.sock), bound
once at daemon startup. The whole block is optional.
"socket": {
"uid": 0,
"gid": 0,
"mode": "0770"
}
Key |
Type |
Default |
Notes |
|---|---|---|---|
|
int |
unset |
|
|
int |
unset |
|
|
string |
|
Octal string (e.g. |
Omit the block for the secure default: mode
0600, nochown. Restart-only. The socket is bound at startup and never re-created on reload, so changingsettings.sockettakes effect only after a daemon restart. A live reload keeps the running value and emits the warningsocket change requires daemon restart (kept current value).
3. Package definition (common fields)
Every package — regardless of sync method — shares this shape:
"<package-id>": {
"name": "Display Name",
"id": "<package-id>",
"href": "/path-on-web",
"synctype": "rsync",
"syncrate": "PT1H",
"link": [
{ "rel": "HOME", "href": "https://example.org/" }
],
"settings": {
"hidden": false,
"src": "rsync://upstream/module",
"dst": "/srv/ftp/example",
"options": { ... }
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
Display name shown in the UI (this is the visible label). |
|
string |
Internal identifier. Must equal the map key. Must not start with |
|
string |
Web path for this mirror. |
|
string |
One of: |
|
string |
Sync interval (see §3.1). |
|
array |
List of |
|
bool |
Hide the package from the web UI when |
|
string |
Upstream source. Format depends on |
|
string |
Local destination directory. |
|
object |
Method-specific options (see §4). |
3.1 syncrate values
Value |
Meaning |
|---|---|
ISO 8601 duration |
Interval between syncs. e.g. |
|
No timed schedule; sync is triggered externally (push-based). Common for Debian ftpsync. |
|
Disabled / never auto-syncs (used by |
4. Per-method settings
Each method only reads the keys listed below. Unknown keys in options are ignored.
4.1 rsync
Incremental rsync with an optional FFTS (fast file-time-list) pre-check that skips the full sync when the upstream timestamp file is unchanged.
src: rsync URL without trailing slash, e.g.rsync://ftp.gwdg.de/pub/linux/archlinux(the module appends/automatically).dst: local directory.
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Enable the FFTS dry-run pre-check before the full sync. |
|
string |
|
Upstream timestamp file checked by FFTS (e.g. |
|
string |
|
rsync username (sets |
|
string |
|
rsync password (sets |
|
string |
|
Flag characters to add to the default flag string. Each char must be in the whitelist |
|
string |
|
Flag characters to remove from the default flag string. No |
|
list[string] |
|
Extra |
Note: the rsync module reads
user/password. A key namedusernameis not read.Flag string: the default is
-vrltDH(since 1.3; previously-vrltDSH, i.e.-S/sparse handling was dropped;-pwas dropped earlier in 1.2, so upstream file modes are no longer mirrored by default).option_include/option_excludeadjust this string —option_includeis applied first (appends missing chars), thenoption_excluderemoves chars. To restore permission mirroring, set"option_include": "p".
"archlinux": {
"name": "ArchLinux",
"id": "archlinux",
"href": "/ArchLinux",
"synctype": "rsync",
"syncrate": "PT1H",
"link": [ { "rel": "HOME", "href": "https://archlinux.org/" } ],
"settings": {
"hidden": false,
"src": "rsync://ftp.gwdg.de/pub/linux/archlinux",
"dst": "/srv/ftp/ArchLinux",
"options": { "ffts": true, "fftsfile": "lastupdate" }
}
}
4.2 ftpsync
Debian archvsync-based mirroring. Builds an ftpsync.conf from the package and
the global settings.ftpsync defaults.
src: either a full rsync URL (rsync://host/module) or a bare host combined with thepathoption.dst: local directory (becomesTO=).syncrate: usually"PUSH"for Debian.
Option |
Type |
Description |
|---|---|---|
|
string |
rsync module path. Required when |
|
bool |
Sets |
|
string |
|
|
string |
|
|
string |
|
|
string |
Overrides global |
|
string |
Overrides global |
|
string |
Overrides global |
|
string |
Overrides global |
|
string |
Overrides global |
|
string |
|
|
string |
|
|
path |
Override ftpsync log directory (defaults to global |
"debian": {
"name": "Debian",
"id": "debian",
"href": "/debian",
"synctype": "ftpsync",
"syncrate": "PUSH",
"link": [ { "rel": "HOME", "href": "http://debian.org" } ],
"settings": {
"hidden": false,
"src": "rsync://syncproxy2.wna.debian.org/debian",
"dst": "/srv/ftp/debian",
"options": { "hub": false }
}
}
4.3 lftp
Anonymous FTP mirroring via lftp. src must be an ftp:// URL with no
credentials, query, or fragment (validated strictly).
Option |
Type |
Default |
Description |
|---|---|---|---|
|
string |
unset |
Only |
|
bool |
|
Pass |
|
list[string] |
|
|
|
list[string] |
`[”.(mirror |
notar)”, “lost+found”]` |
|
list[string] |
|
|
|
int (1–100) |
|
|
|
int (1–3600) |
|
|
"example-ftp": {
"name": "Example",
"id": "example-ftp",
"href": "/example",
"synctype": "lftp",
"syncrate": "PT6H",
"link": [],
"settings": {
"hidden": false,
"src": "ftp://ftp.example.org/pub/example",
"dst": "/srv/ftp/example",
"options": { "max_retries": 5, "net_timeout": 120 }
}
}
4.4 ubuntu
Two-stage rsync (metadata-last) tuned for Ubuntu archives, writing a trace file on success.
src: rsync URL.dst: local directory.
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Write |
|
list[string] |
|
Extra rsync flags. |
|
list[string] |
|
Patterns excluded in stage 1. |
|
string |
|
rsync username. |
|
string |
|
rsync password. |
"ubuntu": {
"name": "Ubuntu", "id": "ubuntu", "href": "/ubuntu",
"synctype": "ubuntu", "syncrate": "PT6H",
"link": [ { "rel": "HOME", "href": "http://www.ubuntu.com" } ],
"settings": {
"hidden": false,
"src": "rsync://archive.ubuntu.com/ubuntu",
"dst": "/srv/ftp/ubuntu",
"options": {}
}
}
4.5 jigdo
Three-phase Debian CD mirror: template rsync, local ISO regeneration via
jigdo-mirror, and a final size-only rsync.
src: rsync URL.dst: local directory.Required options:
jigdo_file,debian_mirror.
Option |
Type |
Default |
Description |
|---|---|---|---|
|
string |
required |
rsync URL/path to the jigdo-file index. |
|
string |
required |
Debian package mirror URL used to assemble ISOs. |
|
int |
|
rsync |
|
bool |
|
Write trace file on success. |
|
string |
|
Relative subdir under |
|
list[string] |
|
Phase 1 exclude patterns. |
|
list[string] |
|
Phase 3 include patterns. |
|
list[string] |
|
Extra rsync flags for both rsync phases. |
|
string |
|
rsync binary path/name. |
|
string |
|
jigdo-mirror binary path/name. |
|
string |
mirror hostname |
Override hostname used in exclude patterns. |
|
string |
|
rsync credentials. |
4.6 bandersnatch
PyPI mirroring. The module simply runs bandersnatch mirror; the actual mirror
behavior is driven by bandersnatch’s own config file, not by settings
here. src/dst/options are not consumed by this method (still provide
src/dst for documentation/UI consistency).
Option |
Type |
Description |
|---|---|---|
— |
— |
No options are read. |
4.7 local
This server is the authoritative master for the data; there is no upstream sync.
The method only verifies dst exists and marks the package ACTIVE.
src: ignored (use"").dst: must already exist on disk.syncrate: typically"".
Option |
Type |
Description |
|---|---|---|
— |
— |
No options are read. |
5. AI Assistant Protocol
Paste this section (or the whole document) to an AI assistant. It tells the assistant exactly what to ask for and how to produce a config block.
Role: You generate a mirror.py package config block from information the
user provides. Follow these steps:
Identify the sync method. Map the user’s intent to one
synctype:rsync URL + “skip when unchanged” / timestamp file ->
rsync(setffts/fftsfile).Debian, push-based ->
ftpsync(syncrate: "PUSH").Ubuntu archive ->
ubuntu.Debian CD/ISO with jigdo ->
jigdo.Anonymous
ftp://source ->lftp.PyPI ->
bandersnatch.This host is the origin / no upstream ->
local.
Collect the required inputs for that method:
Always: display
name,id(kebab-case, equals the map key),href,src,dst,syncrate, and any referencelinks.rsync: whether FFTS is used and the
fftsfilename; credentials if any.ftpsync: rsync URL or (host +
path);hub; anyINFO_*overrides.lftp: confirm
srcis anftp://URL; retry/timeout/excludes if any.ubuntu: trace on/off; extra excludes if any.
jigdo:
jigdo_fileanddebian_mirror(both required).bandersnatch: note the separate bandersnatch config file is required.
local: confirm
dstexists;srcempty.
Apply naming conventions exactly as the user states them. If the user specifies a display spelling (e.g. “represent it as ArchLinux”), use that spelling for
name,href, anddstas appropriate, while keepingidin kebab-case.Pick a sane
syncrateif the user did not give one:PT1Hfor most rsync/lftp mirrors,"PUSH"for Debian ftpsync,""forlocal. State the assumption.Validate before output:
idequals the map key, does not start with_, and is not a reserved name (get,items,keys,values,to_dict).srcstrips any trailing slash for rsync.Only options listed for the chosen method appear in
options.Use
user/password(notusername) for credentials.
Output the package block as a JSON snippet ready to paste under
"packages". If the user is creating a full standalone file, wrap it with the top-level structure and copy thesettingsblock from an existing config. After the JSON, briefly list any assumptions you made.Do not invent options. If the user asks for behavior no option supports, say so instead of fabricating a key.
Minimal input the AI should ask for if missing: sync method (or enough to
infer it), src, dst, display name, and desired syncrate.