nextcloud - docker composer 一把梭
date
Jun 15, 2022
slug
newsoftware-nextcloud-docker-composer
status
Published
summary
新软件 NextCloud
tags
software
type
Post
URL
参考服务器端安装修改 vi config/www/nextcloud/config/config.phpnpm proxy manager 配置登陆出现问题(无登录框)- CloudFlare来背锅preview generator + cron 客户端配置
upgrade software (like php) inside docker
参考
服务器端安装
export DOCKER_PROJ=nextcloud
export DOCKER_PORT=18440
export DOCKER_PWD=rV99n4239M3
mkdir /data/$DOCKER_PROJ; cd /data/$DOCKER_PROJ
# link to another storage location with existing files
mkdir config data
cd data
ln -s /drive/gd_stanford/_host/bwh5g5t/nextcloud_data/nc nc
ln -s /drive/gd_stanford/_host/bwh5g5t/nextcloud_data/ss ss
cat > docker-compose.yml <<EOF
---
version: "2.1"
services:
nextcloud:
image: lscr.io/linuxserver/nextcloud:latest
container_name: nextcloud
environment:
- PUID=1000
- PGID=1000
- TZ=Asia/Hong_Kong
- MYSQL_HOST=nextcloud_mariadb
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD=$DOCKER_PWD
volumes:
- ./config:/config
- ./data:/data
- ./data/nc:/data/nc
- ./data/ss:/data/ss
#ports:
# - '18440:80'
# - 443:443
restart: unless-stopped
nextcloud_mariadb:
image: lscr.io/linuxserver/mariadb:latest
container_name: nextcloud_mariadb
environment:
- PUID=1000
- PGID=1000
- MYSQL_ROOT_PASSWORD=$DOCKER_PWD
- TZ=Asia/Hong_Kong
- MYSQL_DATABASE=nextcloud #optional
- MYSQL_USER=nextcloud #optional
- MYSQL_PASSWORD=$DOCKER_PWD #optional
#- REMOTE_SQL=http://URL1/your.sql,https://URL2/your.sql #optional
volumes:
- ./mariadb:/config
#ports:
# - 3306:3306
restart: unless-stopped
nextcloud_redis:
image: redis:alpine
container_name: nextcloud_redis
restart: always
#ports:
# - 16379:6379
restart: always
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f
chown -R www:www ./config && chmod 755 ./config
chown -R www:www ./data && chmod 755 ./data
chown -R www:www ./mariadb && chmod 755 ./mariadb
修改 vi config/www/nextcloud/config/config.php
<?php
$CONFIG = array (
'memcache.local' => '\\OC\\Memcache\\APCu',
修改
vi config/nginx/site-confs/default
# set max upload size
client_body_timeout 300s;
fastcgi_buffers 64 4K;
client_max_body_size 1024M;
fastcgi_connect_timeout 1200;
fastcgi_send_timeout 1200;
fastcgi_read_timeout 1200;
npm proxy manager 配置
登陆出现问题(无登录框)- CloudFlare来背锅
preview generator + cron
# 先安装Preview Generator APP
docker exec -it nextcloud bash
occ config:system:set preview_max_x --value 1024
occ config:system:set preview_max_y --value 1024
occ config:app:set previewgenerator squareSizes --value="32 256"
occ config:app:set previewgenerator widthSizes --value="256 384"
occ config:app:set previewgenerator heightSizes --value="256"
occ config:system:set jpeg_quality --value 60
occ config:app:set preview jpeg_quality --value="60"
occ files:scan --all
occ files:scan-app-data
occ preview:generate-all -vvv
occ preview:pre-generate -v
# add to cronjob of host (not inside docker)
crontab -e
# every 30 mins
*/30 * * * * docker exec -it nextcloud occ preview:pre-generate
客户端配置
upgrade software (like php) inside docker
docker exec -it nextcloud apk update
docker exec -it nextcloud apk upgrade