Install owncloud with docker, ZFS and ansible

I’ve been happily running FreeNAS on my server for quite some time now, I am a fan of ZFS and I’ve used it to great advantage both at home and at work.

After its good service and with ZFS on Linux becoming stable, I have decided to move away from FreeNAS and install a plain Ubuntu 16.04 server image to play with docker and ansible and enjoy destroying and re-spawning my ephemeral service instances in seconds!

Whether ansible and docker really are a natural fit is hard to say, with so many tools appearing on the horizon of service composition, but it seems good enough for my home use case (i.e., a small server that I use to run a few services for myself).

With ZFS as a base (everything happens on a zpool with a redundant vdev), datasets can be quickly prepared to be used as docker volumes. This gives the advantage of really managing the storage in a “software-defined” way, with the nice ZFS snapshot and send/receive tools to move your data around and do backups. Ansible brings it all together: with the docker module it is quite easy to provision containers and then wire them together and change the configuration as needed.

These days I wrote a playbook to setup owncloud with a mysql database and HTTPs, starting from the official owncloud and mysql containers from docker hub. My naive intention was to keep the images intact and change them after instantiation, with the hope that I will be able to use this playbook even when they get updated.

Here’s a diagram showing what the playbook deploys within the docker host (except the zpool which must be pre-provisioned):

ansible deployment

After the playbook runs, pointing the browser to

https://<docker-host-ip>:8001

should give you the login page to owncloud (admin credentials to be specified as an ansible variable).

Feel free to try, improve, blame it: https://github.com/vincepii/ansible-docker-owncloud

docker-owncloud

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s