A little sync files tool in the Linux.
confsyncer
is a little tool about push and pull files in git repo, 基于此 你可以 很方便的将一些配置文件分发到多台机器上.
- 手动 Push 监视中的 文件到指定的 git 仓库
- 自动/手动 从指定的 git 仓库 拉取文件到本地的指定位置
- 基于 docker-compose 的一键式 生成与部署
# use confsyncer with bin
$ wget https://github.com/Kuri-su/confSyncer/eleases/download/v0.0.1/confsyncer-0.0.1-amd64
# use confsyncer with docker-compose and confsyncerGen
$ wget https://github.com/Kuri-su/confSyncer/eleases/download/v0.0.1/confsyncer-0.0.1-amd64
$ wget https://github.com/Kuri-su/confSyncer/eleases/download/v0.0.1/confsyncerGen-0.0.1-amd64
$ chmod +x confsyncerGen-0.0.1-amd64 confsyncer-0.0.1-amd64
# install
$ sudo cp confsyncerGen-0.0.1-amd64 /usr/local/bin/confsyncerGen
$ sudo cp confsyncer-0.0.1-amd64 /usr/local/bin/confsyncer
-
init confsyncer's config
# init confsyncer's config $ confsyncer init Success! Create config file in ~/.confsyncer/config.yaml You should modify it before use. This is your config: { "gitpulltimeinternal": 600, "maps": [ { "gitRepoPath": "/.confsyncer/config.yaml", "local": "~/.confsyncer/config.yaml" } ], "gitrepo": "" }
-
modify config file
~/.confsyncer/config.yaml
$ vim ~/.confsyncer/config.yaml
-
create the git repo and push your config files to repo
# show confsyncer's config $ confsyncer config This is your config: { "gitrepo": "[email protected]:Kurisu-public/ktx1.git", "gitpulltimeinternal": 600, "maps": [ { "gitRepoPath": "/.confsyncer/config.yaml", "local": "~/.confsyncer/config.yaml" } ] } # commit && push files to git repo $ confsyncer push copy '~/.confsyncer/config.yaml' to '/tmp/confsyncer-20200713/.confsyncer/config.yaml' success
-
add crontab task to pull config every 1 minute
# set crontab task * * * * * bash -c "confsyncer pull"
-
或者你也可以手动的拉取
# pull config files $ confsyncer pull copy '~/.confsyncer/config.yaml' to '/tmp/confsyncer-20200713/.confsyncer/config.yaml' success
-
init confsyncer's config
# init confsyncer's config $ confsyncer init Success! Create config file in ~/.confsyncer/config.yaml You should modify it before use. This is your config: { "gitpulltimeinternal": 600, "maps": [ { "gitRepoPath": "/.confsyncer/config.yaml", "local": "~/.confsyncer/config.yaml" } ], "gitrepo": "" }
-
modify config file
~/.confsyncer/config.yaml
$ vim ~/.confsyncer/config.yaml
-
run confsyncerGen with you confsyncer config
# run (然后使用 docker-compose 启动服务即可) $ confsyncerGen && docker-compose up -f ~/.confsyncer/docker-compose.yaml -d
$ confsyncer help
confsyncer
Usage:
confsyncer [command]
Available Commands:
config show config
daemon daemon
help Help about any command
init initialization config
pull pull
push push
version show version
Flags:
-h, --help help for confsyncer
$ confsyncerGen help
confsyncerGen
Usage:
confsyncerGen [command]
Available Commands:
config show config
composeyaml show composeyaml
help Help about any command
version show version
Flags:
-h, --help help for confsyncer
-f confsyncer config path
-o output docker-compose.yaml
GPL-3.0