Skip to content

Adding a new repo

Alex Chi edited this page Mar 8, 2021 · 6 revisions

In theory, adding a new repo begins with users submitting a mirror request in mirror-request. It is expected that our community users could help us:

  1. Check if we are allowed to create a mirror
  2. Provide some instructions on mirroring
  3. Help testing the mirror
  4. Add docs for SJTUG mirror

But for most of the time, our users just want to download faster and could not provide technical help. Anyway, mirror request is always welcomed, and assistance are appreciated.

For mirror maintainers, we should evaluate:

  1. How to mirror
  2. How much space does it take
  3. Double check are we allowed to mirror
    • Does the upstream provide an official way to mirror
    • Does the upstream have existing mirrors

If a mirror request is accepted, we could begin to add this repo to our mirror servers.

Rsync or locally-served repos

Add an entry in config.<site>.yaml, and send a PR.

If the PR is accepted, don't merge it. Trigger first sync on our mirror server. If it succeeds, we can merge the PR.

To trigger sync, get into the lug container and start the sync process.

docker-compose exec lug bash
export LUG_path=xxxx
export LUG_source=xxx
export LUG_xxxx=xxx
/worker-script/rsync.sh

Git repos

Ask admin role for https://git.sjtu.edu.cn/sjtug, and create a repo for the mirror. Note that:

  1. Don't create an empty repo. Set up the repo from existing URL. GitLab has a 100M push limit, which makes it impossible to mirror pushing a repo.
  2. Disable devops functionalities and disable master/main branch protection.
  3. We have a total of 5G limit among all our repos on git.sjtu.edu.cn

Then, add an entry in config.<site>.yaml, and send a PR. git repos must have a git/ prefix.

mirror-intel repos

Update mirror-intel (and mirror-clone if possible), release new version, and update version in docker-compose.yml. Then, add an entry in config.<site>.yaml.

Make repo online

If an upstream requires access to rsync, don't forget to edit rsyncd configurations.

On our mirror server, we should first rebuild all images (if there is any change).

make up

Then, we need to update configuration of lug and caddy.

docker-compose restart lug         # if lug config is modified
docker-compose restart rsyncd      # if rsyncd config is modified
docker-compose restart -t 0 caddy  # if Caddyfile is modified

(It seems that caddy reload is broken, so we have to restart caddy instead of reload config with zero downtime.)