This PR introduce POC of Nextcloud based on Nginx web server with php-fpm in separated container.
Basic installation with SQLite and few operations in web gui were tested.
Nginx dockerfile is generated from Dockerfile-nginx.template
- FROM string has hardcoded variant - apache
- There is no upstream PHP image with Nginx, due this generate-stackbrew-library is not able to identify parent correctly
New files were introduced in image:
- Dockerfile-nginx.template
- nginx-foreground
+ simulates behavior of apache2-foreground cmd
- 16.0/nginx/Dockerfile
+ generated from template Dockerfile-nginx.template
- nextcloud.confx
+ Nginx vhost configuration
- start_net.sh (temporary)
+ Helper script to create user-defined network for Docker
+ '--link' option for docker create is obsolete and we need communication between fpm and nginx container
- start_container.sh (temporary)
+ Helper script to handle containers
- Dockerfile
+ /Dockerfile for verification purposes
Updated files:
- set -x added to all shell scripts for easier troubleshooting (temporary)
- update.sh
+ New variant introduced
+ Number of builded variant is limited for simplified CI.
- .travis.yml (temporary)
+ Image push to registry for testing purposes
- docker-entrypoint.sh
+ Recognizes new argument for entrypoint - nginx-foreground
Be careful during review, github recognizes removed files for 15.0 release as renamed to 16.0/nginx variant
Motivation/Usecase:
- I have openvz based VPS where only old Docker 1.10 is supported.
- Apache(in nextcloud container) in combination Nginx as a reverse proxy for multiple vhosts doesn't work correctly
Image pull link:
docker pull 1john2ci/nextcloud:apache-20190509
docker pull 1john2ci/nextcloud:fpm-20190509
Travis CI test: https://travis-ci.org/1john2/docker/builds/530329740
Deployment notes:
- Clone source code
- Create user-defined network for Docker
- Start fpm container
- Start nginx container
This commit updates the directory permissions to be more compatible when
running the image without root f.e. on OpenShift or when specifying it
when running with `docker run --user www-data:root ...`.
It adds detection logic to the entrypoint script as sudo is not always
allowed.
This change in directory permissions was also proposed by the official
documentation, see https://github.com/nextcloud/documentation/commit/22e2530.
The `chown` before the volume definition is needed to prepare the volume
as it inherits the permissions.
refs https://github.com/nextcloud/docker/issues/107
When Nextcloud performs an upgrade or clean installation,
it will check whether /var/www/html/{config,data,custom_apps,themes} exist.
If not, it will copy
/usr/src/nextcloud/{config,data,custom_apps,themes} to /var/www/html.
This leads to a problem: If those subdirectories are existent but
empty, it will not do the copy. This situation is common when you mount
volumes to those subdirectories, like:
```
version: "2.1"
services:
app:
image: nextcloud:12-apache
volumes:
- nextcloud:/var/www/html:Z
- nextcloud-custom_apps:/var/www/html/custom_apps:Z
- nextcloud-config:/var/www/html/config:Z
- nextcloud-data:/var/www/html/data:Z
- nextcloud-themes:/var/www/html/themes:Z
ports:
- 8080:80/tcp
db:
image: mariadb
volumes:
- db:/var/lib/mysql:Z
environment:
MYSQL_USER: nextcloud
MYSQL_DATABASE: nextcloud
MYSQL_PASSWORD: nextcloud
MYSQL_ROOT_PASSWORD: nextcloud
volumes:
nextcloud:
nextcloud-custom_apps:
nextcloud-config:
nextcloud-data:
nextcloud-themes:
db:
```
This patch will fix this issue by copying to those subdirectories when they
are empty.