Создаём структуру и необходимые файлы для запуска Nextcloud с использованием PostgreSQL и Redis. Обязательно замените (yourdomain)
на ваше доменное имя и (youpassword)
на желаемый пароль.
docker-compose.yml
:mkdir nextcloud
touch nextcloud/docker-compose.yml
docker-compose.yml
:version: "3"
services:
nextcloud-postgres:
image: postgres
container_name: nextcloud-postgres
restart: unless-stopped
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: (youpassword)
volumes:
- ./database:/var/lib/postgresql/data
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "nextcloud", "-U", "nextcloud" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 60s
nextcloud-redis:
image: redis
container_name: nextcloud-redis
command: ["redis-server", "--requirepass", "(youpassword)"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 60s
restart: unless-stopped
nextcloud-app:
image: nextcloud
container_name: nextcloud-app
restart: unless-stopped
environment:
NEXTCLOUD_TRUSTED_DOMAINS: nextcloud.(yourdomain)
OVERWRITECLIURL: https://nextcloud.(yourdomain)
OVERWRITEPROTOCOL: https
OVERWRITEHOST: nextcloud.(yourdomain)
TZ: Europe/Astrakhan
POSTGRES_HOST: nextcloud-postgres
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: (youpassword)
REDIS_HOST: nextcloud-redis
REDIS_HOST_PASSWORD: (youpassword)
NEXTCLOUD_ADMIN_USER: nextcloud_admin
NEXTCLOUD_ADMIN_PASSWORD: (youpassword)
volumes:
- ./app:/var/www/html
depends_on:
nextcloud-postgres:
condition: service_healthy
nextcloud-redis:
condition: service_healthy
labels:
- traefik.enable=true
- traefik.http.middlewares.nextcloud-app_https.redirectscheme.scheme=https
- traefik.http.routers.nextcloud-app.entrypoints=web
- traefik.http.routers.nextcloud-app.middlewares=nextcloud-app_https@docker
- traefik.http.routers.nextcloud-app.rule=Host(`nextcloud.(yourdomain)`)
- traefik.http.routers.nextcloud-app_https.entrypoints=websecure
- traefik.http.routers.nextcloud-app_https.rule=Host(`nextcloud.(yourdomain)`)
- traefik.http.routers.nextcloud-app_https.tls=true
- traefik.http.services.nextcloud-app.loadbalancer.server.port=80
- traefik.http.routers.nextcloud-app_https.tls.certresolver=le
networks:
default:
external:
name: traefik_network
⚠️ Примечание: Замените
(yourdomain)
на ваш реальный домен и(youpassword)
на выбранный пароль.
Теперь вы готовы к запуску Nextcloud!