Mirror job management tool.
Go to file
bigeagle 3d38e413ce
feature: syncing status
2016-04-30 16:37:33 +08:00
examples set environment variable for mirror jobs 2015-12-26 17:15:06 +08:00
internal feature: syncing status 2016-04-30 16:37:33 +08:00
manager feature(manager): skeleton of status API 2016-04-30 16:37:23 +08:00
scripts docker script: added ubuntu-precise and gpg 2016-04-09 17:37:52 +08:00
systemd update systemd 2014-10-19 00:43:07 +08:00
tests anaconda mirror script 2016-04-06 15:43:50 +08:00
tunasync debian-2-stage-rsync: new version of apt checks Contents, now the whole dists/ can be ignored 2016-04-17 19:42:50 +08:00
.gitignore bug fix 2014-10-24 19:49:51 +08:00
.testandcover.bash chore: travis CI and coverall integration 2016-04-30 16:37:29 +08:00
.testpackages.txt feature: syncing status 2016-04-30 16:37:33 +08:00
.travis.yml chore: travis CI and coverall integration 2016-04-30 16:37:29 +08:00
LICENSE Initial commit 2014-10-17 16:24:26 +08:00
README.md chore: travis CI and coverall integration 2016-04-30 16:37:29 +08:00
requirements.txt update requirements.txt 2015-12-26 17:16:16 +08:00
tunasync.py update pidfile and sockfile path 2016-04-03 21:04:35 +08:00
tunasync_snapshot_gc.py snapshot GC fix 2015-07-10 20:23:01 +08:00
tunasynctl.py update pidfile and sockfile path 2016-04-03 21:04:35 +08:00

tunasync

Build Status Coverage Status

Design

# Architecture

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


+----------+  +---+   worker configs   +---+    +----------+     +----------+
|  Status  |  |   |+-----------------> | w +--->|  mirror  +---->|  mirror  |
|  Manager |  |   |                    | o |    |  config  |     | provider |
+----------+  | W |  start/stop job    | r |    +----------+     +----+-----+
              | E |+-----------------> | k |                          |
+----------+  | B |                    | e |       +------------+     |
|   Job    |  |   |   update status    | r |<------+ mirror job |<----+
|Controller|  |   | <-----------------+|   |       +------------+
+----------+  +---+                    +---+


# Job Run Process

+-----------+     +-----------+    +-------------+     +--------------+
|  pre-job  +--+->|  job run  +--->|   post-job  +-+-->| post-success |
+-----------+  ^  +-----------+    +-------------+ |   +--------------+
			   |                                   |
			   |      +-----------------+          |
			   +------+    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