Merge branch 'develop' of code.apps.glenux.net:glenux-opencontainers/service-nextcloud into develop
This commit is contained in:
commit
3de05c4f9d
9 changed files with 265 additions and 10 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
.drone.yml
|
||||
.git
|
97
.drone.yml
Normal file
97
.drone.yml
Normal file
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: debug
|
||||
image: alpine
|
||||
commands:
|
||||
- 'echo "Repository: glenux/service-nextcloud"'
|
||||
- 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
|
||||
|
||||
- name: publish:commit_sha
|
||||
image: plugins/docker
|
||||
# pull: never
|
||||
# volumes:
|
||||
# - name: cache
|
||||
# path: /stupid
|
||||
environment:
|
||||
DOCKER_REPO: glenux/service-nextcloud
|
||||
settings:
|
||||
username:
|
||||
from_secret: DOCKERHUB_USERNAME
|
||||
password:
|
||||
from_secret: DOCKERHUB_PASSWORD
|
||||
cache_from: "glenux/service-nextcloud:latest_${DRONE_BRANCH/\\//-}"
|
||||
repo: glenux/service-nextcloud
|
||||
tags: "${DRONE_COMMIT_SHA:0:8}"
|
||||
purge: false
|
||||
|
||||
- name: publish:commit_branch
|
||||
image: plugins/docker
|
||||
# volumes:
|
||||
# - name: cache
|
||||
# path: /stupid
|
||||
settings:
|
||||
username:
|
||||
from_secret: DOCKERHUB_USERNAME
|
||||
password:
|
||||
from_secret: DOCKERHUB_PASSWORD
|
||||
cache_from: "glenux/service-nextcloud:latest_${DRONE_BRANCH/\\//-}"
|
||||
repo: glenux/service-nextcloud
|
||||
tags: "latest_${DRONE_BRANCH/\\//-}"
|
||||
purge: false
|
||||
when:
|
||||
branch:
|
||||
- "master"
|
||||
- "develop"
|
||||
- "feature/*"
|
||||
|
||||
- name: publish:latest
|
||||
image: plugins/docker
|
||||
settings:
|
||||
username:
|
||||
from_secret: DOCKERHUB_USERNAME
|
||||
password:
|
||||
from_secret: DOCKERHUB_PASSWORD
|
||||
cache_from: "glenux/service-nextcloud:latest_${DRONE_BRANCH/\\//-}"
|
||||
repo: glenux/service-nextcloud
|
||||
tags: latest
|
||||
purge: false
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: deploy:dokku
|
||||
image: alpine
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
environment:
|
||||
SSH_USER:
|
||||
from_secret: SSH_USER
|
||||
SSH_HOST:
|
||||
from_secret: SSH_HOST
|
||||
SSH_PRIVATE_KEY:
|
||||
from_secret: SSH_PRIVATE_KEY
|
||||
commands:
|
||||
- echo $SSH_USER
|
||||
- echo $SSH_HOST
|
||||
- echo $SSH_PRIVATE_KEY
|
||||
- apk update && apk add openssh-client
|
||||
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||
- echo "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/deploy_key
|
||||
- chmod 600 ~/.ssh/deploy_key
|
||||
- ssh -o StrictHostKeyChecking=no
|
||||
-i ~/.ssh/deploy_key
|
||||
"$SSH_USER@$SSH_HOST"
|
||||
git:from-image cloud
|
||||
"glenux/service-nextcloud:${DRONE_COMMIT_SHA:0:8}"
|
||||
#
|
||||
- echo "SUCCESS"
|
||||
|
||||
# volumes:
|
||||
# - name: cache
|
||||
# temp: {}
|
||||
#
|
69
Dockerfile
69
Dockerfile
|
@ -6,12 +6,23 @@
|
|||
# FROM nextcloud:19.0.3-apache
|
||||
# FROM nextcloud:20.0.0-apache
|
||||
# FROM nextcloud:20.0.5-apache
|
||||
FROM nextcloud:21.0.0-apache
|
||||
# FROM nextcloud:21.0.2-apache
|
||||
# FROM nextcloud:22.2-apache
|
||||
# FROM nextcloud:23.0.2-apache
|
||||
# FROM nextcloud:24.0.2-apache
|
||||
# FROM nextcloud:25.0.4-apache
|
||||
# FROM nextcloud:26.0.2-apache
|
||||
# FROM nextcloud:27.0.2-apache
|
||||
FROM nextcloud:27.1.1-apache
|
||||
|
||||
|
||||
# This is a stupid comment for a demo (remove later)
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y nano \
|
||||
&& apt-get install -y clamdscan nano ghostscript \
|
||||
&& apt-get clean
|
||||
|
||||
#
|
||||
## Enable REDIS extension
|
||||
# RUN pecl channel-update pecl.php.net \
|
||||
# && sh -c "yes '' | pecl install redis" \
|
||||
|
@ -29,15 +40,55 @@ RUN apt-get update \
|
|||
# && echo "apc.enable=1" >> /usr/local/etc/php/glenux-apcu.ini \
|
||||
# && docker-php-ext-enable apcu
|
||||
|
||||
# apt-get install -q -y cron && \
|
||||
# apt-get clean
|
||||
|
||||
# RUN echo "*/15 * * * * root su -l www-data -s /bin/bash -c 'php -f /var/www/html/cron.php' > /dev/null 2>&1" >> /etc/crontab
|
||||
|
||||
# CMD cron && apache2-foreground
|
||||
|
||||
# Mandatory for bookmark extension
|
||||
# but missing from deb packages
|
||||
# RUN apt-get update \
|
||||
# && apt-get install -y php7.3-gmp
|
||||
|
||||
##
|
||||
## GMP Support (for bookmark extension)
|
||||
##
|
||||
RUN apt-get update && apt-get install -y libgmp3-dev \
|
||||
&& docker-php-ext-install gmp
|
||||
|
||||
##
|
||||
## SVG and LibreSign support
|
||||
##
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libmagickcore-6.q16-6-extra \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN sed -i'' 's|.*<policy domain="coder".*"PDF".*|<policy domain="coder" rights="read \| write" pattern="PDF" />|g' \
|
||||
/etc/ImageMagick-6/policy.xml
|
||||
|
||||
##
|
||||
## Raise memory limit for PHP
|
||||
##
|
||||
ENV PHP_MEMORY_LIMIT=1024M
|
||||
ENV PHP_UPLOAD_LIMIT=1800M
|
||||
RUN echo '[opcache]' > /usr/local/etc/php/conf.d/opcache.ini \
|
||||
&& echo 'opcache.memory_consumption=256' >> /usr/local/etc/php/conf.d/opcache.ini \
|
||||
&& echo '[PHP]' > /usr/local/etc/php/conf.d/memory-limit.ini \
|
||||
&& echo 'memory_limit=1024M' >> /usr/local/etc/php/conf.d/memory-limit.ini
|
||||
|
||||
##
|
||||
## CRON SETUP
|
||||
##
|
||||
## Based on https://github.com/nextcloud/docker/tree/master/.examples/dockerfiles/cron/apache
|
||||
##
|
||||
RUN echo '*/5 * * * * php -d memory_limit=1024M -f /var/www/html/cron.php' \
|
||||
> /var/spool/cron/crontabs/www-data
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
supervisor \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir /var/log/supervisord /var/run/supervisord
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
|
||||
COPY app.json /app/app.json
|
||||
COPY postdeploy.sh /app/postdeploy.sh
|
||||
|
||||
ENV NEXTCLOUD_UPDATE=1
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
|
||||
|
|
21
README.md
21
README.md
|
@ -1 +1,20 @@
|
|||
# My project's README
|
||||
|
||||
[![Build Status](https://cicd.apps.glenux.net/api/badges/glenux-opencontainers/service-nextcloud/status.svg)](https://cicd.apps.glenux.net/glenux-opencontainers/service-nextcloud)
|
||||
|
||||
# Glenux OpenContainers : Service Nextcloud
|
||||
|
||||
## Dokku storage mounts
|
||||
|
||||
dokku storage:mount cloud /var/lib/dokku/data/storage/cloud/apps:/var/www/html/apps
|
||||
dokku storage:mount cloud /var/lib/dokku/data/storage/cloud/config:/var/www/html/config
|
||||
dokku storage:mount cloud /var/lib/dokku/data/storage/cloud/data:/var/www/html/data
|
||||
|
||||
# Process
|
||||
|
||||
1. commit
|
||||
2. push to git repo
|
||||
3. run CI/CD
|
||||
* build image
|
||||
* push image to local registry
|
||||
4.
|
||||
|
||||
|
|
7
app.json
Normal file
7
app.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"scripts": {
|
||||
"dokku": {
|
||||
"postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh"
|
||||
}
|
||||
}
|
||||
}
|
42
docker-compose.yml
Normal file
42
docker-compose.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
db:
|
||||
container_name: cloud-db
|
||||
image: postgres:14
|
||||
volumes:
|
||||
- cloud-db-data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_PASSWORD: cloud-password
|
||||
POSTGRES_USER: cloud-user
|
||||
POSTGRES_DB: cloud-db
|
||||
networks:
|
||||
- cloud-net
|
||||
|
||||
app:
|
||||
container_name: cloud-app
|
||||
build: .
|
||||
image: glenux/nextcloud:23
|
||||
volumes:
|
||||
- cloud-app-data:/var/www/html
|
||||
environment:
|
||||
POSTGRES_PASSWORD: cloud-password
|
||||
POSTGRES_USER: cloud-user
|
||||
POSTGRES_DB: cloud-db
|
||||
POSTGRES_HOST: cloud-db
|
||||
NEXTCLOUD_ADMIN_USER: admin
|
||||
NEXTCLOUD_ADMIN_PASSWORD: "1234"
|
||||
networks:
|
||||
- cloud-net
|
||||
ports:
|
||||
- 8080:80
|
||||
|
||||
volumes:
|
||||
cloud-app-data:
|
||||
cloud-db-data:
|
||||
|
||||
networks:
|
||||
cloud-net:
|
||||
|
||||
#
|
2
nginx.conf.d/dav.conf
Normal file
2
nginx.conf.d/dav.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ permanent;
|
||||
rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ permanent;
|
13
postdeploy.sh
Executable file
13
postdeploy.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -u
|
||||
set -e
|
||||
|
||||
cd /var/www/html
|
||||
echo "GYR:POSTDEPLOY:START ($(pwd))"
|
||||
find . -maxdepth 1
|
||||
php -d memory_limit=-1 occ upgrade
|
||||
php -d memory_limit=-1 occ db:convert-filecache-bigint
|
||||
php -d memory_limit=-1 occ db:add-missing-indices
|
||||
echo "GYR:POSTDEPLOY:END"
|
||||
|
22
supervisord.conf
Normal file
22
supervisord.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisord/supervisord.log
|
||||
pidfile=/var/run/supervisord/supervisord.pid
|
||||
childlogdir=/var/log/supervisord/
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=error
|
||||
|
||||
[program:apache2]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=apache2-foreground
|
||||
|
||||
[program:cron]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=/cron.sh
|
Loading…
Reference in a new issue