Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
suda committed Jul 8, 2018
1 parent c0ecc10 commit e72ee7a
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,3 @@
# Contributing

To start contributing, please start with going through [issues](issues) and create a new ticket or contribute to an existing one .
136 changes: 136 additions & 0 deletions README.md
@@ -0,0 +1,136 @@
<h1 align="center">
<br>
<img height="100" alt="dvsync" src="media/logo.png">
<br>
<br>
<br>
</h1>

> Easy and secure way to copy data between Docker volumes, even across VPCs or data centers.
`dvsync` is a set of two containers running [OpenSSH](https://www.openssh.com/), [ngrok](https://ngrok.com/) and [rsync](https://rsync.samba.org/) that automatically create a secure, encrypted channel between each other and enable easy way to migrate data stored in Docker volumes.

**Client:** [![dvsync-client](https://quay.io/repository/suda/dvsync-client/status "Docker Repository on Quay")](https://quay.io/repository/suda/dvsync-client) **Server:** [![dvsync-client](https://quay.io/repository/suda/dvsync-server/status "Docker Repository on Quay")](https://quay.io/repository/suda/dvsync-server)

<hr />

![](media/dvsync.gif)

# Running

⚠️ **To establish a secure channel, `dvsync` uses [ngrok](https://ngrok.com/) and you need to pass your `NGROK_AUTHTOKEN` which can be found in [ngrok dashboard](https://dashboard.ngrok.com/auth).**

`dvsync` will synchronize contents of its `/data` directory, therefore whatever data you want to sync, should be mounted under it.

Here are example ways to run it using [Docker CLI](#docker-cli), [Docker Compose / Swarm](#docker-compose--swarm) or [Kubernetes](#kubernetes). Note that you can mix those, making data migration much easier.

## Docker CLI

1. Start a server where you want to copy data **from**:
```sh
$ run --rm -e NGROK_AUTHTOKEN="$NGROK_AUTHTOKEN" \
--mount source=MY_SOURCE_VOLUME,target=/data,readonly \
quay.io/suda/dvsync-server
```

2. Once the server started, look into the logs and copy the `DVSYNC_TOKEN`
3. Start the client where you want tot copy the data **to**:
```sh
$ run --rm -e DVSYNC_TOKEN="$DVSYNC_TOKEN" \
--mount source=MY_TARGET_VOLUME,target=/data \
quay.io/suda/dvsync-client
```

#### Using local source/target
Alternatively, if you want to copy this data to your local machine, you can mount a host directory as well:

```sh
$ run --rm -e DVSYNC_TOKEN="$DVSYNC_TOKEN" \
-v $PWD:/data \
quay.io/suda/dvsync-client
```
This can also be done other way around, when you start the server locally if you need to copy local data into the data center.

## Docker Compose / Swarm

1. Start a server where you want to copy data **from**:
```yaml
version: '3.6'
services:
dvsync-server:
image: 'quay.io/suda/dvsync-server'
environment:
NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN}
volumes:
- type: volume
source: MY_SOURCE_VOLUME
target: /data
read_only: true
volumes:
MY_SOURCE_VOLUME:
```

2. Once the server started, look into the logs and copy the `DVSYNC_TOKEN`
3. Start the client where you want tot copy the data **to**:
```yaml
version: '3.6'
services:
dvsync-server:
image: 'quay.io/suda/dvsync-client'
environment:
DVSYNC_TOKEN: ${DVSYNC_TOKEN}
volumes:
- type: volume
source: MY_TARGET_VOLUME
target: /data
volumes:
MY_SOURCE_VOLUME:
```

## Kubernetes

1. Start a server where you want to copy data **from**:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: dvsync-server
spec:
containers:
- image: quay.io/suda/dvsync-server
name: dvsync-server
env:
- name: NGROK_AUTHTOKEN
value: "REPLACE WITH YOUR NGROK_AUTHTOKEN"
volumeMounts:
- mountPath: /data
name: MY_SOURCE_VOLUME
volumes:
- name: MY_SOURCE_VOLUME
```
2. Once the server started, look into the logs and copy the `DVSYNC_TOKEN`
3. Start the client where you want tot copy the data **to**:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: dvsync-client
spec:
containers:
- image: quay.io/suda/dvsync-client
name: dvsync-client
env:
- name: DVSYNC_TOKEN
value: "REPLACE WITH YOUR DVSYNC_TOKEN"
volumeMounts:
- mountPath: /data
name: MY_TARGET_VOLUME
volumes:
- name: MY_TARGET_VOLUME
```

# Contributing

[All contributions (no matter if small) are always welcome](http://contributionswelcome.org/).

To see how you can help and where to start [see Contributing file](CONTRIBUTING.md).
4 changes: 2 additions & 2 deletions docker-compose.yml
@@ -1,7 +1,7 @@
version: '3.6'
services:
dvsync-server:
image: 'suda/dvsync-server'
image: 'quay.io/suda/dvsync-server'
build:
context: .
dockerfile: Dockerfile.server
Expand All @@ -11,7 +11,7 @@ services:
- ${PWD}/out:/data

dvsync-client:
image: 'suda/dvsync-client'
image: 'quay.io/suda/dvsync-client'
build:
context: .
dockerfile: Dockerfile.client
Expand Down
Binary file added media/dvsync.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e72ee7a

Please sign in to comment.