[GUIDE] ownCloud on WD My Cloud

What is ownCloud?

ownCloud is the most straightforward way to file sync and share data. You don’t need to worry about where or how to access your files. With ownCloud all your data is where ever you are; accessible on all devices, any time.

There’s several ways to install it. I’ll show you the easiest way with Docker Compose.
First install a recent version of Docker on your WD My Cloud device.

Then get Docker Compose with these SSH commands.

dc=/shares/Volume_1/Nas_Prog/docker/docker/docker-compose
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname - m) -o $dc
chmod +x $dc
ln -sf $dc /sbin/docker-compose

Now prepare your ownCloud setup, based on this.
I added an offset of 10000 to the HTTP(S) ports as the WD web interface occupies port 80 and 443.
and I’d suggest you pick a better admin password…

cd /shares/Volume_1/Nas_Prog
mkdir owncloud && cd owncloud

cat << EOF >| .env
OWNCLOUD_VERSION=10.0
OWNCLOUD_DOMAIN=localhost
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
HTTP_PORT=10080
HTTPS_PORT=10443
EOF

wget -O docker-compose.yml https://raw.githubusercontent.com/owncloud-docker/server/master/docker-compose.yml

Finally start the containers in the background

docker-compose up -d

Voila, ownCloud is running at http://yourIP:10080 and at https://yourIP:10443

How to access the existing data on your shares?

This is a bit more complex.

First enable local storage in the owncloud config.
It is located in /shares/Volume_1/Nas_Prog/_docker/volumes/owncloud_files/_data/config/config.php
Add this line (e.g. right after the datadirectory line)

'files_external_allow_create_new_local' => 'true',

Then add your share to the volumes section in the docker compose file and add this new docker volume to the owncloud service.
As an example, I’m adding the Public (WD) share as the wd_public docker volume.
In the owncloud service, this volume is available at /mnt/wd_public

My docker-compose.yml file

version: '2.1'

volumes:
  files:
    driver: local
  mysql:
    driver: local
  backup:
    driver: local
  redis:
    driver: local
  wd_public:
    driver: local
    driver_opts:
      type: none
      device: "/shares/Public"
      o: bind

services:
  owncloud:
    image: owncloud/server:${OWNCLOUD_VERSION}
    restart: always
    ports:
      - ${HTTPS_PORT}:443
      - ${HTTP_PORT}:80
    depends_on:
      - db
      - redis
    environment:
      - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=owncloud
      - OWNCLOUD_DB_HOST=db
      - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
      - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
      - OWNCLOUD_UTF8MB4_ENABLED=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=redis
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - files:/mnt/data
      - wd_public:/mnt/wd_public

  db:
    image: webhippie/mariadb:latest
    restart: always
    environment:
      - MARIADB_ROOT_PASSWORD=owncloud
      - MARIADB_USERNAME=owncloud
      - MARIADB_PASSWORD=owncloud
      - MARIADB_DATABASE=owncloud
      - MARIADB_MAX_ALLOWED_PACKET=128M
      - MARIADB_INNODB_LOG_FILE_SIZE=64M
      - MARIADB_INNODB_LARGE_PREFIX=ON
      - MARIADB_INNODB_FILE_FORMAT=Barracuda
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - mysql:/var/lib/mysql
      - backup:/var/lib/backup

  redis:
    image: webhippie/redis:latest
    restart: always
    environment:
      - REDIS_DATABASES=1
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - redis:/var/lib/redis

Update your containers with this command

docker-compose up -d

Now open the owncloud web interface, go to settings, storage.
Add Storage with type Local and use the path /mnt/wd_public.

Enjoy!

This looks amazing!
Has anyone tried this on WD MyCloud EX2?
How is the performance?

Thank you for the excellent guide!