GitFortress is a powerful tool designed to synchronize your GitHub repositories in a remote location securely and efficiently. This tool ensures your repositories are always backed up and kept in sync with their remote state, offering peace of mind and data security for developers and teams alike.
- Automatic Synchronization: Clone all repos available to the user and continuously keep them in sync with the remote state.
- Flexibility: Runs as a standalone binary or within a Docker container for ease of deployment and use.
- Configuration Freedom: Customizable through a simple configuration file, allowing users to specify their backup preferences.
- Keeps track: Publishes metrics to prometheus and/or influxdb
Pull the GitFortress image using the following command:
docker pull muscaw/gitfortress:latest
Create a config.yml
file with the following structure:
inputs:
- name: "Github"
type: github
targetUrl: https://api.github.com
apiToken: "Your Github PAT token"
ignoreRepositoriesRegex: []
- name: "Gitlab"
type: gitlab
targetUrl: https://gitlab.com
apiToken: "Your Gitlab PAT token"
ignoreRepositoriesRegex: []
syncDelay: "5m" # Uses Golang's units. Valid time units are "ns", "us", "ms", "s", "m", "h"
cloneFolderPath: "path/to/clone/folder"
influxDB: # Optional
url: "influx-url"
authToken: "influx-token"
organizationName: "influx-org-name"
bucketName: "influx-bucket-name"
prometheus:
exposedPort: 1000 # exposed port for prometheus consumption
autoConvertNames: false # whether to automatically add a marker for counter type metrics such as _total
GitFortress reads the following paths in the given order. If it finds a valid config file, it will use it and not search for the next config files.
- $HOME/.config/gitfortress/config.yml
- /etc/gitfortress/config.yml
- Go to GitHub Settings.
- Navigate to Developer settings > Personal access tokens > Generate new token.
- Select
repo
to grant full control of private repositories. - Click on the
Generate token
button. - Copy the generated token to your
config.yml
as theapiToken
value for your Github configuration.
- Go to Gitlab Preferences.
- Navigate to "Access tokens"
- Add new token
- Select the permissions
read_api
,read_user
,read_repository
- Click on Create personal access token
- Copy the generated token to your
config.yml
as theapiToken
value for your Gitlab configuration
Run GitFortress by executing:
./gitfortress
To run GitFortress using Docker, use the following command:
docker run --rm -v /path/to/config/directory:/etc/gitfortress ghcr.io/Muscaw/GitFortress:latest
Replace /path/to/config/directory
with the actual path to your configuration directory.
For Docker Compose, include the following in your docker-compose.yml
file:
services:
gitfortress:
image: muscaw/gitfortress:latest
volumes:
- /path/to/config/directory:/etc/gitfortress
- /path/to/clone/directory:/backup
Replace the placeholders with the actual path to your configuration directory.
Both Prometheus and InfluxDB backends are supported and can be configured to publish execution metrics (see config.yml).
A sample dashboard for Grafana is available in the examples folder.
We welcome contributions! Please refer to our CONTRIBUTING.md for guidelines on how to make GitFortress better.
GitFortress is released under the MIT License.
For support or inquiries, please open an issue on the GitHub repository.