Различия
Показаны различия между двумя версиями страницы.
| Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
| application:nextcloud [2025/03/02 17:09] – mirocow | application:nextcloud [2025/11/28 07:56] (текущий) – 78.138.161.134 | ||
|---|---|---|---|
| Строка 3: | Строка 3: | ||
| ====== Nextcloud ====== | ====== Nextcloud ====== | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | ====== Сборка ====== | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | |||
| + | export PROD_V=9.04 | ||
| + | |||
| + | ################################################################################## | ||
| + | |||
| + | cd /opt | ||
| + | git clone https:// | ||
| + | cd / | ||
| + | |||
| + | docker build . -t onlyoffice-documentserver-unlimited: | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | docker push ghcr.io/ | ||
| + | docker push thomisus/ | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | echo "all done" && \ | ||
| + | docker push ghcr.io/ | ||
| + | docker push thomisus/ | ||
| + | </ | ||
| + | |||
| + | ====== Установка ====== | ||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| ===== Установка Onlyoffice + Drawio + Drawio Export ===== | ===== Установка Onlyoffice + Drawio + Drawio Export ===== | ||
| Строка 29: | Строка 64: | ||
| # - 192.168.1.6: | # - 192.168.1.6: | ||
| volumes: | volumes: | ||
| + | - / | ||
| - proxy:/ | - proxy:/ | ||
| - | - data:/ | + | - nextcloud:/ |
| + | | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| # docker exec -u www-data nextcloud-app php occ config: | # docker exec -u www-data nextcloud-app php occ config: | ||
| Строка 39: | Строка 79: | ||
| # docker exec -u www-data nextcloud-app php occ upgrade | # docker exec -u www-data nextcloud-app php occ upgrade | ||
| app: | app: | ||
| - | image: nextcloud:latest | + | image: nextcloud:31.0.8-apache |
| container_name: | container_name: | ||
| networks: | networks: | ||
| Строка 49: | Строка 89: | ||
| - db | - db | ||
| - redis | - redis | ||
| + | - cron | ||
| + | - es01 | ||
| volumes: | volumes: | ||
| - / | - / | ||
| - | - data:/ | + | - nextcloud:/ |
| + | - crontabs:/ | ||
| environment: | environment: | ||
| - TZ=Europe/ | - TZ=Europe/ | ||
| Строка 58: | Строка 101: | ||
| - SKIP_DOMAIN_VALIDATION=true | - SKIP_DOMAIN_VALIDATION=true | ||
| restart: unless-stopped | restart: unless-stopped | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 10G | ||
| + | healthcheck: | ||
| + | test: [" | ||
| + | interval: 10s | ||
| + | timeout: 5s | ||
| + | retries: 3 | ||
| + | start_period: | ||
| + | |||
| + | cron: | ||
| + | image: rcdailey/ | ||
| + | restart: unless-stopped | ||
| + | network_mode: | ||
| + | volumes: | ||
| + | - / | ||
| + | - / | ||
| + | - crontabs:/ | ||
| + | environment: | ||
| + | - NEXTCLOUD_CONTAINER_NAME=nextcloud-app | ||
| + | - NEXTCLOUD_PROJECT_NAME= | ||
| + | - NEXTCLOUD_CRON_MINUTE_INTERVAL=5 | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| # http:// | # http:// | ||
| Строка 67: | Строка 139: | ||
| expose: | expose: | ||
| - ' | - ' | ||
| - | depends_on: | ||
| - | - image-export | ||
| environment: | environment: | ||
| - DRAWIO_SELF_CONTAINED=1 | - DRAWIO_SELF_CONTAINED=1 | ||
| - EXPORT_URL=http:// | - EXPORT_URL=http:// | ||
| + | - PLANTUML_URL=http:// | ||
| # - PLANTUML_URL=http:// | # - PLANTUML_URL=http:// | ||
| # - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} | # - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} | ||
| restart: unless-stopped | restart: unless-stopped | ||
| + | healthcheck: | ||
| + | test: [" | ||
| + | interval: 1m30s | ||
| + | timeout: 10s | ||
| + | retries: 5 | ||
| + | start_period: | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| # http:// | # http:// | ||
| Строка 82: | Строка 164: | ||
| expose: | expose: | ||
| - " | - " | ||
| + | depends_on: | ||
| + | - drawio | ||
| networks: | networks: | ||
| nextcloud_network: | nextcloud_network: | ||
| Строка 89: | Строка 173: | ||
| #- ./ | #- ./ | ||
| restart: unless-stopped | restart: unless-stopped | ||
| + | # deploy: | ||
| + | # | ||
| + | # | ||
| + | # cpus: ' | ||
| + | # | ||
| + | |||
| + | plantuml-server: | ||
| + | image: plantuml/ | ||
| + | expose: | ||
| + | - " | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | depends_on: | ||
| + | - drawio | ||
| + | restart: unless-stopped | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| # ONLYOFFICE Docs address: /ds-vpath/ | # ONLYOFFICE Docs address: /ds-vpath/ | ||
| # ONLYOFFICE Docs address for internal requests from the server: / | # ONLYOFFICE Docs address for internal requests from the server: / | ||
| + | # This build of onlyoffice community edition ( documentserver ) has connections limits increased to 9999 ( instead of default 20 ) | ||
| onlyoffice: | onlyoffice: | ||
| container_name: | container_name: | ||
| - | image: onlyoffice/ | + | |
| + | image: thomisus/ | ||
| + | stdin_open: true | ||
| + | tty: true | ||
| environment: | environment: | ||
| - JWT_SECRET=secret | - JWT_SECRET=secret | ||
| Строка 102: | Строка 210: | ||
| expose: | expose: | ||
| - ' | - ' | ||
| - | # - ' | ||
| volumes: | volumes: | ||
| - document_data:/ | - document_data:/ | ||
| - document_log:/ | - document_log:/ | ||
| - | + | deploy: | |
| - | cron: | + | |
| - | image: nextcloud: | + | |
| - | | + | cpus: ' |
| - | volumes: | + | |
| - | - / | + | |
| - | - data:/ | + | |
| - | environment: | + | |
| - | - TZ=Europe/ | + | |
| - | entrypoint: /cron.sh | + | |
| - | depends_on: | + | |
| - | - db | + | |
| - | - redis | + | |
| - | | + | |
| - | | + | |
| db: | db: | ||
| Строка 137: | Строка 234: | ||
| - MYSQL_DATABASE=nextcloud | - MYSQL_DATABASE=nextcloud | ||
| - MYSQL_USER=nextcloud | - MYSQL_USER=nextcloud | ||
| + | ports: | ||
| + | - 13306:3306 | ||
| restart: unless-stopped | restart: unless-stopped | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 8G | ||
| redis: | redis: | ||
| image: redis: | image: redis: | ||
| restart: unless-stopped | restart: unless-stopped | ||
| + | volumes: | ||
| + | - redis01:/ | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| networks: | networks: | ||
| nextcloud_network: | nextcloud_network: | ||
| Строка 172: | Строка 283: | ||
| networks: | networks: | ||
| nextcloud_network: | nextcloud_network: | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 4G | ||
| + | | ||
| volumes: | volumes: | ||
| proxy: | proxy: | ||
| - | | + | |
| + | crontabs: | ||
| db: | db: | ||
| document_data: | document_data: | ||
| document_log: | document_log: | ||
| data01: | data01: | ||
| + | redis01: | ||
| + | screenshoter: | ||
| | | ||
| - | |||
| networks: | networks: | ||
| nextcloud_network: | nextcloud_network: | ||
| Строка 218: | Строка 336: | ||
| log_format | log_format | ||
| - | | + | |
| - | '" | + | '" |
| access_log | access_log | ||
| Строка 249: | Строка 367: | ||
| server_tokens off; | server_tokens off; | ||
| - | # Add headers | + | # HSTS settings |
| - | add_header Strict-Transport-Security " | + | # WARNING: Only add the preload option once you read about |
| - | add_header X-Content-Type-Options nosniff; | + | # the consequences in https:// |
| - | add_header X-XSS-Protection "1; mode=block"; | + | # will add the domain |
| - | add_header X-Robots-Tag none; | + | |
| - | add_header X-Download-Options noopen; | + | # could take several months. |
| - | add_header X-Permitted-Cross-Domain-Policies none; | + | #add_header Strict-Transport-Security " |
| - | | + | # set max upload size and increase upload timeout: |
| - | client_max_body_size 10G; # 0=unlimited - set max upload size | + | client_max_body_size 512M; |
| + | client_body_timeout 300s; | ||
| fastcgi_buffers 64 4K; | fastcgi_buffers 64 4K; | ||
| - | gzip off; | + | |
| + | gzip on; | ||
| + | gzip_vary on; | ||
| + | gzip_comp_level 4; | ||
| + | gzip_min_length 256; | ||
| + | gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; | ||
| + | gzip_types application/ | ||
| + | |||
| + | # Pagespeed is not supported by Nextcloud, so if your server is built | ||
| + | # with the `ngx_pagespeed` module, uncomment this line to disable it. | ||
| + | # | ||
| + | |||
| + | # The settings allows you to optimize the HTTP2 bandwidth. | ||
| + | # See https:// | ||
| + | # for tuning hints | ||
| + | client_body_buffer_size 512k; | ||
| + | |||
| + | # HTTP response headers borrowed from Nextcloud `.htaccess` | ||
| + | add_header Referrer-Policy | ||
| + | add_header X-Content-Type-Options | ||
| + | add_header X-Frame-Options | ||
| + | add_header X-Permitted-Cross-Domain-Policies | ||
| + | add_header X-Robots-Tag | ||
| + | add_header X-XSS-Protection | ||
| + | |||
| + | # Remove X-Powered-By, | ||
| + | fastcgi_hide_header X-Powered-By; | ||
| + | |||
| + | # Set .mjs and .wasm MIME types | ||
| + | # Either include it in the default mime.types list | ||
| + | # and include that list explicitly or add the file extension | ||
| + | # only for Nextcloud like below: | ||
| + | include mime.types; | ||
| + | types { | ||
| + | text/ | ||
| + | application/ | ||
| + | } | ||
| + | |||
| + | # Specify how to handle directories -- specifying `/ | ||
| + | # here as the fallback means that Nginx always exhibits the desired behaviour | ||
| + | # when a client requests a path that corresponds to a directory that exists | ||
| + | # on the server. In particular, if that directory contains an index.php file, | ||
| + | # that file is correctly served; if it doesn' | ||
| + | # the front-end controller. This consistent behaviour means that we don't need | ||
| + | # to specify custom rules for certain paths (e.g. images and other assets, | ||
| + | # `/updater`, `/ | ||
| + | # `try_files $uri $uri/ / | ||
| + | # always provides the desired behaviour. | ||
| + | index index.php index.html / | ||
| + | |||
| + | # Rule borrowed from `.htaccess` to handle Microsoft DAV clients | ||
| + | #location = / { | ||
| + | # if ( $http_user_agent ~ ^DavClnt ) { | ||
| + | # return 302 / | ||
| + | # } | ||
| + | #} | ||
| + | |||
| + | location = /robots.txt { | ||
| + | allow all; | ||
| + | log_not_found off; | ||
| + | access_log off; | ||
| + | } | ||
| + | |||
| + | # Make a regex exception for `/ | ||
| + | # access it despite the existence of the regex rule | ||
| + | # `location ~ / | ||
| + | # for `/ | ||
| + | location ^~ / | ||
| + | # The rules in this block are an adaptation of the rules | ||
| + | # in `.htaccess` that concern `/ | ||
| + | |||
| + | location = / | ||
| + | location = / | ||
| + | |||
| + | location / | ||
| + | location / | ||
| + | |||
| + | # Let Nextcloud' | ||
| + | # requests by passing them to the front-end controller. | ||
| + | return 301 / | ||
| + | } | ||
| + | |||
| + | # Rules borrowed from `.htaccess` to hide certain paths from clients | ||
| + | location ~ ^/ | ||
| + | location ~ ^/ | ||
| index index.php; | index index.php; | ||
| Строка 270: | Строка 473: | ||
| client_max_body_size 100m; | client_max_body_size 100m; | ||
| proxy_http_version 1.1; | proxy_http_version 1.1; | ||
| - | | + | proxy_set_header Upgrade $http_upgrade; |
| - | | + | proxy_set_header Connection " |
| proxy_set_header Host $http_host; | proxy_set_header Host $http_host; | ||
| proxy_set_header X-Real-IP $remote_addr; | proxy_set_header X-Real-IP $remote_addr; | ||
| - | | + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| - | | + | proxy_set_header X-Forwarded-Host $the_host; |
| - | | + | proxy_set_header X-Forwarded-Proto $the_scheme; |
| + | # Correct handling of fallbacks for HTTP headers | ||
| + | proxy_hide_header X-Permitted-Cross-Domain-Policies; | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| } | } | ||
| - | # onlyoffice | ||
| location ~* ^/ds-vpath/ { | location ~* ^/ds-vpath/ { | ||
| rewrite / | rewrite / | ||
| Строка 293: | Строка 501: | ||
| proxy_set_header X-Forwarded-Host $the_host/ | proxy_set_header X-Forwarded-Host $the_host/ | ||
| proxy_set_header X-Forwarded-Proto $the_scheme; | proxy_set_header X-Forwarded-Proto $the_scheme; | ||
| + | # Correct handling of fallbacks for HTTP headers | ||
| + | proxy_hide_header X-Permitted-Cross-Domain-Policies; | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| } | } | ||
| - | # drawio | ||
| location ~* ^/drawio/ { | location ~* ^/drawio/ { | ||
| rewrite / | rewrite / | ||
| Строка 310: | Строка 523: | ||
| # | # | ||
| } | } | ||
| - | + | ||
| - | # drawio-export PDF | + | |
| location /service/0 { | location /service/0 { | ||
| rewrite / | rewrite / | ||
| Строка 326: | Строка 538: | ||
| # | # | ||
| } | } | ||
| - | |||
| } | } | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | ===== Продолжение настройки ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app rm / | ||
| </ | </ | ||
| Строка 381: | Строка 598: | ||
| ===== Composer ===== | ===== Composer ===== | ||
| + | |||
| + | ==== Install ==== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app php -r " | ||
| + | docker exec nextcloud-app php composer-setup.php && \ | ||
| + | docker exec nextcloud-app mv composer.phar / | ||
| + | docker exec nextcloud-app composer -v | ||
| + | </ | ||
| + | |||
| + | ==== Использование ==== | ||
| <code bash> | <code bash> | ||
| Строка 386: | Строка 614: | ||
| $ docker exec -u www-data nextcloud-app bash -c 'cd / | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| </ | </ | ||
| + | |||
| + | ===== User Data ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | </ | ||
| + | |||
| + | ===== Custom Application ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app chown www-data: | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | </ | ||
| + | |||
| + | ===== Debug ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app pecl install xdebug && \ | ||
| + | docker exec nextcloud-app docker-php-ext-enable xdebug && \ | ||
| + | docker exec nextcloud-app rm -rf /tmp/pear && \ | ||
| + | docker exec nextcloud-app bash -c 'echo " | ||
| + | xdebug.start_with_request=yes | ||
| + | xdebug.client_host=host.docker.internal | ||
| + | ;# 9003 is now the default (set this for old PhpStorm settings). | ||
| + | xdebug.client_port=9000" | ||
| + | php -i|grep xdebug | ||
| + | </ | ||
| + | |||