Skip to content

Instantly share code, notes, and snippets.

@aa6my
Forked from mrzapp/docker-compose.yml
Created November 16, 2023 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aa6my/3f2ab9718c2d725f51c05b3020ba93bf to your computer and use it in GitHub Desktop.
Save aa6my/3f2ab9718c2d725f51c05b3020ba93bf to your computer and use it in GitHub Desktop.
NextCloud setup for Docker (docker-compose) with Collabora, NGINX, Redis and Postgres
version: "3.4"
networks:
example-com--postgres: ~
example-com--redis: ~
services:
# PostgreSQL
postgres:
container_name: example-com--postgres
environment:
- POSTGRES_PASSWORD=somepassword
- POSTGRES_USER=someuser
image: postgres:latest
restart: always
volumes:
- "./postgres/init:/docker-entrypoint-initdb.d/"
- "./postgres/data:/var/lib/postgresql/data"
- "/etc/localtime:/etc/localtime:ro"
networks:
- example-com--postgres
# NextCloud
nextcloud:
container_name: example-com--nextcloud
depends_on:
- postgres
image: nextcloud:latest
restart: always
ports:
- 1000:80
volumes:
- "./nextcloud/data:/var/www/html/data"
- "./nextcloud/config:/var/www/html/config"
- "./nextcloud/themes:/var/www/html/themes"
- "./nextcloud/custom_apps:/var/www/html/custom_apps"
- "/etc/localtime:/etc/localtime:ro"
networks:
- example-com--postgres
- example-com--redis
# Redis
redis:
container_name: example-com--redis
image: redis:latest
restart: always
networks:
- example-com--redis
# Collabora
collabora:
container_name: example-com--collabora
image: collabora/code:latest
cap_add:
- MKNOD
environment:
- domain=cloud\.example\.com
- username=someuser
- password=somepassword
ports:
- 1001:9980
restart: always
volumes:
- "/etc/localtime:/etc/localtime:ro"
# NextCloud
server {
server_name cloud.example.com;
location / {
proxy_pass http://localhost:1000;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
client_max_body_size 512M;
}
}
# Collabora
server {
server_name office.example.com;
location / {
proxy_pass http://localhost:1001;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
# static files
location ^~ /loleaflet {
proxy_pass https://localhost:1001;
proxy_set_header Host $http_host;
}
# WOPI discovery URL
location ^~ /hosting/discovery {
proxy_pass https://localhost:1001;
proxy_set_header Host $http_host;
}
# main websocket
location ~ ^/lool/(.*)/ws$ {
proxy_pass https://localhost:1001;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
# download, presentation and image upload
location ~ ^/lool {
proxy_pass https://localhost:1001;
proxy_set_header Host $http_host;
}
# Admin Console websocket
location ^~ /lool/adminws {
proxy_pass https://localhost:1001;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
# Hosting capabilities, such as mobile support
location ^~ /hosting/capabilities {
proxy_pass https://localhost:1001;
proxy_set_header Host $http_host;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment