use ftpsync for debian and debian-security

This commit is contained in:
Max Erenberg 2022-09-30 20:05:36 -04:00 committed by Mirror
parent a4234a359b
commit 61e9f80b80
8 changed files with 127 additions and 39 deletions

6
.gitignore vendored
View File

@ -13,7 +13,5 @@
/.config/
/.cache/
/.ssh/
log/
log-rsync/
log-zfssync/
state/
/go/
/.bashrc

View File

@ -0,0 +1,40 @@
# Adapted from /usr/share/doc/ftpsync/examples/ftpsync.conf.sample
# See man:ftpsync.conf(5) for details
MIRRORNAME=mirror.csclub.uwaterloo.ca
TO="/mirror/root/debian-security"
MAILTO="root@csclub.uwaterloo.ca"
# HUB=false
########################################################################
## Connection options
########################################################################
RSYNC_HOST=rsync.security.debian.org
RSYNC_PATH="debian-security"
# RSYNC_USER=
# RSYNC_PASSWORD=
########################################################################
## Mirror information options
########################################################################
INFO_MAINTAINER="Systems Committee <systems-committee@csclub.uwaterloo.ca>"
INFO_SPONSOR="Mathematics Endowment Fund <https://uwaterloo.ca/math-endowment-fund>"
INFO_COUNTRY=CA
INFO_LOCATION="University of Waterloo"
# INFO_THROUGHPUT=10Gb
########################################################################
## Include and exclude options
########################################################################
# ARCH_INCLUDE=
# ARCH_EXCLUDE=
########################################################################
## Log option
########################################################################
LOGDIR=/home/mirror/merlin/log-ftpsync
LOGROTATE=2

View File

@ -0,0 +1,40 @@
# Adapted from /usr/share/doc/ftpsync/examples/ftpsync.conf.sample
# See man:ftpsync.conf(5) for details
MIRRORNAME=mirror.csclub.uwaterloo.ca
TO="/mirror/root/debian"
MAILTO="root@csclub.uwaterloo.ca"
# HUB=false
########################################################################
## Connection options
########################################################################
RSYNC_HOST=debian.mirror.rafal.ca
RSYNC_PATH="debian"
# RSYNC_USER=
# RSYNC_PASSWORD=
########################################################################
## Mirror information options
########################################################################
INFO_MAINTAINER="Systems Committee <systems-committee@csclub.uwaterloo.ca>"
INFO_SPONSOR="Mathematics Endowment Fund <https://uwaterloo.ca/math-endowment-fund>"
INFO_COUNTRY=CA
INFO_LOCATION="University of Waterloo"
# INFO_THROUGHPUT=10Gb
########################################################################
## Include and exclude options
########################################################################
# ARCH_INCLUDE=
# ARCH_EXCLUDE=
########################################################################
## Log option
########################################################################
LOGDIR=/home/mirror/merlin/log-ftpsync
LOGROTATE=2

11
merlin/.gitignore vendored
View File

@ -1,7 +1,10 @@
*.pyc
/logs
/log/
/logs/
/logs.*
/rebuild_logs
/stamps
merlin.sock
/log-*
/rebuild_logs/
/stamps/
/state/
/merlin
/merlin.sock

View File

@ -135,6 +135,8 @@ type Repo struct {
RsyncUser string `ini:"rsync_user"`
// full path to file storing the password for rsync (optional)
PasswordFile string `ini:"password_file"`
// the archive name for the ftpsync command (required for csc-sync-ftpsync)
FtpsyncArchive string `ini:"ftpsync_archive"`
// full path to file storing the repo sync state
StateFile string `ini:"-"`
// full path for file storing general logging of this repo
@ -258,7 +260,9 @@ func LoadConfig(configPath string, doneChan chan SyncResult, stopChan chan struc
panic("Missing sync type from " + repo.Name)
} else if repo.LocalDir == "" {
panic("Missing local download location for " + repo.Name)
} else if repo.RsyncHost == "" {
} else if repo.SyncType == "csc-sync-ftpsync" && repo.FtpsyncArchive == "" {
panic("Missing ftpsync archive for " + repo.Name)
} else if repo.SyncType != "csc-sync-ftpsync" && repo.RsyncHost == "" {
panic("Missing rsync host for " + repo.Name)
}

View File

@ -5,21 +5,17 @@ max_jobs = 8
download_dir = /mirror/root
state_dir = /home/mirror-go/merlin/state
repo_log_dir = /home/mirror-go/merlin/log
rsync_log_dir = /home/mirror-go/merlin/log-rsync
zfssync_log_dir = /home/mirror-go/merlin/log-zfssync
state_dir = /home/mirror/merlin/state
repo_log_dir = /home/mirror/merlin/log
rsync_log_dir = /home/mirror/merlin/log-rsync
zfssync_log_dir = /home/mirror/merlin/log-zfssync
sock_path = /mirror/merlin/run/merlin-go.sock
; note: the .ssh keys are only located on /home/mirror/.ssh not at /home/mirror-go/.ssh
sock_path = /mirror/merlin/run/merlin.sock
[debian]
sync_type = csc-sync-debian
sync_type = csc-sync-ftpsync
frequency = bi-hourly
local_dir = debian
rsync_host = debian.mirror.rafal.ca
rsync_dir = debian
ftpsync_archive = debian
[ubuntu]
verbose = true
@ -53,21 +49,21 @@ local_dir = debian-multimedia
rsync_host = www.deb-multimedia.org
rsync_dir = deb
[debian-backports]
verbose = true
sync_type = csc-sync-debian
frequency = bi-hourly
local_dir = debian-backports
rsync_host = debian.mirror.rafal.ca
rsync_dir = debian-backports
; This doesn't exist anymore, each distribution has their own "-backports"
; repository (e.g. buster-backports, bullseye-backports)
;
; [debian-backports]
; verbose = true
; sync_type = csc-sync-debian
; frequency = bi-hourly
; local_dir = debian-backports
; rsync_host = debian.mirror.rafal.ca
; rsync_dir = debian-backports
[debian-security]
sync_type = csc-sync-debian
sync_type = csc-sync-ftpsync
frequency = twice-hourly
local_dir = debian-security
rsync_host = rsync.security.debian.org
rsync_dir = debian-security
trace_host = security-master.debian.org
ftpsync_archive = debian-security
[ubuntu-releases]
sync_type = csc-sync-standard
@ -157,7 +153,7 @@ frequency = twice-daily
local_dir = gnome
rsync_host = master.gnome.org
rsync_dir = gnomeftp
password_file = /home/mirror-go/passwords/gnome
password_file = /home/mirror/passwords/gnome
[damnsmalllinux]
verbose = true
@ -311,7 +307,7 @@ local_dir = gentoo-distfiles
rsync_user = gentoo
rsync_host = masterdistfiles.gentoo.org
rsync_dir = gentoo
password_file = /home/mirror-go/passwords/gentoo-distfiles
password_file = /home/mirror/passwords/gentoo-distfiles
[gentoo-portage]
sync_type = csc-sync-standard
@ -486,4 +482,4 @@ rsync_dir = almalinux/
sync_type = csc-sync-ceph
frequency = tri-hourly
local_dir = ceph
rsync_host = download.ceph.com
rsync_host = download.ceph.com

View File

@ -3,11 +3,11 @@ Description=Manages synchronization of mirrored projects
After=network.target
[Service]
ExecStart=/home/mirror-go/merlin/merlin --config=/home/mirror-go/merlin/merlin-config.ini
WorkingDirectory=/home/mirror-go/merlin
ExecStart=/home/mirror/merlin/merlin --config=/home/mirror/merlin/merlin-config.ini
WorkingDirectory=/home/mirror/merlin
User=mirror
Group=mirror
SyslogIdentifier=merlin-go
SyslogIdentifier=merlin
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

View File

@ -55,6 +55,8 @@ func getSyncCommand(repo *config.Repo) (cmds [][]string) {
return append(cmds, cscSyncDebianStep1(repo), cscSyncDebianStep2(repo))
case "csc-sync-debian-cd":
return append(cmds, cscSyncDebianCD(repo))
case "csc-sync-ftpsync":
return append(cmds, cscSyncFtpsync(repo))
case "csc-sync-s3":
return append(cmds, cscSyncS3(repo))
case "csc-sync-ssh":
@ -289,6 +291,11 @@ func cscSyncDebianCD(repo *config.Repo) []string {
return args
}
func cscSyncFtpsync(repo *config.Repo) []string {
// ftpsync configs are in /home/mirror/ftpsync/
return []string{"ftpsync", "sync:archive:" + repo.FtpsyncArchive}
}
func cscSyncS3(repo *config.Repo) []string {
// could not find a argument for "RCLONE_CONFIG_S3_TYPE=s3"
// so an adhoc solution was put in spawnProcess (if possible remove)