man | ||
src | ||
.gitignore | ||
.rustfmt.toml | ||
build | ||
Cargo.lock | ||
Cargo.toml | ||
Dockerfile | ||
LICENSE | ||
package.Dockerfile | ||
README.md |
refractr
refractr is an automated push mirroring utility that clones one repository and can push it's branches to multiple different remotes. It can be ran once or over an interval using built-in scheduling or using cron jobs. Designed to be flexible on it's use, multiple repositories can be mirrored using several different configuration TOML files, or by running multiple instances of refractr with one configuration each.
How does it work?
refractr reads a configuration file that you specify to clone a repository over HTTP(S) or SSH to a location on your disk and push to update repositories that already exist on one or more remotes using SSH.
With the above procedure, refractr can be used to mirror public repositories to copies of your own (such as a fork or to make available on alternative hosting services), to mirror internal corporate repositories on a public network to please FOSS licensing agreements, or whatever your mind can think of!
Installation
Cargo
To install refractr using Cargo, run:
cargo install --git https://git.brysonsteck.xyz/brysonsteck/refractr
Docker
To run refractr using Docker, run:
docker run -it git.brysonsteck.xyz/brysonsteck/refractr refractr
You can build custom images with your configs using a Dockerfile, or you can build the image entirely from source using the package Dockerfile that is used to create the base images:
git clone https://git.brysonsteck.xyz/brysonsteck/refractr && cd refractr
docker build -t refractr --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f package.Dockerfile .
Windows
You can download pre-built binaries from the Releases page or from my package mirror:
# Download the exe with PowerShell
Invoke-WebRequest -Uri https://pkg.brysonsteck.xyz/dist/refractr/latest/windows/x86_64/refractr.exe -OutFile refractr.exe
# Download the SHA256 checksum
Invoke-WebRequest -Uri https://pkg.brysonsteck.xyz/dist/refractr/latest/windows/x86_64/refractr.exe.sha256.txt -OutFile refractr.exe.sha256.txt
# Verify hashes match (should return "True")
(Get-Content .\refractr.exe.sha256.txt) -eq (Get-FileHash .\refractr.exe).hash
macOS
Coming soon...
Build from Source
To build and run refractr from source, you may need some packages installed on your system. On vanilla installations of FreeBSD, OpenBSD, Windows and macOS, you should be able to compile refractr without issue. On Linux, however, you may need to install additional packages that provide the pkg-config
binary and OpenSSL headers. Refer to your package manager for the correct package names that you will need to verify are installed.
# clone the repository
git clone https://git.brysonsteck.xyz/brysonsteck/refractr && cd refractr
# build the release binary
cargo build --release
# build the debug binary (not recommended for normal use)
cargo build
# you can run the binary in the target directory
# or move it wherever you wish
./target/release/refractr
FAQ
Couldn't I do this with a shell script and a cron job or (insert alternative method here)?
Yes.
Then why reinvent the wheel?
Stop asking such asinine questions.