Merge pull request 'Mise à jour de Nextcloud' (#50) from nextcloud into main
## Détails 1. Modification de la syntaxe d'erreur coté SMTP `?err` -> `:?err` 2. Ajout des variables de configuration dans le conteneur cron 3. Fix le chemin du dossier pour construire l'image Docker web 4. Ajout de variables d'envionnement pour surcharger la configuration de `config.php` 5. Modification des variables SMTP pour utiliser plutôt les variables d'environnement plutôt que le script d'installation 6. Mise à jour de Nginx 7. Modification de la documentation en fonction des changements 8. Mise à jour de Nextcloud ## Pourquoi 1. Les variables SMTP ne doivent pas être vide 2. Le conteneur cron doit avoir la même configuration que fpm 3. Il y avait un problème de build lorsque l'on ajoutait un fichier docker-compose.yml à coté du dossier contenant le fichier `.env` 4. Pour pouvoir surcharger correctement la configuration et ne pas seulement les configurer à l'installation 5. La même raison que 4 6. Pour être à jour 7. Pour être à jour 8. Pour être à jour Reviewed-on: https://git.weko.io/resilien/services/pulls/50
This commit is contained in:
commit
6334a88085
|
@ -4,7 +4,7 @@
|
||||||
#DOCKER_CONTEXT=
|
#DOCKER_CONTEXT=
|
||||||
#DOCKER_HOST=
|
#DOCKER_HOST=
|
||||||
SERVICES_DIR=..
|
SERVICES_DIR=..
|
||||||
COMPOSE_FILE=${SERVICES_DIR}/nextcloud/docker-compose.yml:${SERVICES_DIR}/nextcloud/docker-compose.local.yml:${SERVICES_DIR}/postgres/docker-compose.yml:${SERVICES_DIR}/redis/docker-compose.yml
|
COMPOSE_FILE=${SERVICES_DIR}/nextcloud/docker-compose.yml:${SERVICES_DIR}/nextcloud/docker-compose.config.yml:${SERVICES_DIR}/nextcloud/docker-compose.local.yml:${SERVICES_DIR}/postgres/docker-compose.yml:${SERVICES_DIR}/redis/docker-compose.yml
|
||||||
#COMPOSE_PROJECT_NAME=
|
#COMPOSE_PROJECT_NAME=
|
||||||
|
|
||||||
## APP
|
## APP
|
||||||
|
|
|
@ -14,45 +14,78 @@ On peut trouver [la documentation ici][documentation] en anglais ou ici pour la
|
||||||
|
|
||||||
## Aide
|
## Aide
|
||||||
|
|
||||||
Exemple de commande :
|
Commande pour se connecter à un serveur :
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker exec --user www-data -it nextcloud bash
|
. .env
|
||||||
|
docker exec --user www-data -it ${NEXTCLOUD_CONTAINER_NAME}-fpm ash
|
||||||
|
```
|
||||||
|
|
||||||
docker-compose exec --user www-data nextcloud php occ db:add-missing-primary-keys
|
Pour mettre un site en maintenance :
|
||||||
|
|
||||||
|
```sh
|
||||||
|
. .env
|
||||||
|
docker exec --user www-data -it ${NEXTCLOUD_CONTAINER_NAME}-fpm php occ maintenance:mode --on
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Il est possible de configurer certaines parties avec des variables d'environnement, mais ce n'est pas le cas de l'ensemble de la configuration.
|
Il est possible de configurer certaines parties avec des variables d'environnement :
|
||||||
|
- Soit les variables sont spécifique à l'image Docker
|
||||||
|
- soit avec des variables du type `NC_` + clé (exemple : NC_default_phone_region=FR)
|
||||||
|
|
||||||
Voici les modifications que j'effectue :
|
### Création d'un groupe
|
||||||
|
|
||||||
```
|
```
|
||||||
docker-compose exec --user www-data nextcloud-fpm ash
|
export NC_GROUP=com-en-aubrac
|
||||||
vi config/config.php
|
php occ group:add $NC_GROUP
|
||||||
```
|
|
||||||
Ajout de la configuration suivante :
|
|
||||||
```
|
|
||||||
'default_language' => 'fr',
|
|
||||||
'default_locale' => 'fr_FR',
|
|
||||||
'default_phone_region' => 'FR',
|
|
||||||
'defaultapp' => 'files',
|
|
||||||
'preview_max_x' => 2048,
|
|
||||||
'preview_max_y' => 2048,
|
|
||||||
'jpeg_quality' => 60,
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Ajout de imagemagick :
|
### Création d'un utilisateur
|
||||||
```
|
|
||||||
docker-compose exec nextcloud-fpm apk add --no-cache imagemagick
|
|
||||||
```
|
|
||||||
|
|
||||||
ou
|
|
||||||
|
|
||||||
```
|
```
|
||||||
ssh <server>
|
# La variable OC_PASS est spécifique pour l'utilisation de --password-from-env
|
||||||
docker exec nextcloud-fpm apk add --no-cache imagemagick
|
export OC_PASS=unmotdepasse!
|
||||||
|
|
||||||
|
export NC_USER=simon
|
||||||
|
export NC_NAME=Simon
|
||||||
|
export NC_MAIL=simon@example.org
|
||||||
|
export NC_QUOTA="180 GB"
|
||||||
|
|
||||||
|
php occ user:add --password-from-env --display-name=$NC_NAME --group="$NC_GROUP" $NC_USER
|
||||||
|
php occ user:setting $NC_USER settings email $NC_MAIL
|
||||||
|
```
|
||||||
|
|
||||||
|
### Quota
|
||||||
|
|
||||||
|
Pour bien comprendre les quotas dans Nextcloud : https://docs.nextcloud.com/server/latest/user_manual/en/files/quota.html
|
||||||
|
|
||||||
|
```
|
||||||
|
export NC_USER=simon
|
||||||
|
export NC_QUOTA="10 GB"
|
||||||
|
php occ user:setting $NC_USER files quota "$NC_QUOTA"
|
||||||
|
```
|
||||||
|
|
||||||
|
### imagemagick
|
||||||
|
|
||||||
|
> Le module php-imagick n’a aucun support SVG dans cette instance. Pour une meilleure compatibilité, il est recommandé de l’installer.
|
||||||
|
|
||||||
|
Pour résoudre ce problème il faut ajouter le paquet `imagemagick`
|
||||||
|
|
||||||
|
```
|
||||||
|
. .env
|
||||||
|
docker exec -it ${NEXTCLOUD_CONTAINER_NAME}-fpm apk add --no-cache imagemagick
|
||||||
|
```
|
||||||
|
|
||||||
|
## Application
|
||||||
|
|
||||||
|
Suppression d'application :
|
||||||
|
|
||||||
|
```
|
||||||
|
php occ app:disable dashboard
|
||||||
|
php occ app:disable photos
|
||||||
|
php occ app:disable weather_status
|
||||||
|
php occ app:disable user_status
|
||||||
```
|
```
|
||||||
|
|
||||||
## PHP-FPM: remédier à server reached pm.max_children
|
## PHP-FPM: remédier à server reached pm.max_children
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
nextcloud-fpm:
|
||||||
|
environment:
|
||||||
|
&nextcloud-configuration
|
||||||
|
NC_trashbin_retention_obligation: ${NC_trashbin_retention_obligation:-auto, 30}
|
||||||
|
NC_force_language: ${NC_force_language:-fr}
|
||||||
|
NC_default_locale: ${NC_default_locale:-fr_FR}
|
||||||
|
NC_force_locale: ${NC_force_locale:-fr_FR}
|
||||||
|
NC_default_language: ${NC_default_language:-fr}
|
||||||
|
NC_default_phone_region: ${NC_default_phone_region:-FR}
|
||||||
|
NC_defaultapp: ${NC_defaultapp:-files}
|
||||||
|
NC_preview_max_x: ${NC_preview_max_x:-2048}
|
||||||
|
NC_preview_max_y: ${NC_preview_max_y:-2048}
|
||||||
|
NC_jpeg_quality: ${NC_jpeg_quality:-60}
|
||||||
|
|
||||||
|
nextcloud-cron:
|
||||||
|
environment:
|
||||||
|
<<: *nextcloud-configuration
|
|
@ -3,11 +3,16 @@ version: "3.8"
|
||||||
services:
|
services:
|
||||||
nextcloud-fpm:
|
nextcloud-fpm:
|
||||||
environment:
|
environment:
|
||||||
SMTP_HOST: ${SMTP_HOST?err} # The hostname of the SMTP server.
|
&smtp-configuration
|
||||||
SMTP_SECURE: ${SMTP_SECURE:-ssl} # Set to ssl to use SSL, or tls to use STARTTLS.
|
NC_mail_smtphost: ${NC_mail_smtphost:?err} # The hostname of the SMTP server.
|
||||||
SMTP_PORT: ${SMTP_PORT:-465}
|
NC_mail_smtpsecure: ${NC_mail_smtpsecure:-ssl} # Set to ssl to use SSL, or tls to use STARTTLS.
|
||||||
SMTP_AUTHTYPE: ${SMTP_AUTHTYPE:-LOGIN}
|
NC_mail_smtpport: ${NC_mail_smtpport:-465}
|
||||||
SMTP_NAME: ${SMTP_NAME?err}
|
NC_mail_smtpauthtype: ${NC_mail_smtpauthtype:-LOGIN}
|
||||||
SMTP_PASSWORD: ${SMTP_PASSWORD?err}
|
NC_mail_smtpname: ${NC_mail_smtpname:?err}
|
||||||
MAIL_FROM_ADDRESS: ${MAIL_FROM_ADDRESS}
|
NC_mail_smtppassword: ${NC_mail_smtppassword:?err}
|
||||||
MAIL_DOMAIN: ${MAIL_DOMAIN}
|
NC_mail_from_address: ${NC_mail_from_address:?err}
|
||||||
|
NC_mail_domain: ${NC_mail_domain:?err}
|
||||||
|
|
||||||
|
nextcloud-cron:
|
||||||
|
environment:
|
||||||
|
<<: *smtp-configuration
|
||||||
|
|
|
@ -7,7 +7,7 @@ volumes:
|
||||||
services:
|
services:
|
||||||
nextcloud-fpm:
|
nextcloud-fpm:
|
||||||
container_name: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-fpm
|
container_name: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-fpm
|
||||||
image: ${NEXTCLOUD_IMAGE:-nextcloud:23.0.3-fpm-alpine}
|
image: ${NEXTCLOUD_IMAGE:-nextcloud:25.0.2-fpm-alpine}
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
@ -17,6 +17,7 @@ services:
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
environment:
|
environment:
|
||||||
|
&fpm-configuration
|
||||||
NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_TRUSTED_DOMAINS?err}
|
NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_TRUSTED_DOMAINS?err}
|
||||||
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER?err}
|
NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER?err}
|
||||||
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD?err}
|
NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD?err}
|
||||||
|
@ -32,7 +33,7 @@ services:
|
||||||
|
|
||||||
nextcloud-web:
|
nextcloud-web:
|
||||||
container_name: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-web
|
container_name: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-web
|
||||||
build: web
|
build: ${SERVICES_DIR}/nextcloud/web
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
NEXTCLOUD_FPM_CONTAINER_NAME: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-fpm
|
NEXTCLOUD_FPM_CONTAINER_NAME: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-fpm
|
||||||
|
@ -46,15 +47,14 @@ services:
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
|
||||||
nextcloud-cron:
|
nextcloud-cron:
|
||||||
image: ${NEXTCLOUD_IMAGE:-nextcloud:22.2.3-fpm-alpine}
|
image: ${NEXTCLOUD_IMAGE:-nextcloud:25.0.2-fpm-alpine}
|
||||||
container_name: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-cron
|
container_name: ${NEXTCLOUD_CONTAINER_NAME:-nextcloud}-cron
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- nextcloud-web
|
- nextcloud-web
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
environment:
|
environment:
|
||||||
PUID: ${NEXTCLOUD_PUID:-1000}
|
<<: *fpm-configuration
|
||||||
PGID: ${NEXTCLOUD_PGID:-1000}
|
|
||||||
volumes:
|
volumes:
|
||||||
- nextcloud:/var/www/html
|
- nextcloud:/var/www/html
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
. $DIR/../help.sh
|
|
||||||
. $DIR/../postgres/run --only-source
|
|
||||||
|
|
||||||
nextcloud_help() {
|
|
||||||
echo "./run backup : Lancement de la sauvegarde de Nextcloud"
|
|
||||||
echo "./run restore : Restauration de la sauvegarde de Nextcloud"
|
|
||||||
}
|
|
||||||
|
|
||||||
nextcloud_backup() {
|
|
||||||
script_env
|
|
||||||
BACKUP_DATE_DEFAULT=`date +%Y%m%d_%H%M%S`
|
|
||||||
BACKUP_DATE=${BACKUP_DATE:-$BACKUP_DATE_DEFAULT}
|
|
||||||
backup_folder_create
|
|
||||||
|
|
||||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_postgres.sql
|
|
||||||
docker-compose exec --user www-data nextcloud php occ maintenance:mode --on
|
|
||||||
postgres_backup
|
|
||||||
|
|
||||||
docker run -it --rm -v $HOME/backups/${NEXTCLOUD_DOMAIN}:/backup --volumes-from nextcloud alpine:3.12.3 ash -c "cd /var/www/html && tar cvf /backup/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_files.tar ."
|
|
||||||
docker-compose exec --user www-data nextcloud php occ maintenance:mode --off
|
|
||||||
}
|
|
||||||
|
|
||||||
nextcloud_restore() {
|
|
||||||
script_env
|
|
||||||
|
|
||||||
postgres_restore
|
|
||||||
docker run -it --rm -v $HOME/backups/${NEXTCLOUD_DOMAIN}:/backup -v nextcloud:/var/www/html alpine:3.12.3 ash -c "cd /var/www/html && tar xvf /backup/${BACKUP_DATE}_${NEXTCLOUD_DOMAIN}_files.tar --strip 1"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# -ge 1 ]; then
|
|
||||||
if [ "${1}" == "backup" ]; then
|
|
||||||
script_start
|
|
||||||
nextcloud_backup
|
|
||||||
script_end
|
|
||||||
elif [ "${1}" == "restore" ]; then
|
|
||||||
script_start
|
|
||||||
nextcloud_restore
|
|
||||||
script_end
|
|
||||||
elif [ "${1}" != "--only-source" ]; then
|
|
||||||
nextcloud_help
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
nextcloud_help
|
|
||||||
fi
|
|
|
@ -1,3 +1,3 @@
|
||||||
FROM nginx:1.21.5-alpine
|
FROM nginx:1.23.3-alpine
|
||||||
|
|
||||||
COPY nextcloud.conf.template /etc/nginx/templates/default.conf.template
|
COPY nextcloud.conf.template /etc/nginx/templates/default.conf.template
|
||||||
|
|
Loading…
Reference in New Issue