Skip to content

Commit f1430bc

Browse files
committedMar 9, 2019
add README AND a unit test
1 parent b07b98b commit f1430bc

File tree

3 files changed

+183
-141
lines changed

3 files changed

+183
-141
lines changed
 

‎README-from-fork.md

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
BitTorrent Sync using Resilio Sync
2+
==================================
3+
4+
![](https://img.shields.io/docker/pulls/nimmis/resilio-sync.svg)
5+
6+
This is a small container [![](https://images.microbadger.com/badges/image/nimmis/resilio-sync.svg)](https://microbadger.com/images/nimmis/resilio-sync "Get your own image badge on microbadger.com") using Resilio Sync client to syncronize data between clients.
7+
8+
Sync skips the cloud and finds the shortest path between devices when transferring data. No Cloud. No uploading to third party servers. Just fast, simple file syncing.
9+
10+
Based on my alpine micro container with glibc [![](https://images.microbadger.com/badges/image/nimmis/alpine-glibc.svg)](https://microbadger.com/images/nimmis/alpine-glibc "Get your own image badge on microbadger.com") please visit [nimmis/alpine-glibc](https://registry.hub.docker.com/u/nimmis/alpine-glibc/) for more information.
11+
12+
This container can run in two different mode:
13+
14+
* web gui mode, all configuration done thru a web interface
15+
* sync mode, sync predefined directory with secret key supplied or generated
16+
17+
# Global settings
18+
19+
These setting applies to both web gui and sync mode
20+
21+
### RSLSYNC_NAME
22+
23+
This variable defines the name shown on other nodes, if not defined it will get the name shown with the command *hostname*
24+
25+
This will start a container with then name **database**
26+
27+
docker run -d -e RSLSYNC_NAME=database -p 33333:33333 nimmis/resilio-sync
28+
29+
### RSLSYNC_TRASH
30+
31+
This variable defines if files removed from sync slaves should be put in an archive folder for a time defined by the variable **RSLSYNC_TRASH_TIME** before removed.
32+
33+
Default value is **true**, to disable this feature add
34+
35+
-e RSLSYNC_TRASH=false
36+
37+
to the docker start command
38+
39+
### RSLSYNC_TRASH_TIME
40+
41+
This variable defines how many days a file will be kept in the achive folder before it is removed. The variable is defined i days and the default value is 30 days. To change the time so achive files are saved 1 week add
42+
43+
-e RSLSYNC_TRASH_TIME=7
44+
45+
to the docker start command.
46+
47+
### RSLSYNC_SIZE
48+
49+
This variable defines the maximum size of files to be synced. The variable is defined in MB and the default value is 1000 MB (1GB).
50+
51+
To change maxmimum file size to 50 MB add
52+
53+
-e RSLSYNC_SIZE=50
54+
55+
to the docker start command
56+
57+
### syncing local files
58+
59+
Inside the container the /data is the default sync directory, to link this to a local file system you can use the **-v** flag
60+
61+
To sync the the directory /home/joe you can run
62+
63+
docker run -d -v /home/joe:/data -p 33333:33333 nimmis/resilio-sync
64+
65+
# web gui mode
66+
67+
This setting activates a web gui to configure the Resilio Sync client
68+
69+
### RSLSYNC_USER
70+
71+
This variable defines the username used to login to the web interface.
72+
73+
**Setting this variable activates the web gui mode.**
74+
75+
### RSLSYNC_PASS
76+
77+
This variable defines the password used to login to the web interface. If this variable is not defined or empty an random password will be generated. The password can be retrieved from the log.
78+
79+
docker run -d -e RSLSYNC_USER=joe --name sync -p 8888:8888 -p 33333:33333 nimmis/resilio-sync
80+
docker logs sync
81+
Run scripts in /etc/run_once
82+
WEBUI mode activated
83+
RSLSYNC_PASS not set, password generated, use M2FlMjNkOG as password
84+
85+
In this case you should login with user **joe** and password **M2FlMjNkOG**
86+
87+
# Sync mode
88+
89+
The sync mode version is made for syncing one directory only (you can manualy configure multiple directories), each directory (or sync point) need a uniq secret key. If you need several different directories synced, start a container for each directory
90+
91+
### RSLSYNC_SECRET
92+
93+
This variable contains the secret key fore this directory, if empty or missing a new secret key is generated. This key can then be used to start more sync klient for the data.
94+
95+
### RSLSYNC_PATH
96+
97+
This variable controls which folder is synced (default = /data) and comes in handy when using data containers.
98+
To use it add the necessary --volumes-from option and set the RSLSYNC_PATH value to a VOLUME path from the the data container:
99+
100+
docker run -d --volumes-from <data-container> -e RSLSYNC_PATH=/other/location/in/data/container --name sync -p 33333:33333 nimmis/resilio-sync
101+
102+
103+
### Run container on first sync node
104+
105+
The first nod creates a uniq secret used to sync all nodes, map the directory you wan't to be syncronized to /data in the container.
106+
107+
Example synk the directory /home/me/data on first nod giving it the name syncnode
108+
109+
docker run -d -v /home/me/data:/data --name sync -p 33333:33333 nimmis/resilio-sync
110+
111+
112+
to see the secret code to use on the other nodes, look at the log-output from the container
113+
114+
> docker logs -f sync
115+
Run scripts in /etc/run_once
116+
non-WEBUI mode activated, /data is synced
117+
add -e RSLSYNC_SECRET=AF2INNKYP672IGIIDTDWWVUBGP2AQRFKX to your other nodes to sync
118+
Run scripts is /etc/run_always
119+
Started runsvdir, PID is 14
120+
wait for processes to start....
121+
rsyslogd: imklog: cannot open kernel log (/proc/kmsg): Operation not permitted.
122+
rsyslogd: activation of module imklog.so failed [v8.18.0 try http://www.rsyslog.com/e/2145 ]
123+
run: rslsync: (pid 19) 5s
124+
run: crond: (pid 20) 5s
125+
run: rsyslogd: (pid 21) 5s
126+
127+
press CTRL-C to exit log
128+
129+
## run container on more sync nodes
130+
131+
To get the other nodes to sync with the first, they have to have the same secret key.
132+
You add the key with -e RSLSYNC_SECRET=<secret key>, start with the secret code created
133+
by the first sync container. The local director does not have to be the same as on the
134+
first container but all sub-folders will be the same. So starting a second sync container
135+
on another docker machine using local directory /home/you/sync-backup and using the secret
136+
key obtained from the first sync node example above
137+
138+
docker run -d -v /home/you/sync-backup:/data --name syncnode2 -P 33333:33333 -e RSLSYNC_SECRET=AF2INNKYP672IGIIDTDWWVUBGP2AQRFKX nimmis/resilio-sync
139+
140+
NOTE!!!!! DO NOT USE the secret key in this example, use the one you got from the first sync node run.
141+

‎README.md

+1-141
Original file line numberDiff line numberDiff line change
@@ -1,141 +1 @@
1-
BitTorrent Sync using Resilio Sync
2-
==================================
3-
4-
![](https://img.shields.io/docker/pulls/nimmis/resilio-sync.svg)
5-
6-
This is a small container [![](https://images.microbadger.com/badges/image/nimmis/resilio-sync.svg)](https://microbadger.com/images/nimmis/resilio-sync "Get your own image badge on microbadger.com") using Resilio Sync client to syncronize data between clients.
7-
8-
Sync skips the cloud and finds the shortest path between devices when transferring data. No Cloud. No uploading to third party servers. Just fast, simple file syncing.
9-
10-
Based on my alpine micro container with glibc [![](https://images.microbadger.com/badges/image/nimmis/alpine-glibc.svg)](https://microbadger.com/images/nimmis/alpine-glibc "Get your own image badge on microbadger.com") please visit [nimmis/alpine-glibc](https://registry.hub.docker.com/u/nimmis/alpine-glibc/) for more information.
11-
12-
This container can run in two different mode:
13-
14-
* web gui mode, all configuration done thru a web interface
15-
* sync mode, sync predefined directory with secret key supplied or generated
16-
17-
# Global settings
18-
19-
These setting applies to both web gui and sync mode
20-
21-
### RSLSYNC_NAME
22-
23-
This variable defines the name shown on other nodes, if not defined it will get the name shown with the command *hostname*
24-
25-
This will start a container with then name **database**
26-
27-
docker run -d -e RSLSYNC_NAME=database -p 33333:33333 nimmis/resilio-sync
28-
29-
### RSLSYNC_TRASH
30-
31-
This variable defines if files removed from sync slaves should be put in an archive folder for a time defined by the variable **RSLSYNC&#95;TRASH&#95;TIME** before removed.
32-
33-
Default value is **true**, to disable this feature add
34-
35-
-e RSLSYNC_TRASH=false
36-
37-
to the docker start command
38-
39-
### RSLSYNC&#95;TRASH_TIME
40-
41-
This variable defines how many days a file will be kept in the achive folder before it is removed. The variable is defined i days and the default value is 30 days. To change the time so achive files are saved 1 week add
42-
43-
-e RSLSYNC_TRASH_TIME=7
44-
45-
to the docker start command.
46-
47-
### RSLSYNC_SIZE
48-
49-
This variable defines the maximum size of files to be synced. The variable is defined in MB and the default value is 1000 MB (1GB).
50-
51-
To change maxmimum file size to 50 MB add
52-
53-
-e RSLSYNC_SIZE=50
54-
55-
to the docker start command
56-
57-
### syncing local files
58-
59-
Inside the container the /data is the default sync directory, to link this to a local file system you can use the **-v** flag
60-
61-
To sync the the directory /home/joe you can run
62-
63-
docker run -d -v /home/joe:/data -p 33333:33333 nimmis/resilio-sync
64-
65-
# web gui mode
66-
67-
This setting activates a web gui to configure the Resilio Sync client
68-
69-
### RSLSYNC_USER
70-
71-
This variable defines the username used to login to the web interface.
72-
73-
**Setting this variable activates the web gui mode.**
74-
75-
### RSLSYNC_PASS
76-
77-
This variable defines the password used to login to the web interface. If this variable is not defined or empty an random password will be generated. The password can be retrieved from the log.
78-
79-
docker run -d -e RSLSYNC_USER=joe --name sync -p 8888:8888 -p 33333:33333 nimmis/resilio-sync
80-
docker logs sync
81-
Run scripts in /etc/run_once
82-
WEBUI mode activated
83-
RSLSYNC_PASS not set, password generated, use M2FlMjNkOG as password
84-
85-
In this case you should login with user **joe** and password **M2FlMjNkOG**
86-
87-
# Sync mode
88-
89-
The sync mode version is made for syncing one directory only (you can manualy configure multiple directories), each directory (or sync point) need a uniq secret key. If you need several different directories synced, start a container for each directory
90-
91-
### RSLSYNC_SECRET
92-
93-
This variable contains the secret key fore this directory, if empty or missing a new secret key is generated. This key can then be used to start more sync klient for the data.
94-
95-
### RSLSYNC_PATH
96-
97-
This variable controls which folder is synced (default = /data) and comes in handy when using data containers.
98-
To use it add the necessary --volumes-from option and set the RSLSYNC_PATH value to a VOLUME path from the the data container:
99-
100-
docker run -d --volumes-from <data-container> -e RSLSYNC_PATH=/other/location/in/data/container --name sync -p 33333:33333 nimmis/resilio-sync
101-
102-
103-
### Run container on first sync node
104-
105-
The first nod creates a uniq secret used to sync all nodes, map the directory you wan't to be syncronized to /data in the container.
106-
107-
Example synk the directory /home/me/data on first nod giving it the name syncnode
108-
109-
docker run -d -v /home/me/data:/data --name sync -p 33333:33333 nimmis/resilio-sync
110-
111-
112-
to see the secret code to use on the other nodes, look at the log-output from the container
113-
114-
> docker logs -f sync
115-
Run scripts in /etc/run_once
116-
non-WEBUI mode activated, /data is synced
117-
add -e RSLSYNC_SECRET=AF2INNKYP672IGIIDTDWWVUBGP2AQRFKX to your other nodes to sync
118-
Run scripts is /etc/run_always
119-
Started runsvdir, PID is 14
120-
wait for processes to start....
121-
rsyslogd: imklog: cannot open kernel log (/proc/kmsg): Operation not permitted.
122-
rsyslogd: activation of module imklog.so failed [v8.18.0 try http://www.rsyslog.com/e/2145 ]
123-
run: rslsync: (pid 19) 5s
124-
run: crond: (pid 20) 5s
125-
run: rsyslogd: (pid 21) 5s
126-
127-
press CTRL-C to exit log
128-
129-
## run container on more sync nodes
130-
131-
To get the other nodes to sync with the first, they have to have the same secret key.
132-
You add the key with -e RSLSYNC_SECRET=<secret key>, start with the secret code created
133-
by the first sync container. The local director does not have to be the same as on the
134-
first container but all sub-folders will be the same. So starting a second sync container
135-
on another docker machine using local directory /home/you/sync-backup and using the secret
136-
key obtained from the first sync node example above
137-
138-
docker run -d -v /home/you/sync-backup:/data --name syncnode2 -P 33333:33333 -e RSLSYNC_SECRET=AF2INNKYP672IGIIDTDWWVUBGP2AQRFKX nimmis/resilio-sync
139-
140-
NOTE!!!!! DO NOT USE the secret key in this example, use the one you got from the first sync node run.
141-
1+
https://firepress.org/en/container-as-an-external-hard-drive/

‎unit-test.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
trap 'echo "Aborting due to errexit on line $LINENO. Exit code: $?" >&2' ERR
5+
set -o errtrace
6+
set -o nounset
7+
8+
###############################################################################
9+
# Functions
10+
###############################################################################
11+
12+
# UAT (User Acceptance Testing)
13+
# By Pascal Andy @askpascalandy 2017-10-02_21h04
14+
15+
CTN_NAME="resilio-UAT"
16+
IMG_TO_TEST="devmtl/resilio:2.6.3"
17+
18+
TEST_01="uname -a"
19+
TEST_02="ls -AlhF /"
20+
TEST_03="rslsync --help"
21+
22+
23+
echo; echo "--- Unit Test for image: <$IMG_TO_TEST> - Start ---"; echo;
24+
25+
#1
26+
docker run -it --rm --name $CTN_NAME \
27+
$IMG_TO_TEST \
28+
$TEST_01; echo; sleep 0.1;
29+
30+
#2
31+
docker run -it --rm --name $CTN_NAME \
32+
$IMG_TO_TEST \
33+
$TEST_02; echo; sleep 0.1;
34+
35+
#3
36+
docker run -it --rm --name $CTN_NAME \
37+
$IMG_TO_TEST \
38+
$TEST_03; echo; sleep 0.1;
39+
40+
41+
echo; echo "--- Unit Test for image: <$IMG_TO_TEST> - End ---"; echo;

0 commit comments

Comments
 (0)
Please sign in to comment.