diff --git a/README.md b/README.md index 758f46b..11d51bb 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ REpository ArchivER(REAPER) is a tool to archive repositories from any Git serve - [Usage](#usage) - [rip](#rip) - [run](#run) + - [daemon](#daemon) - [Configuration](#configuration) - [Storage](#storage) - [Run as docker container](#run-as-docker-container) @@ -65,6 +66,16 @@ reaper run Combined with cron, you can archive repositories periodically. +### daemon + +`daemon` runs REAPER as a daemon. It will archive all repositories defined in configuration periodically. + +```bash +reaper daemon +# You might want to run it with something like nohup +nohup reaper daemon & +``` + ## Configuration For configuration, you can checkout this [example](config/example.config.yaml). @@ -100,6 +111,10 @@ For example compose file, see [docker-compose.yml](docker-compose.yml). docker compose up -d ``` +## FAQ + +See [FAQ](https://github.com/LeslieLeung/reaper/wiki/FAQ). + ## Stargazers over time [![Stargazers over time](https://starchart.cc/LeslieLeung/reaper.svg)](https://starchart.cc/LeslieLeung/reaper) diff --git a/README_zh.md b/README_zh.md index 3a992d4..6f43d43 100644 --- a/README_zh.md +++ b/README_zh.md @@ -8,6 +8,7 @@ REpository ArchivER(REAPER)是一个用于从任何Git服务器归档 Git - [使用方法](#使用方法) - [rip](#rip) - [run](#run) + - [daemon](#daemon) - [配置](#配置) - [存储](#存储) - [使用 Docker 运行](#使用-docker-运行) @@ -65,6 +66,16 @@ reaper run 结合cron,你可以定期归档 Git 仓库。 +### daemon + +`daemon`命令会启动一个守护进程,它会在后台运行,归档在配置中定义的所有 Git 仓库。 + +```bash +reaper daemon +# 使用 nohup 后台运行 +nohup reaper daemon & +``` + ## 配置 有关配置,你可以查看此[示例](config/example.config.yaml)。 @@ -97,9 +108,13 @@ docker run --rm \ 示例Compose配置,见 [docker-compose.yml](docker-compose.yml)。 ```bash +git clone https://github.com/leslieleung/reaper.git docker compose up -d ``` +## 常见问题 + +见 [FAQ](https://github.com/LeslieLeung/reaper/wiki/FAQ)。 ## Stargazers over time diff --git a/docker-compose.yml b/docker-compose.yml index 2d6ac73..55cefab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,11 +9,13 @@ services: - TZ=Asia/Shanghai volumes: # config file path, modify it to yours - - ${pwd}/config/example.config.syaml:/config.yaml + - ${pwd}/config/example.config.yaml:/config.yaml # data path, to store downloaded repo, modify it to yours # the in-container path need to be the same as defined in config file - ${pwd}/repo:/repo - # defaultly archives all repositories defined in configuration. + # by default archives all repositories defined in configuration. command: ["run"] # or just archives a single repository defined in configuration. - # command: ["rip", "reaper"] \ No newline at end of file + # command: ["rip", "reaper"] + # run as daemon + # command: ["daemon"] \ No newline at end of file diff --git a/go.mod b/go.mod index ed98be9..5b543d1 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,12 @@ module github.com/leslieleung/reaper go 1.21 require ( + github.com/go-co-op/gocron v1.35.3 github.com/go-git/go-git/v5 v5.10.0 github.com/google/uuid v1.4.0 github.com/gookit/color v1.5.4 github.com/mholt/archiver/v4 v4.0.0-alpha.8 + github.com/minio/minio-go/v7 v7.0.63 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.17.0 ) @@ -27,7 +29,6 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-co-op/gocron v1.35.3 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -44,7 +45,6 @@ require ( github.com/klauspost/pgzip v1.2.5 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/minio/minio-go/v7 v7.0.63 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -66,7 +66,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/therootcompany/xz v1.0.1 // indirect - github.com/ulikunitz/xz v0.5.10 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect go.uber.org/atomic v1.9.0 // indirect diff --git a/go.sum b/go.sum index f648271..0c859f8 100644 --- a/go.sum +++ b/go.sum @@ -204,7 +204,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= @@ -310,8 +309,8 @@ github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSW github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw= github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= -github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHgvgickp1Yw510KJOqX7H24mg8=