mirror of
https://github.com/nextcloud/docker.git
synced 2025-06-17 08:34:48 +02:00
POC: Introduce Nextcloud based on Nginx web server.
UPDATE:
- stack.yml contains FPM & Mariadb containers, updated names 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
Signed-off-by: Malanik Jan <malanik.jan@gmail.com>
This commit is contained in:
parent
e9432801ce
commit
a3366b08c4
7 changed files with 2284 additions and 46 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# ##
|
||||
# file name: start_ncd.sh
|
||||
# file name: start_container.sh_
|
||||
# Author: Malanik Jan
|
||||
# Email: malanik (_dot_) jan (_at_) gmail (_dot_) com
|
||||
# Description:
|
||||
|
@ -11,54 +11,63 @@ set -x
|
|||
|
||||
NAME=''
|
||||
NCD_VOL='/srv/nextcloud:/var/www/html:rprivate'
|
||||
TAG='20190509'
|
||||
#20190509 stable
|
||||
TAG='16.0'
|
||||
|
||||
read -p "Would you like to handle apache/nginx/fpm? [nginx/apache/fpm]" NAME
|
||||
read -p "Remove image? [y/n]" REMOVEIMAGE
|
||||
read -p "Start container? [y/n]" STARTCONTAINER
|
||||
if [ "${STARTCONTAINER}" == 'y' ]; then
|
||||
read -p "Do you want to start with /bin/sleep infinity? [y/n]" STARTSLEEP
|
||||
if [[ -z "${NCD_NAME}" ]]; then
|
||||
read -p "Would you like to handle apache/nginx/fpm? [nginx/apache/fpm]" NCD_NAME
|
||||
fi
|
||||
if [[ -z "${NCD_REMOVEIMAGE}" ]]; then
|
||||
read -p "Remove image? [y/n]" NCD_REMOVEIMAGE
|
||||
fi
|
||||
if [[ -z "${NCD_STARTCONTAINER}" ]]; then
|
||||
read -p "Start container? [y/n]" NCD_STARTCONTAINER
|
||||
fi
|
||||
|
||||
IMAGE="1john2ci/nextcloud:${NAME}-ncd-${TAG}"
|
||||
NAME="${NAME}-ncd"
|
||||
if [[ "${NCD_STARTCONTAINER}" == 't' ]] && [[ -z "${NCD_STARTSLEEP}" ]]; then
|
||||
read -p "Do you want to start with /bin/sleep infinity? [y/n]" NCD_STARTSLEEP
|
||||
fi
|
||||
|
||||
echo "Starting script with configuration:"
|
||||
for var in $(env | grep NCD); do
|
||||
echo ${var}
|
||||
done
|
||||
NCD_NAME="${TAG}-${NCD_NAME}"
|
||||
IMAGE="1john2ci/nextcloud:${NCD_NAME}"
|
||||
|
||||
declare -A PUBLISH=(
|
||||
[nginx-ncd]=' -p 127.0.0.1:8060:80 '
|
||||
[16.0-nginx]=' -p 127.0.0.1:8060:80 '
|
||||
[fpm-ncd]=''
|
||||
)
|
||||
|
||||
# ##
|
||||
# Cleanup
|
||||
# ##
|
||||
docker stop "${NAME}"
|
||||
docker rm "${NAME}"
|
||||
if [ "${REMOVEIMAGE}" == 'y' ]; then
|
||||
docker stop "${NCD_NAME}"
|
||||
docker rm "${NCD_NAME}"
|
||||
if [ "${NCD_REMOVEIMAGE}" == 'y' ]; then
|
||||
docker rmi "${IMAGE}"
|
||||
fi
|
||||
|
||||
if [ "${STARTCONTAINER}" != 'y' ] ; then
|
||||
if [ "${NCD_STARTCONTAINER}" != 'y' ] ; then
|
||||
exit 0
|
||||
fi
|
||||
# ##
|
||||
# Start Container
|
||||
# ##
|
||||
if [ "${STARTSLEEP}" == 'y' ]; then
|
||||
if [ "${NCD_STARTSLEEP}" == 'y' ]; then
|
||||
EXECCMD='/bin/sleep infinity'
|
||||
else
|
||||
EXECCMD=''
|
||||
fi
|
||||
eval "CMD='docker run -dit \
|
||||
--hostname "${NAME}" \
|
||||
--name "${NAME}" \
|
||||
--hostname "${NCD_NAME}" \
|
||||
--name "${NCD_NAME}" \
|
||||
--net 'nextcloud' \
|
||||
--volume ${NCD_VOL} \
|
||||
"${PUBLISH[$NAME]}" \
|
||||
"${PUBLISH[$NCD_NAME]}" \
|
||||
"${IMAGE}" \
|
||||
"${EXECCMD}" \
|
||||
'"
|
||||
export SQLITE_DATABASE='test'
|
||||
export NEXTCLOUD_ADMIN_USER='admin'
|
||||
export NEXTCLOUD_ADMIN_PASSWORD='admin'
|
||||
|
||||
${CMD}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue