Compare commits

..

15 Commits

Author SHA1 Message Date
8361973bd5 Update container registry URL 2025-07-02 11:29:50 -04:00
b20f001731 Increase file limit for php-fpm 2025-07-02 11:28:55 -04:00
9aee542c18 !LOCAL Add tuned php-fpm config for increasing process count 2025-05-01 15:18:59 -04:00
8a5a56dc50 !LOCAL Enable HTTP2 for faster load times 2025-05-01 14:14:30 -04:00
662e325482 !LOCAL Update php.ini with upstream changes, bump memory limit to 8G 2025-05-01 13:49:07 -04:00
551a6b1984 !LOCAL Increase request timeout to 600 seconds 2024-10-04 21:24:54 -04:00
df55484e5a !LOCAL Add makefile for automating build and upload 2024-04-12 17:07:38 -04:00
1eafbc0a66 !LOCAL adapt compose file for local dev 2024-04-12 17:07:38 -04:00
2d92c672e2 Remove duplicate JS mimetype inclusions 2024-04-12 17:07:38 -04:00
abea6087e5 Add service container for executing cron tasks 2024-04-12 17:07:38 -04:00
fb6290d01f Document new custom nginx image 2024-04-12 17:07:38 -04:00
d98b8fc065 Update compose to use new custom nginx infrastructure 2024-04-12 17:07:38 -04:00
2ae4390f93 Add dockerfile for building custom nginx container
Add entrypoint that calls envsubst ahead of starting nginx
2024-04-12 17:07:38 -04:00
c39cd210f8 Move nginx config to template file
Replace hardcoded config values with environment variables
2024-04-12 17:07:37 -04:00
a990337983 Add pgsql php extension to support postgres backends 2024-04-12 17:05:06 -04:00
7 changed files with 79 additions and 74 deletions

20
Makefile Normal file
View File

@@ -0,0 +1,20 @@
REPOSITORY_PROXY = dev.enpaul.net/skylab/nxcloud-proxy
REPOSITORY_SERVER = dev.enpaul.net/skylab/nxcloud-server
.PHONY: help docs
# source: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## List Makefile targets
$(info Makefile documentation)
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
image: ## Build image
podman build ./php-fpm --tag $(REPOSITORY_SERVER):latest
podman build ./nginx --tag $(REPOSITORY_PROXY):latest
push: image ## Build and publish image
podman login $(shell echo $(REPOSITORY_SERVER) | cut -d '/' -f 1)
podman push $(REPOSITORY_SERVER):latest
podman login $(shell echo $(REPOSITORY_PROXY) | cut -d '/' -f 1)
podman push $(REPOSITORY_PROXY):latest

View File

@@ -2,79 +2,70 @@
services:
nginx:
container_name: nginx-nextcloud
build: ./nginx
ports:
- 80:80
- 8080:80
- 443:443
volumes:
- ${NEXTCLOUD_DIR}:/var/www/html
- ${DATA_DIR}:/data
- ./appdata/application:/var/www/html
- ./appdata/data:/data
environment:
- NEXTCLOUD_PHP_FPM_HOST=${NEXTCLOUD_PHP_FPM_HOST}
- NEXTCLOUD_DOMAIN=${NEXTCLOUD_DOMAIN}
- NEXTCLOUD_MAX_UPLOAD_SIZE=${NEXTCLOUD_MAX_UPLOAD_SIZE}
- NEXTCLOUD_PHP_FPM_HOST=nxcloud-server-1:9000
- NEXTCLOUD_DOMAIN=localhost
- NEXTCLOUD_MAX_UPLOAD_SIZE=4G
networks:
- nextcloud
depends_on:
- php-fpm-nextcloud
- redis-nextcloud
- mariadb-nextcloud
- server
- redis
- mariadb
php-fpm-nextcloud:
container_name: php-fpm-nextcloud
server:
build:
context: ./php-fpm
tags:
- localhost/php-fpm-nextcloud:latest
- vcs.enp.one/skylab/nextcloud-server:latest
volumes:
- ${NEXTCLOUD_DIR}:/var/www/html
- ${DATA_DIR}:/data
- ./appdata/application:/var/www/html
- ./appdata/data:/data
networks:
- nextcloud
mariadb-nextcloud:
container_name: mariadb-nextcloud
mariadb:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- ./mariadb:/var/lib/mysql
- ./appdata/database:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASS}
- MYSQL_PASSWORD=${MARIADB_PASS}
- MARIADB_RANDOM_ROOT_PASSWORD=true
- MYSQL_PASSWORD=nextcloud
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- nextcloud
redis-nextcloud:
container_name: redis-nextcloud
# image: redis:latest
# keydb is a fork and drop-in replacement for Redis
redis:
image: eqalpha/keydb
restart: unless-stopped
networks:
- nextcloud
cron-nextcloud:
container_name: cron-nextcloud
image: localhost/php-fpm-nextcloud:latest
restart: unless-stopped
cron:
image: vcs.enp.one/skylab/nextcloud-server:latest
command:
- bash
- -c
- "'while true; do php --define apc.enable_cli=1 /var/www/html/cron.php && sleep 300; done'"
- "'while true; do php --define apc.enable_cli=1 /var/www/html/cron.php; sleep 300; done'"
networks:
- nextcloud
user: www-data
entrypoint:
- /bin/bash
volumes:
- ${NEXTCLOUD_DIR}:/var/www/html
- ${DATA_DIR}:/data
- ./appdata/application:/var/www/html
- ./appdata/data:/data
depends_on:
- php-fpm-nextcloud
- redis-nextcloud
- mariadb-nextcloud
- server
- redis
- mariadb
networks:
nextcloud:

View File

@@ -1,28 +1,10 @@
FROM docker.io/library/debian:latest AS unpack
RUN apt-get update --yes
RUN apt-get install unzip --yes
RUN mkdir --parents /download
WORKDIR /download
ADD https://download.nextcloud.com/server/releases/latest.zip /download/latest.zip
RUN unzip latest.zip
FROM docker.io/library/nginx:latest AS final
FROM docker.io/library/nginx:latest
ENV NEXTCLOUD_DOMAIN=example.com
ENV NEXTCLOUD_PHP_FPM_HOST=php-fpm-nextcloud:9000
ENV NEXTCLOUD_PHP_FPM_HOST=server:9000
ENV NEXTCLOUD_MAX_UPLOAD_SIZE=512M
ADD nginx.conf.template /nginx.conf.template
ADD docker-entrypoint.sh /docker-entrypoint.sh
RUN mkdir --parents /var/www/html
WORKDIR /var/www/html
COPY --from=unpack /download/nextcloud /var/www/html/nextcloud
RUN chown -R root:root nextcloud/
RUN chmod -R 0755 nextcloud/
ENTRYPOINT ["sh", "-c", "/docker-entrypoint.sh"]

View File

@@ -13,8 +13,8 @@ http {
}
server {
listen 80;
listen [::]:80;
listen 80 http2;
listen [::]:80 http2;
# INFO: Set this to your domain
server_name ${NEXTCLOUD_DOMAIN};
@@ -154,6 +154,7 @@ http {
fastcgi_request_buffering off;
fastcgi_max_temp_file_size 0;
fastcgi_read_timeout 600;
}
# Serve static files

View File

@@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y \
libldap2-dev \
libsmbclient-dev \
libcurl4-openssl-dev \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Download and install the docker-php-extension-installer script
@@ -56,20 +55,19 @@ RUN install-php-extensions \
redis \
imagick \
sysvsem \
opcache
opcache \
pgsql
# Copy optimized php.ini-development and production
COPY ./php.ini-production /usr/local/etc/php/php.ini
# Copy optimized php-fpm.ini
COPY ./php-fpm.ini /usr/local/etc/php-fpm.d/zz-pm-tuning.conf
# Set the working directory
WORKDIR /var/www/html
RUN curl -sSLo latest.zip https://download.nextcloud.com/server/releases/latest.zip
RUN unzip latest.zip
RUN rm latest.zip
RUN chown -R www-data:www-data nextcloud/
# Expose port 9000 for PHP-FPM
# EXPOSE 9000

6
php-fpm/php-fpm.ini Normal file
View File

@@ -0,0 +1,6 @@
pm = static
pm.max_children = 800
pm.start_servers = 200
pm.min_spare_servers = 200
pm.max_spare_servers = 600
rlimit_files = 4096

View File

@@ -348,13 +348,13 @@ disable_classes =
; the file operations performed.
; Note: if open_basedir is set, the cache is disabled
; https://php.net/realpath-cache-size
;realpath_cache_size = 4096k
realpath_cache_size = 4096k
; Duration of time, in seconds for which to cache realpath information for a given
; file or directory. For systems with rarely changing files, consider increasing this
; value.
; https://php.net/realpath-cache-ttl
;realpath_cache_ttl = 120
realpath_cache_ttl = 120
; Enables or disables the circular reference collector.
; https://php.net/zend.enable-gc
@@ -432,7 +432,7 @@ max_input_time = 60
; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 2048M
memory_limit = 8G
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
@@ -855,7 +855,7 @@ file_uploads = On
upload_max_filesize = 10G
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
max_file_uploads = 100
;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
@@ -1789,14 +1789,14 @@ opcache.enable=1
opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=128
opcache.memory_consumption=256
; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=16
opcache.interned_strings_buffer=24
; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
opcache.max_accelerated_files=4000
opcache.max_accelerated_files=10000
; The maximum percentage of "wasted" memory until a restart is scheduled.
;opcache.max_wasted_percentage=5
@@ -1814,7 +1814,7 @@ opcache.validate_timestamps=1
; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
opcache.revalidate_freq=60
opcache.revalidate_freq=1
; Enables or disables file search in include_path optimization
;opcache.revalidate_path=0
@@ -1972,3 +1972,10 @@ opcache.save_comments=1
; List of headers files to preload, wildcard patterns allowed.
;ffi.preload=
; Useful Nextcloud optimizations and additions
apc.enable_cli=1
opcache.jit_buffer_size = 128M
opcache.jit = tracing
opcache.jit = 1235