OwnCloud, as a FreeNAS plugin

What is OwnCloud? Its essentially a piece of file hosting software.

Similar in concept to Dropbox. It offers a multitude of ways to connect with other services such Amazon S3, Google Drive, etc. Its currently written in PHP, so it should not be exposed directly on the internet. Place it behind a VPN, or make it internal access only. It also offers desktop and mobile clients that do a moderately decent job of syncing/replicating files between devices.

What is FreeNAS and why is it useful? FreeNAS is a storage appliance that is based on FreeBSD. It offers numerous plugins, including OwnCloud, which provide near-push-button setup of various software pkgs. I use it for many things including OwnCloud, SMB/AFP sharing, NFS, and iSCSI.

Pre-reqs

Have a FreeNAS server installed (for this article, it is assumed you are installing OwnCloud as a FreeNAS plugin). I’m currently using FreeNAS 9.10.

Initial setup

Not much here. Click the ‘install’ button for the plugin. When the plugin is installed, you need to choose a place to store your data. I created a directory called ‘OwnCloud’ and and then mounted it on /media inside the plugin (use the web interface for the plugin jail). Now all your files will be stored outside the plugin (handy if you decided to get rid of the plugin, or if there are software issues down the road and you need to wipe out the plugin and start over).

Things you may need to do

Depending on what you’re doing, you may need to alter the Trust Domains. I added an entry to the array for the fqdn of the host. Then things worked as expected (with out this, connecting by domain name will silently fail).

/mnt/<zpool>/jails/owncloud_1/usr/pbi/owncloud-amd64/www/owncloud/config/config.php

My config.php ended up looking like this (minus things like secrets, salts, etc):

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'htaccess.RewriteBase' => '/',
  'instanceid' => 'instanceID',
  'passwordsalt' => 'nacl',
  'secret' => 'secret',
  'trusted_domains' =>
  array (
    '198.18.3.242', 'owncloud.cmhome',
  ),
  'datadirectory' => '/media',
  'overwrite.cli.url' => 'https://owncloud.cmhome',
  'dbtype' => 'sqlite3',
  'version' => '9.0.3.2',
  'logtimezone' => 'UTC',
  'installed' => true,
);

Client Setup

Point your browser at the download page for OwnCloud. After you run the installer, you should be presented with a window that looks similar to what is below. Follow your way through to setup your sync directories.

Note: If you want to have multiple folder syncs to the same server, you can do so. For example, I sync my Downloads and Documents directories.

Summary

I’m currently using this to sync a total of around 12G between my desktop and laptop. It works over VPN (remember, don’t expose your PHP on the internet) too.

Note: It doesn’t handle links of any kind, so you have to handle those yourself. I haven’t found it to be much of a problem. The one directory I have that uses them, I just did a quick rsync after OwnCloud was done and I’m done.

Footnotes and References