0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-06-16 16:14:47 +02:00

POC: Introduce Nextcloud based on Nginx web server.

UPDATE:
 - stack.yml contains FPM & Mariadb containers, updated volumes, networking and hostnames for container
TODO:
 - update config.ini for trusted proxies support

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: 530329740

Deployment notes:
  - Clone source code
  - Create user-defined network for Docker
  - Start fpm container
  - Start nginx container
This commit is contained in:
Malanik Jan 2019-05-12 12:15:15 +02:00
parent a3366b08c4
commit 101f4aa7e3
7 changed files with 81 additions and 47 deletions

View file

@ -4,6 +4,7 @@ services: docker
branches: branches:
only: only:
- master - master
- Nginx
install: install:
- git clone https://github.com/docker-library/official-images.git ~/official-images - git clone https://github.com/docker-library/official-images.git ~/official-images
@ -30,16 +31,16 @@ after_script:
# ## # ##
# For testing purposes only # For testing purposes only
# ## # ##
- echo "1john2_password" | docker login -u "1john2ci" --password-stdin - echo "${DOCKER_PASSWORD}" | docker login -u "1john2" --password-stdin
- docker tag nextcloud:16.0-apache 1john2ci/nextcloud:16.0-apache - docker tag nextcloud:16.0-apache 1john2/nextcloud:16.0-apache
- docker push 1john2ci/nextcloud:16.0-apache - docker push 1john2/nextcloud:16.0-apache
- docker tag nextcloud:16.0-nginx 1john2ci/nextcloud:16.0-nginx - docker tag nextcloud:16.0-nginx 1john2/nextcloud:16.0-nginx
- docker push 1john2ci/nextcloud:16.0-nginx - docker push 1john2/nextcloud:16.0-nginx
- docker tag nextcloud:16.0-fpm-full 1john2ci/nextcloud:16.0-fpm-full - docker tag nextcloud:16.0-fpm-full 1john2/nextcloud:16.0-fpm-full
- docker push 1john2ci/nextcloud:16.0-fpm - docker push 1john2/nextcloud:16.0-fpm-full
jobs: jobs:
include: include:

View file

@ -160,6 +160,5 @@ RUN set -ex; \
COPY *.sh upgrade.exclude / COPY *.sh upgrade.exclude /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View file

@ -152,6 +152,5 @@ RUN set -ex; \
COPY *.sh upgrade.exclude / COPY *.sh upgrade.exclude /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

View file

@ -8,7 +8,7 @@
# ## # ##
upstream php-handler { upstream php-handler {
server fpm-ncd:9000; server nextcloud-fpm:9000;
} }
server { server {

View file

@ -151,6 +151,5 @@ RUN set -ex; \
COPY *.sh upgrade.exclude / COPY *.sh upgrade.exclude /
COPY config/* /usr/src/nextcloud/config/ COPY config/* /usr/src/nextcloud/config/
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["%%CMD%%"] CMD ["%%CMD%%"]

View file

@ -8,7 +8,7 @@
# ## # ##
upstream php-handler { upstream php-handler {
server fpm-ncd:9000; server nextcloud-fpm:9000;
} }
server { server {

106
stack.yml
View file

@ -1,54 +1,90 @@
version: '3.2' version: '2.0'
# ##
# Configure:
# export COMPOSE_HTTP_TIMEOUT=1000
# If you experience timeouts in UnixHTTPConnectionPool function during parallel execution
# This can happen in shared env with high load - VPS
# ##
services: services:
db: database:
name: mariadb container_name: database
hostname: db hostname: database
image: mariadb image: mariadb:10.4.4-bionic
tag: 10.4.4-bionic
restart: always restart: always
volumes: volumes:
- db:/var/lib/mysql - /srv/mariadb:/var/lib/mysql:rprivate
networks:
nextcloud:
environment: environment:
- MYSQL_ROOT_PASSWORD=mariadb_admin - MYSQL_ROOT_PASSWORD=mariadb_admin
- MYSQL_DATABASE=nextcloud - MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud_admin - MYSQL_USER=nextcloud_admin
- MYSQL_PASSWORD=nextcloud_admin - MYSQL_PASSWORD=nextcloud_admin
fpm: nextcloud-fpm:
name: fpm container_name: nextcloud-fpm
hostname: fpm hostname: nextcloud-fpm
image: 1john2ci/nextcloud image: 1john2/nextcloud:16.0-fpm-full
tag: 16.0-fpm-full
restart: always restart: always
volumes:
- nextcloud:/var/www/html
app:
name: nextcloud
hostname: nextcloud
image: 1john2ci/nextcloud
tag: 16.0-nginx
restart: always
ports:
- 127.0.0.1:8080:80
volumes:
- nextcloud:/var/www/html
environment: environment:
- MYSQL_DATABASE=nextcloud - MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud_admin - MYSQL_USER=nextcloud_admin
- MYSQL_PASSWORD=nextcloud_admin - MYSQL_PASSWORD=nextcloud_admin
- MYSQL_HOST=db - MYSQL_HOST=database
depends_on: - NEXTCLOUD_ADMIN_USER=admin
- db - NEXTCLOUD_ADMIN_PASSWORD=admin
- fpm - NEXTCLOUD_TRUSTED_DOMAINS=data.malanik.guru
cron: networks:
image: nextcloud nextcloud:
restart: always
volumes: volumes:
- nextcloud:/var/www/html - /srv/nextcloud:/var/www/html:rprivate
entrypoint: /cron.sh
depends_on: depends_on:
- db - database
nextcloud:
container_name: nextcloud
hostname: nextcloud
image: 1john2/nextcloud:16.0-nginx
restart: always
networks:
nextcloud:
ports:
- 127.0.0.1:8080:80
volumes:
- /srv/nextcloud:/var/www/html:rprivate
environment:
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud_admin
- MYSQL_PASSWORD=nextcloud_admin
- MYSQL_HOST=database
- NEXTCLOUD_ADMIN_USER=admin
- NEXTCLOUD_ADMIN_PASSWORD=admin
- NEXTCLOUD_TRUSTED_DOMAINS=data.malanik.guru
depends_on:
- database
- nextcloud-fpm
nextcloud-cron:
container_name: nextcloud-cron
hostname: nextcloud-cron
image: 1john2/nextcloud:16.0-nginx
restart: always
networks:
nextcloud:
entrypoint: /cron.sh
volumes:
- /srv/nextcloud:/var/www/html:rprivate
environment:
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud_admin
- MYSQL_PASSWORD=nextcloud_admin
- MYSQL_HOST=database
- NEXTCLOUD_ADMIN_USER=admin
- NEXTCLOUD_ADMIN_PASSWORD=admin
- NEXTCLOUD_TRUSTED_DOMAINS=data.malanik.guru
depends_on:
- database
volumes: volumes:
db: /srv/mariadb db: /srv/mariadb
nextcloud: /srv/nextcloud nextcloud: /srv/nextcloud
networks:
nextcloud: