diff options
author | merakor <cem@ckyln.com> | 2020-05-28 13:14:08 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-05-28 13:14:08 +0000 |
commit | 3701c9f561848ed46eda0814ee8c35b662cdc53a (patch) | |
tree | 86fea7a03fe528da16e34f9006a0afbb279bf8c6 | |
parent | c5ef3ea82ab4b4c15b2f64053f39227039e5dbcd (diff) | |
download | cpt-3701c9f561848ed46eda0814ee8c35b662cdc53a.tar.gz |
doc: add rsync repository documentation
FossilOrigin-Name: eb56569e16c0520a66515ca96040da72292e071085836bb1676ed39184d5afa2
-rw-r--r-- | doc/rsync-repositories.txt | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/doc/rsync-repositories.txt b/doc/rsync-repositories.txt new file mode 100644 index 0000000..71fca39 --- /dev/null +++ b/doc/rsync-repositories.txt @@ -0,0 +1,69 @@ +RSYNC REPOSITORIES + +RSYNC repositories are simple to serve and simple to use. In the repository +directory, there needs to be a '.rsync' file that points to the remote of +the repository. This is used in order to fetch changes from the upstream. +'.rsync' file looks like this for the core repository: + + rsync://carbslinux.org/repo/core + +RSYNC repositories have some few distinctions when it comes to fetching +them. Unlike GIT repositories, they don't have a defined "root" directory. +When there are multiple repositories in a shared repository (such as the +Carbs Linux and KISS Linux repositories), individual repositories need to +have this '.rsync' file. This doesn't, however, slow down operations. +Fetching from rsync repositories are still considerably faster and smaller. + + +SETTING UP AN RSYNC REPOSITORY + +Carbs Linux repositories automatically sync from the git repostitories +and serve it through the rsync daemon. Here is a sample shell script +that I use in order to sync repositories. Feel free to customize for your +own use. + + + #!/bin/sh + HOSTNAME=rsync://carbslinux.org/repo + GITDIR=/pub/git/repo + SHAREDIR=/pub/share/repo + _rsync() { rsync -aC --delete --exclude=.rsync "$@" ;} + + git -C "$GITDIR" pull + _rsync "$GITDIR/." "$SHAREDIR" + + # For some reason the core repositories were not synced + # so I resorted to this solution + for dir in "$GITDIR/"*; do + [ -d "$dir" ] || continue + _rsync "$dir/." "$SHAREDIR/${dir##*/}" + + [ -f "$SHAREDIR/${dir##*/}/.rsync" ] || + printf '%s/%s\n' "$HOSTNAME" "${dir##*/}" > "$SHAREDIR/${dir##*/}/.rsync" + done + + +You can then create an 'rsync' user for serving the repositories. + + -> adduser -SD rsync + + +Create '/etc/rsyncd.conf' and a service configuration as well. + +rsyncd.conf: + + uid = rsync + gid = rsync + address = example.com + max connections = 10 + use chroot = yes + + [repo] + path = /pub/share/repo + comment = My Repository + + +/etc/sysmgr/rsync or what have you: + + #!/bin/sh + exec rsync --daemon --no-detach |