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

@@ -60,8 +60,11 @@
host: gluster:/gitea host: gluster:/gitea
mount: /var/lib/gitea mount: /var/lib/gitea
jenkins: jenkins:
host: gluster:/jenkins host: gluster:/jenkins2
mount: /var/lib/jenkins mount: /var/lib/jenkins
prometheus:
host: gluster:/prometheus
mount: /opt/prometheus
gluster_remove: gluster_remove:
elasticsearch: elasticsearch:
host: gluster:/elasticsearch host: gluster:/elasticsearch

View File

@@ -2,12 +2,13 @@
docker login -u richard -p $DKREGISTRY_PASS $DKREGISTRY 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 sslproxy && docker-compose -f docker-compose.yml build)
(cd letsencrypt && 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) (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: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/sslproxy:2.1
docker push dkregistry.xai-corp.net:5000/letsencrypt:latest docker push dkregistry.xai-corp.net:5000/letsencrypt:latest
docker push dkregistry.xai-corp.net:5000/xaicorp/prometheus: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/* 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 # DOCKER_HOST=dkhost:2376 docker stack ps owncloud
version: '3.4' version: '3.4'
volumes:
cache:
services: services:
app: xaicloud:
image: dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest"
ports:
- 8083:80
# - 9083:9000
volumes: volumes:
- /opt/shared/nextcloud/data:/var/www/html/data - /opt/shared/nextcloud/data:/var/www/html/data
- /opt/shared/nextcloud/config:/var/www/html/config - /opt/shared/nextcloud/config:/var/www/html/config
- /opt/shared/nextcloud/apps:/var/www/html/custom_apps - /opt/shared/nextcloud/apps:/var/www/html/custom_apps
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
@@ -30,15 +30,50 @@ services:
order: start-first order: start-first
resources: resources:
limits: 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' # cpus: '1'
memory: 512M memory: 512M
# healthcheck:
logging: # test: curl -f http://localhost ||exit 1
driver: fluentd # interval: 1m30s
options: # timeout: 1s
fluentd-address: "logs.xai-corp.net:24224" # retries: 2
fluentd-async-connect: 'true' networks:
tag: nextcloud - ingress
- prod
# collabora: # collabora:
# image: collabora/code # image: collabora/code

View File

@@ -5,47 +5,41 @@
# docker-compose build && docker push dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest # 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 # 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: services:
owncloud: db:
image: "dkregistry.xai-corp.net:5000/xaicorp/nextcloud:latest" image: mariadb
build: volumes:
context: . - db:/var/lib/mysql
dockerfile: Dockerfile 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: ports:
- 8083:80 - 8083:80
# - 9083:9000 links:
- app
volumes: volumes:
- ./data:/var/www/html - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
# - cache:/data/nginx/cache/nextcloud
# collabora: volumes_from:
# image: collabora/code - app
# ports:
# - 9980:9980
# environment:
# domain: office\\.xai-corp\\.net
# username: admin
# password: ah8031qhnbc
# server_name: office.xai-corp.net
# 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" image: "dkregistry.xai-corp.net:5000/xaicorp/prometheus:latest"
ports: ports:
- 9090:9090 - 9090:9090
# logging: volumes:
# driver: fluentd - /opt/prometheus/data:/prometheus-data
# options:
# fluentd-address: "logs.xai-corp.net:24224" logging:
# fluentd-async-connect: 'true' driver: fluentd
# tag: postgres options:
fluentd-address: "logs.xai-corp.net:24224"
fluentd-async-connect: 'true'
tag: prometheus
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1

View File

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

View File

@@ -17,6 +17,7 @@
- /data/glusterfs/jenkins/brick1 - /data/glusterfs/jenkins/brick1
- /data/glusterfs/jenkins2/brick1 - /data/glusterfs/jenkins2/brick1
- /data/glusterfs/tmp/brick1 - /data/glusterfs/tmp/brick1
- /data/glusterfs/prometheus/brick1
# - /data/glusterfs/elasticsearch/brick1 # - /data/glusterfs/elasticsearch/brick1
volumes: volumes:
gitea: gitea:
@@ -28,6 +29,8 @@
distributed_volumes: distributed_volumes:
tmp: tmp:
- /data/glusterfs/tmp/brick1/brick - /data/glusterfs/tmp/brick1/brick
prometheus:
- /data/glusterfs/prometheus/brick1
# elasticsearch: # elasticsearch:
# - /data/glusterfs/elasticsearch/brick1/brick # - /data/glusterfs/elasticsearch/brick1/brick