Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Resilio within Docker containers #10

Closed
pascalandy opened this issue Dec 27, 2016 · 12 comments
Closed

Running Resilio within Docker containers #10

pascalandy opened this issue Dec 27, 2016 · 12 comments

Comments

@pascalandy
Copy link

pascalandy commented Dec 27, 2016

Hi,

Context

I discovered sync via this project https://github.com/nimmis/docker-btsync. It still works well but nimmis' project is not supported anymore since sync is now Resilio.

So I would prefer to use Resilio from the latest updates :) I'm trying to use the official project within Docker but it's not working yet.

At this point I only want to sync one directory named: pics. I will run another set of container if I want to share more directories.

Question - I guess I'm missing something right ?

///

This is how I would expect this project to work:

On my Linux Server:
mkdir -p /mnt/syncdata/sync
mkdir -p /mnt/syncdata/pics

On my mac:
mkdir -p /Users/andy/Documents/mnt/syncdata/pics
mkdir -p /Users/andy/Documents/mnt/syncdata/sync

1) Start the first Resilio (master) container

docker run -d --name syncmaster \
-p 8888:8888 \
-p 55555 \
-v /mnt/syncdata/sync:/mnt/sync \
-v /mnt/syncdata/pics:/mnt/pics \
--restart on-failure \
resilio/sync:release-2.4.4

2) Find the -e RSLSYNC_SECRET

docker exec syncmaster sh -c "cat /var/log/rslsync.log"

Question - I can't find the secret ID at the moment. So I don't understand how Minion nodes can communicate with the master.

... then copy paste: -e RSLSYNC_SECRET=ATLVGBCC4XUL4E7S3ZZ6UNS5Z2SZN2J7Y

3) Start minion containers

docker run -d --name syncminion1 \
-p 8888:8888 \
-p 55555 \
-v /Users/andy_lap/Documents/mnt/syncdata/sync:/mnt/sync \
-v /Users/andy_lap/Documents/mnt/syncdata/pics:/mnt/pics \
--restart on-failure \
resilio/sync:release-2.4.4

or ...

docker run -d --name syncminion1 \
-e RSLSYNC_SECRET=ATLVGBCC4XUL4E7S3ZZ6UNS5Z2SZN2J7Y \
-p 8888:8888 \
-p 55555 \
-v /Users/andy_lap/Documents/mnt/syncdata/sync:/mnt/sync \
-v /Users/andy_lap/Documents/mnt/syncdata/pics:/mnt/pics \
--restart on-failure \
resilio/sync:release-2.4.4

and so on ...

P.S. I don't mind using the GUI at this point.

Cheers!
twitter.com/_pascalandy

@pascalandy
Copy link
Author

pascalandy commented Dec 27, 2016

Also, do we need to copy-paste something (like a config) from the first container into other nodes ?

@roman-zanin
Copy link

@pascalandy

  1. Synd docker image is restricted to "/mnt/sync/folders", "/mnt/mounted_folders" folders inside container, therefore mounting /mnt/pics won't work.
  2. Current implementation of Sync docker image only allows to use WebUI to configure folders, it is not designed to used config as it resides inside /etc/ in container. You can attempt to run bash in container and manually adjust config file, though. We plan to change it in future and move config file to /mnt/sync, therefore it'll be accessible from real PC.

@pascalandy
Copy link
Author

pascalandy commented Jan 10, 2017

Thanks for the answer!

I wish the docker community could run only two containers to shuffle files around! Here is my two cents:

Directory to sync on the servers

MNT_myapp=/mnt/syncdata/myapp
mkdir -p $MNT_myapp
cd $MNT_myapp/ && ls -la

1) Master Node

CTN_resilio="resilio_myapp"
#
docker rm -f "$CTN_resilio"
sleep 1
#
docker run -d \
--name "$CTN_resilio" \
-v /mnt/syncdata/myapp:/data \
--restart=always \
-p 55555:55555 \
-e RSLSYNC_TOKEN="fancysecret_deb0e8cMmUzMG71baYTRc2a2806eac1e8MGQMzM3ZGQ3N2RlNDlmYmM" \
-e RSLSYNC_ROLE=master \
resilio/sync:2.4.4
#
sleep 4
docker logs -f $CTN_name

# Check the state of resilio in the logs. 
# Should be ready to sync with other containers.

2) Minion Nodes

CTN_resilio="resilio_myapp"
#
docker rm -f "$CTN_resilio"
sleep 1
#
docker run -d \
--name "$CTN_resilio" \
-v /mnt/syncdata/myapp:/data \
--restart=always \
-p 55555:55555 \
-e RSLSYNC_TOKEN="fancysecret_deb0e8cMmUzMG71baYTRc2a2806eac1e8MGQMzM3ZGQ3N2RlNDlmYmM" \
-e RSLSYNC_ROLE=minion \
resilio/sync:2.4.4

# Check the state of resilio in the logs. 
# Should see files that were synced.

What do you think?

Cheers!
https://twitter.com/_pascalandy

@roman-zanin
Copy link

You can do it with current implementation. Just ensure that the WebUI and listening ports do not intersect on your host.

@pascalandy
Copy link
Author

I would love to but I don't see how. I'll be very happy to put this in place :)

@roman-zanin
Copy link

Just run instances with different ports. For example, first instance will be started as:

docker run -d --name Sync1 \
  -p 8888:8888 -p 55555:55555 \
  -v $DATA_FOLDER:/mnt/sync \
  --restart on-failure \
  resilio/sync

Second instance as:

docker run -d --name Sync2\
  -p 8889:8888 -p 55556:55555 \
  -v $DATA_FOLDER:/mnt/sync \
  --restart on-failure \
  resilio/sync

@pascalandy
Copy link
Author

pascalandy commented Jan 13, 2017

In your example, how does the server 1 can talk with server 2? No key or anything ?

server 1

docker run -d --name Sync1 \
  -p 8888:8888 -p 55555:55555 \
  -v $DATA_FOLDER:/mnt/sync \
  --restart on-failure \
  resilio/sync

server 2

docker run -d --name Sync2\
  -p 8889:8888 -p 55556:55555 \
  -v $DATA_FOLDER:/mnt/sync \
  --restart on-failure \
  resilio/sync

@roman-zanin
Copy link

You can share key via webui of both instances.

@pascalandy
Copy link
Author

I tried many many many times. Delays, too many much clicks.
Nodes are up and down all the time, so as a docker devops guys, it does work for me :(

I would just love to run this, authorized minions from a token generated by the leader and call it a day.

@roman-zanin
Copy link

Got you. You can map one more extra folder, /etc and edit sync.conf file. See here for instructions on config file syntax.

In future, we plan to make it available so no additional mount required.

@pascalandy
Copy link
Author

Sounds promising. Please let me know when it's ready :)

@01e9
Copy link

01e9 commented Feb 21, 2018

It works fine, thank you for this image! Please keep it up-to-date.


I wan't to share my docker-compose.yml

# simplified example
services:
    my_app:
        # ...
        volumes:
            - "./volumes/app_data:/var/app_data"
    my_app_resilio:
        # ...
        image: resilio/sync
        volumes:
            - "./volumes/resilio:/mnt/sync"
            - "./volumes/IgnoreList:/mnt/mounted_folders/app/.sync/IgnoreList:ro"
            - "./volumes/app_data:/mnt/mounted_folders/app/app_data:ro"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants