More FPM excitement

This commit is contained in:
3wc 2021-08-26 12:02:21 +02:00
parent 3b565b135c
commit f71e43949a
3 changed files with 183 additions and 170 deletions

View File

@ -1,4 +1,4 @@
export NGINX_CONF_VERSION="v3" export NGINX_CONF_VERSION="v1"
NC_APP_DIR="app:/var/www/html" NC_APP_DIR="app:/var/www/html"

View File

@ -1,13 +1,13 @@
version: "3.8" version: "3.8"
services: services:
web: web:
image: nginx:latest image: nginx:1.20.0
configs: configs:
- source: nginx_conf - source: nginx_conf
target: /etc/nginx/nginx.conf target: /etc/nginx/nginx.conf
environment: environment:
- DOMAIN=${DOMAIN} - DOMAIN
- STACK_NAME=${STACK_NAME} - STACK_NAME
volumes: volumes:
- nextcloud:/var/www/html/ - nextcloud:/var/www/html/
- nextapps:/var/www/html/custom_apps:cached - nextapps:/var/www/html/custom_apps:cached
@ -39,8 +39,8 @@ services:
- db_password - db_password
- admin_password - admin_password
environment: environment:
- DOMAIN=${DOMAIN} - DOMAIN
- STACK_NAME=${STACK_NAME} - STACK_NAME
- MYSQL_HOST=db - MYSQL_HOST=db
- MYSQL_DATABASE=nextcloud - MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud - MYSQL_USER=nextcloud
@ -62,14 +62,13 @@ services:
- nextconfig:/var/www/html/config:cached - nextconfig:/var/www/html/config:cached
- ${EXTRA_VOLUME} - ${EXTRA_VOLUME}
networks: networks:
- proxy
- internal - internal
healthcheck: # healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"] # test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s # interval: 30s
timeout: 10s # timeout: 10s
retries: 10 # retries: 10
start_period: 1m # start_period: 1m
deploy: deploy:
update_config: update_config:
failure_action: rollback failure_action: rollback
@ -89,34 +88,34 @@ services:
- "mariadb:/var/lib/mysql" - "mariadb:/var/lib/mysql"
networks: networks:
- internal - internal
healthcheck: # healthcheck:
test: 'mysql -p"$$(tr -d "\n" < /run/secrets/db_root_password)"' # test: 'mysql -p"$$(tr -d "\n" < /run/secrets/db_root_password)"'
interval: 20s # interval: 20s
timeout: 2s # timeout: 2s
retries: 3 # retries: 3
start_period: 30s # start_period: 30s
deploy: deploy:
labels: ["coop-cloud.${STACK_NAME}.db.version=10.5-9c681cef"] labels: ["coop-cloud.${STACK_NAME}.db.version=10.5-9c681cef"]
cron: # cron:
image: nextcloud:22.1.0 # image: nextcloud:22.1.0
volumes: # volumes:
- nextcloud:/var/www/html/ # - nextcloud:/var/www/html/
- nextapps:/var/www/html/custom_apps:cached # - nextapps:/var/www/html/custom_apps:cached
- nextdata:/var/www/html/data:cached # - nextdata:/var/www/html/data:cached
- nextconfig:/var/www/html/config:cached # - nextconfig:/var/www/html/config:cached
- ${EXTRA_VOLUME} # - ${EXTRA_VOLUME}
networks: # networks:
- internal # - internal
entrypoint: /cron.sh # entrypoint: /cron.sh
deploy: # deploy:
labels: ['coop-cloud.${STACK_NAME}.cron.version=22.1.0-89d9ab98'] # labels: ['coop-cloud.${STACK_NAME}.cron.version=22.1.0-89d9ab98']
cache: # cache:
image: redis:6.2.5-alpine # image: redis:6.2.5-alpine
networks: # networks:
- internal # - internal
deploy: # deploy:
labels: # labels:
- coop-cloud.${STACK_NAME}.cache.version=6.2.5-alpine-b658aeb0 # - coop-cloud.${STACK_NAME}.cache.version=6.2.5-alpine-b658aeb0
secrets: secrets:
db_root_password: db_root_password:

View File

@ -1,8 +1,21 @@
server { events {
worker_connections 768;
}
error_log /var/log/nginx/error.log warn;
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
upstream backend { upstream backend {
server {{ env "STACK_NAME" }}_app:9000; server {{ env "STACK_NAME" }}_app:9000;
} }
server {
listen 80 http2; listen 80 http2;
listen [::]:80 http2; listen [::]:80 http2;
server_name {{ env "DOMAIN" }}; server_name {{ env "DOMAIN" }};
@ -130,3 +143,4 @@ server {
try_files $uri $uri/ /index.php$request_uri; try_files $uri $uri/ /index.php$request_uri;
} }
} }
}