File tree Expand file tree Collapse file tree 7 files changed +146
-0
lines changed
Expand file tree Collapse file tree 7 files changed +146
-0
lines changed Original file line number Diff line number Diff line change 11/github_token.env
2+ /geopip.env
Original file line number Diff line number Diff line change @@ -164,10 +164,51 @@ services:
164164 - " traefik.tcp.routers.rsync.entrypoints=rsync"
165165 restart : always
166166
167+ redis :
168+ image : redis:6-alpine
169+ restart : unless-stopped
170+ hostname : redis
171+
172+ geoipupdate :
173+ image : maxmindinc/geoipupdate
174+ restart : unless-stopped
175+ env_file :
176+ geopip.env
177+ environment :
178+ - GEOIPUPDATE_EDITION_IDS=GeoLite2-City GeoLite2-ASN
179+ - GEOIPUPDATE_FREQUENCY=24
180+ volumes :
181+ - geoip-data:/usr/share/GeoIP
182+
183+ mirrorbits :
184+ build : ./mirrorbits
185+ restart : unless-stopped
186+ depends_on :
187+ - redis
188+ - geoipupdate
189+ volumes :
190+ - geoip-data:/usr/share/GeoIP:ro
191+ - /srv/msys2repo:/repo-volume:ro
192+ - ./mirrorbits/mirrorbits.conf:/etc/mirrorbits.conf:ro
193+ - ./mirrorbits/add_mirrors.sh:/add_mirrors.sh:ro
194+ labels :
195+ - " traefik.enable=true"
196+ - " traefik.http.middlewares.mirrorbits-scheme-redir.redirectscheme.scheme=https"
197+ # http
198+ - " traefik.http.routers.mirrorbits.rule=Host(`mirror.msys2.org`)"
199+ - " traefik.http.routers.mirrorbits.entrypoints=web"
200+ - " traefik.http.routers.mirrorbits.middlewares=mirrorbits-scheme-redir"
201+ # https
202+ - " traefik.http.routers.mirrorbits-secure.rule=Host(`mirror.msys2.org`)"
203+ - " traefik.http.routers.mirrorbits-secure.tls=true"
204+ - " traefik.http.routers.mirrorbits-secure.tls.certresolver=le"
205+ - " traefik.http.routers.mirrorbits-secure.entrypoints=web-secure"
206+
167207volumes :
168208 letsencrypt :
169209 staging-gnupg :
170210 staging-repos :
211+ geoip-data :
171212
172213networks :
173214 default :
Original file line number Diff line number Diff line change 1+ GEOIPUPDATE_ACCOUNT_ID=
2+ GEOIPUPDATE_LICENSE_KEY=
Original file line number Diff line number Diff line change 1+ FROM ubuntu:focal as build
2+
3+ RUN apt-get update -y && \
4+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
5+ pkg-config zlib1g-dev protobuf-compiler libprotoc-dev git make golang && \
6+ rm -rf /var/lib/apt/lists/*
7+
8+ RUN git clone https://github.com/etix/mirrorbits.git && \
9+ cd mirrorbits && \
10+ git checkout eeea0e026d0ca99c7009a91a54369f7c29e87049
11+ RUN cd mirrorbits && \
12+ mkdir -p dist/usr/bin && \
13+ make install PREFIX=/usr DESTDIR=dist
14+
15+ FROM ubuntu:focal
16+
17+ COPY --from=build /mirrorbits/dist /
18+
19+ RUN apt-get update -y && \
20+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
21+ rsync redis-tools ca-certificates tzdata && \
22+ rm -rf /var/lib/apt/lists/*
23+
24+ COPY init.sh /init.sh
25+ CMD bash /init.sh
26+ EXPOSE 80
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ mirrorbits add -http=https://mirror.yandex.ru/mirrors/msys2/ -rsync=rsync://mirror.yandex.ru/mirrors/msys2/ yandex.ru
4+ mirrorbits enable yandex.ru
5+
6+ mirrorbits add -http=https://mirror.selfnet.de/msys2/ -rsync=rsync://mirror.selfnet.de/msys2/ selfnet.de
7+ mirrorbits enable selfnet.de
8+
9+ mirrorbits add -country-only -http=https://mirrors.tuna.tsinghua.edu.cn/msys2/ -rsync=rsync://mirror.selfnet.de/msys2/ tsinghua.edu.cn
10+ mirrorbits enable tsinghua.edu.cn
11+
12+ mirrorbits add -http=https://ftp.acc.umu.se/mirror/msys2.org/ -rsync=rsync://ftp.acc.umu.se/mirror/msys2.org/ umu.se
13+ mirrorbits enable umu.se
14+
15+ mirrorbits add -http=https://quantum-mirror.hu/mirrors/pub/msys2/ -rsync=rsync://quantum-mirror.hu/msys2/ quantum-mirror.hu
16+ mirrorbits enable quantum-mirror.hu
17+
18+ mirrorbits add -http=https://mirrors.dotsrc.org/msys2/ -rsync=rsync://mirrors.dotsrc.org/msys2/ dotsrc.org
19+ mirrorbits enable dotsrc.org
20+
21+ mirrorbits add -http=https://mirror.ufro.cl/msys2/ -rsync=rsync://mirror.ufro.cl/msys2/ ufro.cl
22+ mirrorbits enable ufro.cl
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ while [ ! -f /usr/share/GeoIP/GeoLite2-ASN.mmdb ] || [ ! -f /usr/share/GeoIP/GeoLite2-ASN.mmdb ]
6+ do
7+ echo " waiting for GeoIP data to be loaded"
8+ sleep 2
9+ done
10+
11+ # Throw out the redis db, mirrorbits gets confused easily when adding/removing mirrors
12+ redis-cli -h redis FLUSHALL
13+
14+ mirrorbits daemon --debug &
15+ pid=$!
16+
17+ while ! mirrorbits list
18+ do
19+ echo " waiting for server"
20+ sleep 3
21+ done
22+
23+ # remove all mirrors
24+ mirrorbits list -state=false | tail -n +2 | xargs --no-run-if-empty -n1 mirrorbits remove -f
25+
26+ # add all mirrors
27+ if [ -f " add_mirrors.sh" ]; then
28+ source add_mirrors.sh
29+ fi
30+
31+ wait $pid
Original file line number Diff line number Diff line change 1+ Repository: /repo-volume
2+ Templates: /usr/share/mirrorbits/
3+ OutputMode: auto
4+ ListenAddress: :80
5+ Gzip: false
6+ RedisAddress: redis:6379
7+ GeoipDatabasePath: /usr/share/GeoIP/
8+ ConcurrentSync: 5
9+ ScanInterval: 30
10+ CheckInterval: 5
11+ RepositoryScanInterval: 5
12+ Hashes:
13+ SHA1: Off
14+ SHA256: Off
15+ MD5: Off
16+ DisallowRedirects: false
17+ WeightDistributionRange: 4
18+ DisableOnMissingFile: false
19+ MaxLinkHeaders: 10
20+ Fallbacks:
21+ - URL: https://repo.msys2.org/
22+ CountryCode: cz
23+ ContinentCode: eu
You can’t perform that action at this time.
0 commit comments