Run your ownCloud on any server with Containers and Cloud 66

Tired of file sharing/sync/cloud services like iCloud and Dropbox? Maybe you want to have more control over your own assets. Why don't you run your own service using ownCloud?

This blog post will guide you how to run your ownCloud? on any server with Containers and Cloud 66.

ownCloud?

ownCloud is a self-hosted file sync and share server. It provides access to your data through a web interface, sync clients or WebDAV while providing a platform to view, sync and share across devices easily — all under your control.

ownCloud’s open architecture is extensible via a simple but powerful API for applications and plugins and it works with any storage.

Let play locally

To just play around with ownCloud on your local box, just install docker and docker-compose (instructions here) and use the following docker-compose.yml.

version: '3.1'  
services:  
  owncloud:
    # use the latest version of owncloud
    image: owncloud:10.0.2
    ports:
      # bind ownCloud's port 80 to port 8080
      - 8080:80

Run docker-compose up and hit the end-point http://localhost:8080 and the first thing is to create an admin username and password.

Install the Desktop Client on your Mac/PC/Linux box and connect to the running ownCloud server.

  • Enter your endpoint.

  • Enter your credentials.

  • Start syncing and sharing your files.

NOTE

In this example, SQLite will be used as a database.
For larger installations (production), we recommend choosing a different database backend. Especially when using the desktop client for file syncing the use of SQLite is discouraged.

Running on any server in production.

Deploy to any server

It's time to run it in production on any cloud provider or on your own server.

Good to know, we are going to deploy ownCloud on our Cloud 66 for Containers offering. Cloud 66 for Containers is a complete solution for building, running and maintaining containerized apps in production. Allowing you to run a multi-tenant setup on your own server(s).

services:  
  owncloud:
    image: owncloud:10.0.2
    # map the ports to HTTP/HTTPS
    ports: 
      - 80:80:443
    volumes:
      # make sure we store the data on the host and not in the container
      - "/mnt/datastore:/var/www/html/data"
databases:  
  # we are going to use mysql as a backend!
  - mysql

A service.yml is Cloud 66 service definition file to tell which services we want to run on our infrastructure. Want to know more about service.yml? Check our documentation.

Given the ephemeral nature of containers, it’s important to consider storage solutions to avoid data loss. That's the reason you find the volume statement in service.yml

volumes:  
      - "/mnt/datastore:/var/www/html/data"

  • Choose to deploy in a production environment

  • Choose which provider you want to deploy (make sure you entered your provider credentials) or bring your own server using our registered server feature.

Hit deploy! and wait until we done with all the heavy lifting. After a couple of minutes, you deployed ownCloud!

Setup ownCloud

When you hit visit Site you can setup ownCloud. Like in the local example we enter our username and password and we hit configure Database. We choice MySql and enter the credentials you find in the Mysql info page.

  • Information page our MySQL

Use the private IP, DB name, DB App Username, DB App Password for the ownCloud MySQL credentials.

Fill out all the information and hit Finish setup! Congratulations, you running your own Cloud service.

Securing ownCloud with SSL

Of course, this installment is not secure because we are using HTTP and not HTTPS. Cloud 66 support Let's Encrypt (FREE!) SSL or bring your own SSL.

We take care of all the heavy lifting and when the SSL certificate is created and installed, you have your ownCloud running with SSL!

Look the green lock ;-)

Multi Tenancy for Stacks

Sometimes you need to run multiple applications on the same server. This could be because none of those applications have enough traffic to justify having a dedicated stack for itself or it could be because all the apps on the stack share many resources. What ever the reason, you can achieve multi-tenancy for your stacks with Cloud 66 for Containers.

Just add a traffic_matches: ["yourdomain.com"] to you service.yml and the traffic is redirected to the right service on your cluster.

services:  
  owncloud:
    image: owncloud:10.0.2
    # only respond to request from yourdomain.com
    traffic_matches: ["yourdomain.com"]`
    # map the ports to HTTP/HTTPS
    ports: 
      - 80:80:443
    volumes:
      # make sure we store the data on the host and not in the container
      - "/mnt/datastore:/var/www/html/data"
databases:  
  # we are going to use mysql as a backend!
  - mysql

Cloud 66 provides a lot of extra services like database management (backups/restores), scaling your databases, your services and servers and a complete CI/CD pipeline for your own containerized apps.

For now, enjoy your ownCloud!

Summary

That was a fun ride running ownCloud on any server with Containers and Cloud 66. Give us a spin a let us know what you think of our services.

Try Cloud 66 for Free, No credit card required