Brak opisu

bigeagle 8399417880 feature(worker): fix exec_post_hook_test, manager channel was blocked in the previous version 9 lat temu
cmd a644294bd7 style: better logging for tunasynctl 9 lat temu
internal f8fd1ae460 style: better logging 9 lat temu
manager f8fd1ae460 style: better logging 9 lat temu
scripts 3ddbbfda94 docker script: added ubuntu-precise and gpg 9 lat temu
tests f8fd1ae460 style: better logging 9 lat temu
worker 8399417880 feature(worker): fix exec_post_hook_test, manager channel was blocked in the previous version 9 lat temu
.gitignore f0a0552e50 chore: modified test files 9 lat temu
.testandcover.bash 66df20cb1d chore: travis CI and coverall integration 9 lat temu
.testpackages.txt 44af0d5e62 feature(worker): framework of mirror provider 9 lat temu
.travis.yml 924fda6dd8 feature(worker): use cgroup track job process, so that they can be all-killed 9 lat temu
LICENSE 78f3501e19 Initial commit 11 lat temu
README.md 5ef50090e9 docs: update README 9 lat temu

README.md

tunasync

Build Status Coverage Status

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    |<---------+
					  +-----------------+

TODO

  • split to tunasync-manager and tunasync-worker instances
    • use HTTP as communication protocol
    • implement manager as status server first, and use python worker
    • implement go worker
  • Web frontend for tunasync-manager
    • start/stop/restart job
    • enable/disable mirror
    • view log
  • config file structure
    • support multi-file configuration (/etc/tunasync.d/mirror-enabled/*.conf)

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