Sen descrición

bigeagle 4c6a407c17 feat(manager): implemented restful API for updating mirror size %!s(int64=8) %!d(string=hai) anos
autocomplete 83fc766147 feat(bash and zsh autocompletion for tunasynctl): %!s(int64=9) %!d(string=hai) anos
cmd 9ffb101cc7 chore(tunasync): bump version to 0.2-dev %!s(int64=8) %!d(string=hai) anos
docs e9a7fc2de2 docs(tunasync): prebuilt binaries on Github releases, close #41 %!s(int64=8) %!d(string=hai) anos
internal 4c6a407c17 feat(manager): implemented restful API for updating mirror size %!s(int64=8) %!d(string=hai) anos
manager 4c6a407c17 feat(manager): implemented restful API for updating mirror size %!s(int64=8) %!d(string=hai) anos
systemd 28c8145137 feature(worker): limit rsync memory using cgroup %!s(int64=9) %!d(string=hai) anos
tests 5c8d90608c feature(worker): implemented multi-file configrations. closing #23 %!s(int64=9) %!d(string=hai) anos
worker 939abaef9b feat(worker): TUNASYNC_LOG_DIR environment variable %!s(int64=8) %!d(string=hai) anos
.gitignore 03fdaeeb7f chore(cmd): added git hash and build date to version %!s(int64=9) %!d(string=hai) anos
.testandcover.bash e37bb44fa3 ci(tunasync): upload to github releases %!s(int64=8) %!d(string=hai) anos
.testpackages.txt 44af0d5e62 feature(worker): framework of mirror provider %!s(int64=9) %!d(string=hai) anos
.travis.yml 7601e5793f fix(worker): improved cgroup creation %!s(int64=8) %!d(string=hai) anos
LICENSE 78f3501e19 Initial commit %!s(int64=11) %!d(string=hai) anos
Makefile e37bb44fa3 ci(tunasync): upload to github releases %!s(int64=8) %!d(string=hai) anos
README.md e9a7fc2de2 docs(tunasync): prebuilt binaries on Github releases, close #41 %!s(int64=8) %!d(string=hai) anos
package.json c311648546 chore(git): Made this repo commitizen frendly %!s(int64=9) %!d(string=hai) anos

README.md

tunasync

Build Status Coverage Status Commitizen friendly GPLv3

Get Started

Download

Pre-built binary for Linux x86_64 is available at Github releases.

Design

# Architecture

- Manager: Centural instance on status and job management
- Worker: Runs mirror jobs

+------------+ +---+                  +---+
| Client API | |   |    Job Status    |   |    +----------+     +----------+ 
+------------+ |   +----------------->|   |--->|  mirror  +---->|  mirror  | 
+------------+ |   |                  | w |    |  config  |     | provider | 
| Worker API | | H |                  | o |    +----------+     +----+-----+ 
+------------+ | T |   Job Control    | r |                          |       
+------------+ | T +----------------->| k |       +------------+     |       
| Job/Status | | P |   Start/Stop/... | e |       | mirror job |<----+       
| Management | | S |                  | r |       +------^-----+             
+------------+ |   |   Update Status  |   |    +---------+---------+         
+------------+ |   <------------------+   |    |     Scheduler     |
|   BoltDB   | |   |                  |   |    +-------------------+
+------------+ +---+                  +---+


# Job Run Process


PreSyncing           Syncing                               Success
+-----------+     +-----------+    +-------------+     +--------------+
|  pre-job  +--+->|  job run  +--->|  post-exec  +-+-->| post-success |
+-----------+  ^  +-----------+    +-------------+ |   +--------------+
			   |                                   |
			   |      +-----------------+          | Failed
			   +------+    post-fail    |<---------+
					  +-----------------+

Generate Self-Signed Certificate

Fisrt, create root CA

openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -days 365 -out rootCA.crt

Create host key

openssl genrsa -out host.key 2048

Now create CSR, before that, write a req.cnf

[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req

[req_distinguished_name]
countryName = Country Name (2 letter code)
countryName_default = CN
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = BJ
localityName = Locality Name (eg, city)
localityName_default = Beijing
organizationalUnitName  = Organizational Unit Name (eg, section)
organizationalUnitName_default  = TUNA
commonName = Common Name (server FQDN or domain name)
commonName_default = <server_FQDN>
commonName_max  = 64

[v3_req]
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = <server_FQDN_1>
DNS.2 = <server_FQDN_2>

Substitute <server_FQDN> with your server's FQDN, then run

openssl req -new -key host.key -out host.csr -config req.cnf

Finally generate and sign host cert with root CA

openssl x509 -req -in host.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out host.crt -days 365 -extensions v3_req -extfile req.cnf

Building

Setup GOPATH like this.

Then:

go get -d github.com/tuna/tunasync/cmd/tunasync
cd $GOPATH/src/github.com/tuna/tunasync
make

If you have multiple GOPATHs, replace the $GOPATH with your first one.