Git Product home page Git Product logo

linux-repository-mirror's Introduction

linux-repository-mirror

Docker Build

Run linux repository mirrors with docker/kubernetes

  • This implementation is intended to be used in a small organization and cannot be deployed as a public mirror due to the performance reasons.
  • Furthermore, because current configuration has been adjusted for @yamaoka-kitaguchi-lab local environment, if you want to deploy this elsewhere, you'll need to read through all the files and modify them accordingly.

How to use: configure your linux to fetch from the local mirror

As of August 10th, 2020, following seven linux mirrors are available - see Mirroring details for further information.

ArchLinux

Add the below lines to the beginning of your /etc/pacman.d/mirrorlist and then run pacman -Syy for force syncing.

## Tokyo Tech
Server = http://pacman.mirror.intra.net.ict.e.titech.ac.jp/archlinux/$repo/os/$arch

Manjaro

Add the below lines to the beginning of your /etc/pacman.d/mirrorlist and then run pacman -Syy for force syncing.

## Tokyo Tech
Server = http://pacman.mirror.intra.net.ict.e.titech.ac.jp/manjaro/$repo/os/$arch

Ubuntu

For both server and desktop editions of AMD64 and i386 architecture. Only available in 20.04 LTS (focal) and 18.04 LTS (bionic).

Use the following command to replace the repository URLs from Japanese official archive to the local mirror.

% sed -i.bak -e "s%jp.archive.ubuntu.com%apt.mirror.intra.net.ict.e.titech.ac.jp%g" /etc/apt/sources.list

Debian

Testing and stable release of 11 (bullseye), 10 (buster), and 9 (strech) are available.

Use the following command to replace the repository URLs from Japanese official archive to the local mirror.

% sed -i.bak -e "s%ftp.jp.debian.org%apt.mirror.intra.net.ict.e.titech.ac.jp%g" /etc/apt/sources.list

Raspbian

Use the following command to replace the repository URLs from the official archive to the local mirror.

% sed -i.bak -e "s%raspbian.raspberrypi.org%apt.mirror.intra.net.ict.e.titech.ac.jp%g" /etc/apt/sources.list

Cumulus

This repository is for lab's external router FS N5850-48S6Q and is not intended to be used on any other machine.

Use the following command to replace the repository URLs from the official archive to the local mirror - also refer to the official documentation as appropriate.

% sed -i.bak -e "s%repo3.cumulusnetworks.com/repo%apt.mirror.intra.net.ict.e.titech.ac.jp/cumulus%g" /etc/apt/sources.list

Gentoo

Check and follow the instructions of official handbook.

How to deploy

There are two ways to deploy; both ways are very simple and easy, but if you're not familiar with kubernetes, deploying with docker-compose is recommended.

NOTE: You need at least 2.5TB of free disk space to deploy all mirrors. The initial synchronization may take a few days because of the bandwidth limitation on upstream servers.

Deploy using docker-compose with systemd

If you don't have docker-compose (1.26.0 or higher), get it first. All commands must be executed as root (use sudo).

% make install-compose

Then deploy mirrors on your system with:

% make install

It's done. All mirrors are automatically synchronized and kept up to date by systemd/Timers. Of course, you can initiate git updates or mirror synchronization anytime you want. The following commands may help you:

% make update   # Update git repository and rebuild docker images
% make sync     # Sync all mirrors with their upstream servers
% make publish  # Publish mirrors (start Web server)
% make log      # Show syncing logs

Type make uninstall to unregister automatic mirror syncing, and type make destroy to purge all of local repositories.

Deploy using helm3

Prior to the deployment, install and setup microk8s, then prepare PVs. Check hint if necessary.

Add chart repository.

% microk8s helm3 repo add linux-repository-mirror https://yamaoka-kitaguchi-lab.github.io/linux-repository-mirror/chart
% microk8s helm3 repo list
NAME                    URL
linux-repository-mirror https://yamaoka-kitaguchi-lab.github.io/linux-repository-mirror/chart

Instead of the above commands, you can clone this repository and move directory to chart.

% git clone --depth 1 https://github.com/yamaoka-kitaguchi-lab/linux-repository-mirror
% cd linux-repository-mirror/chart

Deploy mirrors. All mirrors are automatically synchronized and kept up to date by CronJob.

% microk8s helm3 install linux-repository-mirror linux-repository-mirror
% microk8s kubectl get all,pv,pvc --namespace default

Mirroring details

Each repository size is as of June 20, 2020. ALL means that the local mirror is a complete replication of the upper server.

Distribution Upstream Server Syncing Repositories Update Interval Size
ArchLinux jpn.mirror.pkgbuild.com ALL (only 64bit binaries) every 20 min. 96GB
Manjaro ftp.tsukuba.wide.ad.jp ALL (only 64bit binaries) every 20 min. 322GB
Ubuntu jp.archive.ubuntu.com
ftp.jaist.ac.jp (for i18n support)
20.04 LTS, 18.04 LTS every 20 min. 419GB
Debian ftp.jp.debian.org
hanzubon.jp (for i18n support)
testing, 11, 10, 9 every 20 min. 365GB
Raspbian archive.raspbian.org ALL every 20 min. 228GB
Cumulus repo3.cumulusnetworks.com w/o early-access every 20 min. -
Gentoo • rsync.jp.gentoo.org
ftp.iij.ad.jp (for source)
ALL
(w/ distfiles and packages)
every day 819GB

Hints and tips

When you decided to make a new mirror somewhere

Why don't you set the lab mirror as your upstream server. You can download packages without annoying bandwidth limitation. This is especially useful for the initial synchronization, which requires a lot of data transfer.

Coming soon

  1. Add FreeBSD repository mirror (Of course BSD is not Linux, though) (#1)
  2. Allow rsync client to pull packages from this local mirror (#2)

Known issues

  1. ArchLinux repository has not been updated due to the upper mirror failure (#4)
  2. I18n support of Debian has been freezed due to the upper mirror failure (#5)
  3. Horizontal Pod Autoscaler doesn't work with microk8s (#3)

Versioning

Releases are managed in CalVer scheme and it is independent of chart versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

linux-repository-mirror's People

Contributors

mi2428 avatar

Watchers

 avatar  avatar

linux-repository-mirror's Issues

HPA not working: no metrics returned from resource metrics API

Name:                                                  linux-repository-mirror-nginx-portage-hpa
Namespace:                                             default
Labels:                                                app.kubernetes.io/instance=linux-repository-mirror
                                                       app.kubernetes.io/managed-by=Helm
                                                       app.kubernetes.io/name=linux-repository-mirror
                                                       app.kubernetes.io/version=1.16.0
                                                       helm.sh/chart=linux-repository-mirror-1.0.0
Annotations:                                           <none>
CreationTimestamp:                                     Fri, 19 Jun 2020 14:51:35 +0000
Reference:                                             Deployment/linux-repository-mirror-nginx-portage-deployment
Metrics:                                               ( current / target )
  resource cpu on pods  (as a percentage of request):  <unknown> / 60%
Min replicas:                                          1
Max replicas:                                          4
Deployment pods:                                       2 current / 0 desired
Conditions:
  Type           Status  Reason                   Message
  ----           ------  ------                   -------
  AbleToScale    True    SucceededGetScale        the HPA controller was able to get the target's current scale
  ScalingActive  False   FailedGetResourceMetric  the HPA was unable to compute the replica count: missing request for cpu
Events:
  Type     Reason                        Age                    From                       Message
  ----     ------                        ----                   ----                       -------
  Warning  FailedGetResourceMetric       3m21s (x5 over 4m21s)  horizontal-pod-autoscaler  unable to get metrics for resource cpu: no metrics returned from resource metrics API
  Warning  FailedComputeMetricsReplicas  3m21s (x5 over 4m21s)  horizontal-pod-autoscaler  invalid metrics (1 invalid out of 1), first error is: failed to get cpu utilization: unable to get metrics for resource cpu: no metrics returned from resource metrics API
  Warning  FailedComputeMetricsReplicas  94s (x7 over 3m5s)     horizontal-pod-autoscaler  invalid metrics (1 invalid out of 1), first error is: failed to get cpu utilization: missing request for cpu
  Warning  FailedGetResourceMetric       80s (x8 over 3m5s)     horizontal-pod-autoscaler  missing request for cpu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.