HaVonTe1 / docker-bananapi-owncloud

An docker image to run an instance of owncloud on ARM SoC (Banana Pi)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-armh7-owncloud

An docker image to run an instance of owncloud on a Banana Pi

This project is a fork of docker-owncloud from greyltc.

Docker Banana Pi Owncloud
Docker (container engine) logo Front of Banana Pi Owncloud-logo

under construction

This project is currently under development and a lot of things are need to be done.

Features

  • Based on Archlinux for ARMv7 The Dockerfile and scripts to build the base image is part of a separated repository.
  • Running on Apache2 with PHP7 and a lot of performance tweaks
  • 100% TLS secured
  • ready for letsencrypt

How to build the docker image

Preparations (mostly optional)

  • install the mainline Kernel for Bananian to be able to run Docker at all
apt install linux-image-4.4-bananian

After restarting the Banana Pi your system should be ready.

  • install Docker Follow the instructions on the docker manuals.
    It´s the same like on plain Debian

No you should be ready to go:

docker build -t mygroupname/myimagename .

usage

most simply

docker run --hostname=$yourTLD --name owncloud -v $yourLocalDataDirWithLotOfSpace:/home/owncloud/data -p 443:443  -d havonte/owncloud-single
  • the hostname is mostly important if you want to use letsencrypt
  • you should $yourLocalDataDirWithLotOfSpace replace with a directory on your BananaPi with enough disk space. Remember: owncloud is designed for mass storage. The BananaPi runs on a SD with 64GB max. So it might be wisely to connect an external HDD.

In order to give the necessary permissions execute the following commands for your data path:

mkdir $yourLocalDataDirWithLotOfSpace
sudo chgrp 33 $yourLocalDataDirWithLotOfSpace
chmod 0770 $yourLocalDataDirWithLotOfSpace

Explanation: the owncloud inside the container runs with the httpd user which has the gid 33.

  • /home/owncloud/data replace this with any path you want. It will be created inside the container. But remember to set this path as data directory when you setup the owncloud.
  • Replace the name of the docker image at the end of the command with the image name you chosed when you built the image.

There are two other important owncloud directories:

  • apps - stores the owncloud apps and all their configurations
  • config - stores the config.php file

You can use the script `realocate-apps-dir.sh" to:

  • copy all files from the apps dir of a running oc container - see the script for variables
  • set necessary permissions to the local apps dir

composed with docker mariadb / postgres

docker-compose -f docker-compose-maria.yml up -d

This will bring up a new internal docker network, an instance of mariadb and the owncloud itself. The same is available for postgres.

as single instance with remote database

I prefer this because I dont like running databases in docker.

  • bring up your db (postgres prefered)
  • create a bridge network to be able to access the docker host if your database is running on that host
docker network create -d bridge --subnet 192.168.0.0/24 --gateway 192.168.0.1 dockernet
  • run owncloud with docker or docker-compose-single.yml
docker-compose -f docker-compose-single.yml -d

When you init your owncloud: the hostname of the dockerhost is 192.168.0.1

FAQ

Why running Owncloud in a docker container

Well, why use docker at all?

  • easy upgrades
  • easy parallel instances
  • easy port realocation of different services
  • ...
  • its fun

Why archlinux?

This distribution comes with the latest versions of all libs.

How to renew the certs of LetsEncrypt

This is a bit tricky at the moment. The used certbot renews the certs via a validation process which needs unsecures access to the webserver from the internet. Which mean no SSL and server running on port 80. To achieve this we need to restart the container with the following env:

      environment:
       - SUBJECT=/C=$COUNTRY/ST=B/L=CITY=/O=$USER/OU=UNIT/CN=$YOUR_PUBLIC_DOMAIN
       - VIRTUAL_HOST=$YOUR_PUBLIC_DOMAIN
       - DO_SSL_SELF_GENERATION=false
       - HOSTNAME=$YOUR_PUBLIC_DOMAIN
       - ALLOW_INSECURE=true ## very important
       - EMAIL=$EMAIL
       - TERM=xterm # certbot is very bitchy in docker...
     ports:
       - 443:443
       - 80:80 ## important

Just stop and restart your container with a temp. changed compose file with the abouve settings and inside the container run the following command:

certbot renew

Stop and restart your container with activated security.

TODOs / open issues

  • renewing the certbot / letsencryp certs is a pain...

About

An docker image to run an instance of owncloud on ARM SoC (Banana Pi)


Languages

Language:Shell 99.4%Language:PHP 0.6%