logo
0
0
Login

ustcmirror-images

Build Status

Table Of Content

Introduction

These images are designed for mirroring remote directories/repositories in a consistent and portable way. They are used by ustcmirror (yuki).

Quick Start

docker run --rm \ -e LOG_ROTATE_CYCLE='5' \ -e RSYNC_HOST='rsync.alpinelinux.org' \ -e RSYNC_PATH='alpine/' \ -e RSYNC_MAXDELETE='10000' \ -v /var/repos/alpine:/data \ -v /var/sync-logs/alpine:/log \ ustcmirror/rsync:latest

Configuration

Volumes

  • /data: The mount point of the repository on the host. You can refer to it as environment variable TO in your program.
  • /log: The mount point of the host directory that save logs. You can refer to it as environment variable LOGDIR in your program.

Common Configuration Parameters(AKA environment variables)

Apart from TO and LOGDIR, these environment variables are common to all images.

ParameterDescription
DEBUGSet this to true to enable debugging.
BIND_ADDRESSSet the local ip to be bound. Require --network=host. (Some programs don't support this parameter)
OWNERSet the uid and gid of the process so that the downloaded files wont get messed up. Defaults to 0:0 (aka root:root).
LOG_ROTATE_CYCLESpecify how many cycle versions of the logfile to be saved. Set this to 0 will disable log file. Defaults to 0 (NO LOG FILE).
REPOName of the repository. Required in archvsync.
RETRYTimes to re-sync if the process exits abnormally. Defaults to 0.

aptsync

aptsync aptsync

ParameterDescription
APTSYNC_URLSets the url of upstream.
APTSYNC_NTHREADSDefaults to 20.
APTSYNC_UNLINKSet this to 1 to remove unneeded files automatically. Defaults to 0.
APTSYNC_CREATE_DIRSet this to true to create same directory tree as upstream URL. Defaults to true.
APTSYNC_DISTSVarious distros can be specified in the format <release> [...]|<componenet> [...]|<arch> [...][:...].

Notes: The following mirror.list:

deb-i386 https://apt.dockerproject.org/repo debian-jessie main deb-amd64 https://apt.dockerproject.org/repo debian-jessie main deb-armhf https://apt.dockerproject.org/repo raspbian-jessie main testing

is equivalent to the following parameters:

APTSYNC_URL='https://apt.dockerproject.org/repo' APTSYNC_DISTS='debian-jessie|main|i386 amd64:raspbian-jessie|main testing|armhf'

apt-sync

apt-sync apt-sync

ParameterDescription
APTSYNC_URLSets the url of upstream.
APTSYNC_UNLINKSet this to 1 to remove unneeded files automatically. Defaults to 0.
APTSYNC_DISTSVarious distros can be specified in the format <release> [...]|<componenet> [...]|<arch> [...]|<download_dir> [...][:...].

It is almost the same as aptsync. Except that APTSYNC_DISTS accepts 4 parameters (rather than 3) for every item.

Consider use apt-sync when the upstream replaces packages in-place, as aptsync will simply ignore if there're any changes in existed packages.

archvsync

archvsync archvsync

A.K.A. ftpsync

archvsync respects the env vars used in ftpsync

ParameterDescription
IGNORE_LOCKPurge lockfiles at first. Defaults to false.

crates-io-index

crates-io-index crates-io-index

A dedicated script to sync https://github.com/rust-lang/crates.io-index.

ParameterDescription
CRATES_PROXYThe URL that crates will be redirected to. Defaults to https://crates-io.proxy.ustclug.org/api/v1/crates
CRATES_GITMSGThe commit message of config.json. Defaults to Redirect to USTC Mirrors
CRATES_GITMAILuser.email when committing config.json. Defaults to lug AT ustc.edu.cn
CRATES_GITNAMEuser.name when committing config.json. Defaults to mirror
GEOMETRIC_REPACKUse geometric repacking to speed up repacking (requires git >= 2.34 on server). See GitHub Blog: Scaling monorepo maintenance. Defaults to false.

debian-cd

debian-cd debian-cd

debian-cd accepts the same parameters specified in debian-cd-mirror.conf

ParameterDescription
IGNORE_LOCKPurge lockfiles at first. Defaults to false.

docker-ce

docker-ce docker-ce

docker-ce accepts following parameters:

ParameterDescription
SYNC_WORKERSDownload workers. Defaults to 1.
SYNC_USER_AGENTThe user agent of docker-ce syncing program. Defaults to Docker-ce Syncing Tool/1.0.
SYNC_EXTRAExtra parameters. --fast-skip can be set to skip size & timestamp check.

fedora

fedora fedora

fedora-quick-mirror

See dist conf for parameters meaning.

ParameterDescription
MODULEfedora module to be mirrored, e.g. fedora-enchilada,fedora-epel
FILTEREXPA regular expression used to filter the file lists. It must be quoted (or very carefully escaped)
VERBOSElog level(0-8), default is 7
CHECKIN_SITEsee in mirrormanager
CHECKIN_PASSWORDsee in mirrormanager
CHECKIN_HOSTsee in mirrormanager

Note: This image is not in use now, as quick-fedora-mirror has some mysterious bugs when being used.

flatpak

flatpak flatpak

A simple sync script to sync necessary metadata for flatpak. This DOES NOT SYNC ANY BLOB FILES.

ParameterDescription
USER_AGENTuser agent used

freebsd-pkg

freebsd-pkg freebsd-pkg

ParameterDescription
FBSD_PKG_UPSTREAMSet the URL of upstream. Defaults to http://pkg.freebsd.org.
FBSD_PKG_JOBSDefaults to 1.
FBSD_PKG_EXCLUDEExclude ABI by regular expression. Defaults to ^FreeBSD:[89]:.

freebsd-ports

freebsd-ports freebsd-ports

Notice: BIND_ADDRESS is only added for curl in freebsd-ports. Make sure that github.com is accessible under default network settings.

ParameterDescription
FBSD_PORTS_INDEX_UPSTREAMSet the URL of upstream git index. Defaults to https://github.com/freebsd/freebsd-ports.git.
FBSD_PORTS_DISTFILES_UPSTREAMSet the URL of upstream distfiles. Defaults to http://distcache.freebsd.org/ports-distfiles.
FBSD_PORTS_JOBSDefaults to 1.

ghcup

ghcup ghcup

ghcup does not have outstanding configuration options.

github-release

github-release github-release

ParameterDescription
UPSTREAM_URLGitHub API base URL. Defaults to https://api.github.com/repos/.
WORKERSNumber of concurrent downloading jobs. Defaults to 8.
FAST_SKIPNot verify size and timestamp of existing files. Set it to any true string to enable the skipping.
REPOSYAML-format repo list config. See below for details.

To specified the repo list to sync, you can:

  • Read-only bind mount a YAML file into the container at /repos.yaml. See the example.
  • Pass the YAML-format repo list string as REPOS env.

gitsync

gitsync gitsync

ParameterDescription
GITSYNC_URLSets the url of upstream.
GITSYNC_BRANCHDefaults to master:master.
GITSYNC_REMOTEDefaults to origin.
GITSYNC_BITMAPEnable bitmap index. Defaults to false.
GITSYNC_MIRRORA shortcut to sync all branches and tags as if GITSYNC_BRANCH='+refs/heads/*:refs/heads/*'. GITSYNC_BRANCH is ignored when it is set.
GITSYNC_CHECKOUTCheckout instead of bare cloning. Defaults to false.
GITSYNC_TREELESSUse treeless clone to save disk space. Defaults to false.
GITSYNC_GEOMETRICUse geometric repacking to speed up repacking. Requires GITSYNC_BITMAP. Defaults to false.

google-repo

google-repo google-repo

A script for syncing projects (especially AOSP) using Google's repo tool.

ParameterDescription
UPSTREAMUpstream URL. Defaults to https://android.googlesource.com/mirror/manifest
GEOMETRIC_REPACKUse geometric repacking to speed up repacking (requires git >= 2.34 on server). See GitHub Blog: Scaling monorepo maintenance. Defaults to false.

gsutil-rsync

gsutil-rsync gsutil-rsync

ParameterDescription
GS_URLSets the url of upstream. e.g. gs://golang/.
GS_EXCLUDEFiles to be excluded. Defaults to empty.

hackage

hackage hackage

ParameterDescription
HACKAGE_BASE_URLSet the URL of upstream. Defaults to https://hackage.haskell.org

homebrew-bottles

homebrew-bottles homebrew-bottles

ParameterDescription
HOMEBREW_BOTTLES_JOBSParallel jobs. Defaults to 1
BREW_SH_BIND_ADDRESSBind address for accessing formulae.brew.sh API

julia-storage

julia-storage julia-storage

A new solution to sync Julia general registry (using StorageMirrorServer.jl). No parameters needed.

lftpsync

lftpsync lftpsync

ParameterDescription
LFTPSYNC_HOSTThe hostname of the remote server.
LFTPSYNC_PATHThe destination path on the remote server.
LFTPSYNC_EXCLUDEFiles to be excluded. Defaults to -X .~tmp~/.
LFTPSYNC_JOBSDefaults to $(getconf _NPROCESSORS_ONLN).
LFTPSYNC_MIRROR_ARGSParameters for mirror command. Defaults to --verbose --use-cache -aec
LFTPSYNC_EXTRA_COMMANDSExtra commands for lftp (ie. set sftp:connect-program "ssh -axi <keyfile>";). Will be executed before opening connection

misc

misc misc

ParameterDescription
DOWNLOAD_LINKSFiles to be downloaded by wget. Format is filename.sh http://example.com/filename.sh seperates by newlines

Download seperate, small files inconvenient for other sync containers.

Example of DOWNLOAD_LINKS:

brew-install.sh https://github.com/Homebrew/install/raw/HEAD/install.sh rustup-install.sh https://sh.rustup.rs/

nix-channels

nix-channels nix-channels

ParameterDescription
NIX_MIRROR_UPSTREAMMain page of Nix channels. No trailing slash. Defaults to https://nixos.org/channels
NIX_MIRROR_BASE_URLThe root URL this mirror will be served at. No trailing slash. Defaults to https://mirrors.ustc.edu.cn/nix-channels
NIX_MIRROR_PATH_BATCHNumber of paths to pass to nix each time, to avoid E2BIG. Defaults to 8192, which is about 1/4 of the 2M ARG_MAX.
NIX_MIRROR_THREADSNumber of threads to use to download in parallel. Defaults to 10
NIX_MIRROR_RETAIN_DAYSDays to consider old versions as reachable. Defaults to 30. (The newest version of a release is always reachable)
NIX_MIRROR_DELETE_OLDWhether to actually delete files in garbage collection. Set to 1 to delete and 0 to not delete. Defaults to 1
NIX_MIRROR_RELEASES_ONLYDon't download binary blobs. Defaults to 0 (false)

pypi

pypi pypi

Sync PyPI with official mirror client bandersnatch. Note that this image is not actively maintained. It's suggested to use shadowmire instead.

ParameterDescription
BANDERSNATCH_WORKERSDefaults to 3.
BANDERSNATCH_STOP_ON_ERRORDefaults to true.
BANDERSNATCH_TIMEOUTDefaults to 20.

rclone

rclone rclone

ParameterDescription
RCLONE_PATHThe destination path. Note that the rclone remote has been hard-coded as remote.
RCLONE_EXTRAExtra options passed to rclone sync. Defaults to empty.
RCLONE_CHECKERSSet the number of checkers. Defaults to $(getconf _NPROCESSORS_ONLN).
RCLONE_TRANSFERSSet the number of file transfers. Defaults to $(getconf _NPROCESSORS_ONLN).
RCLONE_CONFIG_REMOTE_*Set config file options.

ref:

rsync

rsync rsync

ParameterDescription
RSYNC_HOSTThe hostname of the remote server.
RSYNC_USER(Optional) No defaults.
RSYNC_PASSWORD(Optional) No defaults.
RSYNC_PATHThe destination path on the remote server.
RSYNC_BWBandwidth limit. Defaults to 0.
RSYNC_EXTRAExtra options. Defaults to empty.
RSYNC_EXCLUDEFiles to be excluded. Defaults to --exclude .~tmp~/.
RSYNC_FILTERFilter rules. More convenient for larger lists.
RSYNC_BLKSIZEDefaults to 8192.
RSYNC_TIMEOUTDefaults to 14400.
RSYNC_SPARSEDefaults to true.
RSYNC_DELAY_UPDATESDefaults to true.
RSYNC_DELETE_DELAYDefaults to true. Use --delete-delay rather than --delete
RSYNC_DELETE_EXCLUDEDDefaults to true. Use --delete-excluded to delete excluded files.
RSYNC_MAXDELETEMaximum number of files that can be removed. Defaults to 4000.
RSYNC_RSHSpecify the remote shell, e.g. ssh -i /path/to/key.

rubygems

rubygems rubygems

ParameterDescription
UPSTREAMDefaults to http://rubygems.org.

shadowmire

shadowmire shadowmire

Shadowmire syncs PyPI (or plain HTTP(S) PyPI mirrors using Shadowmire) with a lightweight and easy approach.

ParameterDescription
UPSTREAMDefaults to https://pypi.org.
INDEX_ONLYDon't download package blobs. Defaults to false.
EXCLUDEA list of --exclude and --prerelease-exclude.
USE_PYPI_INDEXStill use PyPI package listing when UPSTREAM is not https://pypi.org. Defaults to false.

stackage

stackage stackage

Stackage doesn't need to specify upstream.

tsumugu

tsumugu tsumugu

An alternative HTTP(S) syncing tool, replacing rclone and lftp in some cases. See usage.

ParameterDescription
UPSTREAMSets the url of upstream.
TSUMUGU_MAXDELETEMaximum number of files that can be removed. Defaults to 1000.
TSUMUGU_TIMEZONEFILEThe file URL for guessing remote server timezone.
TSUMUGU_EXCLUDEFiles to be excluded. Value example: "--exclude '^temp'"
TSUMUGU_USERAGENTThe user agent of tsumugu syncing program. Defaults to Tsumugu Syncing Tool/$(tsumugu_version).
TSUMUGU_PARSERHTML parser used to parse index page. Defaults to nginx.
TSUMUGU_THREADSNumber of threads to use to download in parallel. Defaults to 2.
TSUMUGU_EXTRAExtra options. Defaults to empty.

winget-source

winget-source winget-source

A handy tool to sync pre-indexed Windows Package Manager (aka. WinGet) sources.

ParameterDescription
WINGET_FORCE_SYNCForce syncs everything against the upstream. Defaults to false.
WINGET_REPO_URLSets the URL of upstream. Defaults to https://cdn.winget.microsoft.com/cache
WINGET_REPO_JOBSParallel jobs. Defaults to 8.

yukina

yukina yukina

yukina analyses given nginx log, and maintains binary blobs (which does not modify once exist) state under given size limit. Usually this shall be used with another sync container that only downloads index files.

Note that you shall bind necessary nginx log to /nginx-log/ when syncing.

ParameterDescription
UPSTREAMSets the url of upstream.
YUKINA_SIZE_LIMITThe size limit of binary blobs. Defaults to 512g.
YUKINA_FILTERAccepts regex to filter out binary blobs. Defaults to empty.
YUKINA_EXTRAExtra options. Defaults to empty.
YUKINA_REPOThe repository name. Defaults to $REPO.

yum-sync

yum-sync yum-sync

ParameterDescription
YUMSYNC_URLSets the url of upstream.
YUMSYNC_DISTSVarious distros can be specified in the format <release> [...]|<component> [...]|<arch> [...]|<reponame>|<download_dir> [:...].
YUMSYNC_DOWNLOAD_REPODATAWhether to download repodata files instead of generating them by createrepo

yum-sync tries to imitate the parameters of aptsync, and it supports the following substitution rule for YUMSYNC_URL and <reponame> & <download_dir> in YUMSYNC_DISTS:

  • @{arch}: Architecture (x86_64, armhf, ...)
  • @{os_ver}: OS version (6-8, ...)
  • @{comp}: The <component> in YUMSYNC_DISTS

yum-sync.py is modified to get the same directory structure as upstream when syncing. And <reponame> should be named the same as the directory containing repodata dir.

Notes:

The following repo configuration:

baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el$releasever-$basearch

translates to:

YUMSYNC_URL='https://packages.cloud.google.com/yum/repos/kubernetes-el@{os_ver}-@{arch}' YUMSYNC_DISTS='6-7|kubernetes|x86_64,aarch64,armhfp,ppc64le,s390x|kubernetes-el@{os_ver}-@{arch}|/yum/repos/kubernetes-el@{os_ver}-@{arch}'

And the following:

[mysql80-community] name=MySQL 8.0 Community Server baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

translates to:

YUMSYNC_URL='https://repo.mysql.com/yum/@{comp}/el/@{os_ver}/@{arch}/' YUMSYNC_DISTS='6-8|mysql-8.0-community,mysql-5.7-community|aarch64,i386,x86_64|@{arch}|/yum/@{comp}/el/@{os_ver}/@{arch}/'

License

Specially, contents of folder apt-sync, yum-sync, github-release, docker-ce and the generated container image from them are under GPLv3 license, as it uses code from https://github.com/tuna/tunasync-scripts.

Other contents are under MIT license.

Contributing

See CONTRIBUTING.md.

About

中科大镜像源

710.00 KiB
0 forks0 stars6 branches0 TagREADMEMIT license
Language
License27.4%
Shell23.1%
Python18.4%
Perl9.5%
Others21.6%