Skip to content

Instantly share code, notes, and snippets.

@mrzapp
Last active March 27, 2024 03:44
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mrzapp/08947dd861bc826c4e02cee2d4da51ae to your computer and use it in GitHub Desktop.
Save mrzapp/08947dd861bc826c4e02cee2d4da51ae 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;
}
}
@lipunis
Copy link

lipunis commented Jan 21, 2024

After installation, he does not allow using Postgres, writes that the login:password does not fit. I write the name of the database postgres. What am I doing wrong? Thanks

@otvoslaszlogabriel
Copy link

@lipunis is this occurring when you setup nextcloud admin? the HOST for db needs to be properly set up let me know if you need help.. i will give this a tray later today. i need Colabora running separately

@nixoletas
Copy link

nixoletas commented Mar 27, 2024

Hey man! Thanks for this amazing docker-compose. Any idea on why collabora might not be appearing in nextcloud, no options to set it up. Tried disabling SSL and server :1001 shows OK but still get nothing. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment