use nginx with caching for nextcloud fpm

This commit is contained in:
2018-03-12 22:40:03 -04:00
parent 978e2cf56d
commit 3ed65eefe9
11 changed files with 167 additions and 63 deletions

View File

@@ -2,12 +2,13 @@
docker login -u richard -p $DKREGISTRY_PASS $DKREGISTRY
(cd nextcloud && docker-compose -f docker-compose.yml build)
(cd nextcloud && docker-compose -f docker-compose-build.yml build)
(cd sslproxy && docker-compose -f docker-compose.yml build)
(cd letsencrypt && docker-compose -f docker-compose.yml build)
(cd prometheus && docker-compose -f docker-compose.yml build)
docker push dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest
docker push dkregistry.xai-corp.net:5000/xaicorp/nextcloud-web:latest
docker push dkregistry.xai-corp.net:5000/sslproxy:2.1
docker push dkregistry.xai-corp.net:5000/letsencrypt:latest
docker push dkregistry.xai-corp.net:5000/xaicorp/prometheus:latest

View File

@@ -1,4 +1,3 @@
FROM nextcloud:13
FROM nextcloud:13-fpm
RUN apt-get update && apt-get install -y smbclient && rm -rf /var/lib/apt/lists/*

View File

@@ -0,0 +1,3 @@
FROM nginx
COPY nginx.conf /etc/nginx/conf.d/default.conf

View File

@@ -0,0 +1,28 @@
---
# docker-compose file for nextcloud server
# docker login dkregistry.xai-corp.net:5000
# docker-compose build && docker push dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest
# DOCKER_HOST=dkhost:2376 docker stack deploy --with-registry-auth -c docker-compose-prod.yml owncloud
version: '3'
services:
xaicloud:
image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest"
build:
context: .
dockerfile: Dockerfile
ports:
- 8083:80
# - 9083:9000
volumes:
- ./data:/var/www/html
web:
image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud-web:latest"
build:
context: .
dockerfile: Dockerfile-web
ports:
- 8083:80

View File

@@ -5,18 +5,18 @@
# DOCKER_HOST=dkhost:2376 docker stack ps owncloud
version: '3.4'
volumes:
cache:
services:
app:
image: dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest
ports:
- 8083:80
# - 9083:9000
xaicloud:
image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest"
volumes:
- /opt/shared/nextcloud/data:/var/www/html/data
- /opt/shared/nextcloud/config:/var/www/html/config
- /opt/shared/nextcloud/apps:/var/www/html/custom_apps
deploy:
mode: replicated
replicas: 1
@@ -30,15 +30,50 @@ services:
order: start-first
resources:
limits:
memory: 512M
networks:
- prod
# logging:
# driver: fluentd
# options:
# fluentd-address: "logs.xai-corp.net:24224"
# fluentd-async-connect: 'true'
# tag: nextcloud
web:
image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud-web:latest"
ports:
- 8083:80
volumes:
- cache:/data/nginx/cache/nextcloud
- /opt/shared/nextcloud/data:/var/www/html/data
- /opt/shared/nextcloud/config:/var/www/html/config
- /opt/shared/nextcloud/apps:/var/www/html/custom_apps
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: any
delay: "30s"
max_attempts: 5
update_config:
parallelism: 1
delay: 2s
order: start-first
resources:
limits:
# cpus: '1'
memory: 512M
logging:
driver: fluentd
options:
fluentd-address: "logs.xai-corp.net:24224"
fluentd-async-connect: 'true'
tag: nextcloud
# healthcheck:
# test: curl -f http://localhost ||exit 1
# interval: 1m30s
# timeout: 1s
# retries: 2
networks:
- ingress
- prod
# collabora:
# image: collabora/code

View File

@@ -5,47 +5,41 @@
# docker-compose build && docker push dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest
# DOCKER_HOST=dkhost:2376 docker stack deploy --with-registry-auth -c docker-compose-prod.yml owncloud
version: '3'
version: '2'
volumes:
nextcloud:
db:
cache:
services:
owncloud:
image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest"
build:
context: .
dockerfile: Dockerfile
db:
image: mariadb
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=test
- MYSQL_PASSWORD=test
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
xaicloud:
image: nextcloud:fpm
links:
- db
volumes:
- nextcloud:/var/www/html
web:
image: nginx
ports:
- 8083:80
# - 9083:9000
links:
- app
volumes:
- ./data:/var/www/html
#
# collabora:
# image: collabora/code
# ports:
# - 9980:9980
# environment:
# domain: office\\.xai-corp\\.net
# username: admin
# password: ah8031qhnbc
# server_name: office.xai-corp.net
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
- cache:/data/nginx/cache/nextcloud
volumes_from:
- app
# letsencrypt:
# image: linuxserver/letsencrypt
# volumes:
# - ./letsencrypt:/config
# environment:
# URL: xai-corp.net
# SUBDOMAINS: www,sql,xaibox,office
# TZ: America/Montreal
# EMAIL: r_morgan@sympatico.ca
#TODO:
# cron:
# http:
# image: "dkregistry.xai-corp.net:5000/sslproxy:2.0"
# volumes:
# - ./letsencrypt:/etc/letsencrypt:ro
# ports:
# - "443:443"

View File

@@ -0,0 +1,35 @@
proxy_cache_path /data/nginx/cache/nextcloud levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
listen 80;
index index.php index.html;
server_name docker.test;
root /var/www/html;
location /remote.php {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass tasks.xaicloud:9000;
fastcgi_index remote.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri /index.php?$args;
}
# location / {
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass tasks.xaicloud:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

View File

@@ -14,12 +14,15 @@ services:
image: "dkregistry.xai-corp.net:5000/xaicorp/prometheus:latest"
ports:
- 9090:9090
# logging:
# driver: fluentd
# options:
# fluentd-address: "logs.xai-corp.net:24224"
# fluentd-async-connect: 'true'
# tag: postgres
volumes:
- /opt/prometheus/data:/prometheus-data
logging:
driver: fluentd
options:
fluentd-address: "logs.xai-corp.net:24224"
fluentd-async-connect: 'true'
tag: prometheus
deploy:
mode: replicated
replicas: 1

View File

@@ -16,7 +16,7 @@ scrape_configs:
- job_name: glusterfs
metrics_path: /metrics
scrape_interval: 30s
scrape_interval: 120s
scrape_timeout: 14s
static_configs:
- targets:
@@ -25,7 +25,7 @@ scrape_configs:
- job_name: fluentd
metrics_path: /metrics
scrape_interval: 10s
scrape_interval: 60s
scrape_timeout: 9s
static_configs:
- targets: