-
Setup hardware (with BTRFS, preferably)
-
Install toolset:
apt-get install lxc tmux git
-
Configure
tmux
: -
Configure LXC
- Install LXC-to-the-Future
- Make LXC port forwardings
- Prepare a base container
- Restore (or make from scratch) the container settings in
/var/lib/lxc/*/config
- Start the containers with a 30 second delay just in case.
-
Install
watch-ip-change
to update public IP periodically. -
Monitor the disk health: https://github.com/ceremcem/monitor-btrfs-disk
-
Prepare for switching between master and slave modes:
-
In slave (backup) mode:
- CouchDB should run as normal. It will be in sync every time.
- Git server, file server and other servers should
rsync
periodically. - LXC container settings from master server should also be synced:
- LXC Port forwardings
- Container configurations
-
Switching to master mode:
Deciding if the node is master:
- Poll
dig +s master.example.com
- Compare with node's own public IP
- If matches, this node is now master.
- Stop slave mode sync
- Update
example.com
IP
- Poll
-
-
Be prepared for disk failures:
- TODO: Prepare a script to re-format, encrypt, set up RAID-1 and sync when a disk fails.
-
Monitor for intrusions:
- Fail-to-ban