Best practice to automatically backup remotely hosted server

给你一囗甜甜゛ 提交于 2020-01-01 07:23:05

问题


I am trying to setup a server for team note taking, and I am wondering what is the best way to backup its data, A.K.A my notes, automatically.

Currently I plan to run the server in a docker image.
The docker image will be hosted by a hosting service (such as Google).
I found a free hosting service that fits my need, but it does not allow mounting volumes to a docker image.
Therefore, I think the only way for me to backup my data is to transfer them to some other cloud services.
However, this requires that I have to store some sort of sensitive data for authentication in my docker image, apparently this is not cool.

So:

  1. Is it possible to transfer data from a docker image to a cloud service without taking the risk of leaking password/private key?

  2. Is there any other way to backup my data?
    I don't have to use docker as all I need is actually Node.js.
    But the server must be hosted on some remote machines because I don't have the ability/time/money to host a machine on my own...


回答1:


I use borg backup to backup our servers (including docker volumes) ... and it's saved the day many times due to failure and stupidity.

It transfers over SSH so comms are encrypted. The repositories it uses are also encrypted on disk so that makes all your data safe. It de-duplicates, snapshots, prunes, compresses ... the feature list is quite large.

After the first backup, subsequent backups are much faster because it only submits the changes since the previous backup.

You can also mount the snapshots as filesystems so you can hunt down the single file you deleted or just restore the whole lot. The mounts can also be done remotely.

I've configured ours to backup /home, /etc and the /var/lib/docker/volumes directories (among others).

We rent a few cheap storage VPSs and send the data up to them nightly. They're in different geographic locations with different hosting providers, you know, because we're paranoid.




回答2:


Beside docker swarm secrets, don't forget bind mounts strategies: you could have your data in a volume.

In that case, you can have a backup strategy done on the host (instead of the container at runtime), which would take that volume, compress it and save it elsewhere. See for instance this answer or this one.



来源:https://stackoverflow.com/questions/48059793/best-practice-to-automatically-backup-remotely-hosted-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!