MoinMoin in Production on CoreOS - Part10: BitTorrent Sync between IDCF Cloud and Vultr
Posted on
I'm making plans to migrate my MoinMoin from Sakura VPS to Vultr. I could mostly done those preparations. One of the remaining works is to backup MoinMoin pages data and sync data between multi-clouds. I decited to use a syncing technology of BitTorrent Sync following a CenturyLink Labs tutorial. My first goal is to sync data between Vultr and IDCF Cloud both are sit on CoreOS.
I’m making plans to migrate my MoinMoin from Sakura VPS to Vultr. I could mostly done those preparations. One of the remaining works is to backup MoinMoin pages data and sync data between multi-clouds. I decited to use a syncing technology of BitTorrent Sync following a CenturyLink Labs tutorial. My first goal is to sync data between Vultr and IDCF Cloud both are sit on CoreOS.
1st IDCF cloud instance using DropboxUploader
The first thing to do is to run a BitTorrent Sync client container from ctlc/btsync image. After finihsed running a container, it is provided a secret key to use in all of the sync containers. The secret key can be got via a docker logs command.
$ docker run -d --name moin-btsync ctlc/btsync $ docker logs moin-btsync Starting btsync with secret: xxx
I write a command file using DropboxUploader. In this script, I download the latest backuped MoinMoin archive from Dropbox and untar to BitTorrent Sync directory.
~/bin/moin-update
#!/usr/bin/env bash set -eo pipefail BACKUP_DIR=moin_backup cd /tmp LATEST_FILE=$(dropbox_uploader.sh list /$BACKUP_DIR | tail -n +2 | awk '{print $3}' | sort -nr | head -1) dropbox_uploader.sh download /$BACKUP_DIR/$LATEST_FILE docker run -it --rm --volumes-from moin-btsync ubuntu rm -fr /data/* docker run --rm --volumes-from moin-btsync -v $(pwd):/backup ubuntu tar zxvf /backup/$LATEST_FILE --strip-components=1 -C /data rm /tmp/$LATEST_FILE
2nd Vultr instance via moin@.service
Another BitTorrent Sync container is deployed to Vulter via fleet unit file. I change data volume container for MoinMoin from my own image to ctlc/btsync image.
~/docker_apps/moin/moin@.service
[Unit] Description=MoinMoin Service Requires=docker.service After=docker.service
I revise the Dockerfile as data volume to /data directory adjusting to ctlc/btsync container. In addition, this version of Nginx is configured with SSL, although using s self-signed certificate.
~/docker_apps/moin/Dockerfile
FROM ubuntu:14.04 MAINTAINER Masato Shimizu <ma6ato@gmail.com> ENV HOME /root ENV WORKDIR /root
RUN sed -i~ -e 's/archive.ubuntu.com/ftp.jaist.ac.jp/' /etc/apt/sources.list && \ apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -qy language-pack-ja
ENV LANG ja_JP.UTF-8 RUN locale-gen $LANG && update-locale $LANG && \ ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime