Last active
July 6, 2024 01:07
-
-
Save mrzapp/08947dd861bc826c4e02cee2d4da51ae to your computer and use it in GitHub Desktop.
NextCloud setup for Docker (docker-compose) with Collabora, NGINX, Redis and Postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
I have the same issue, I guess there should be some
.env
or other way to send configuration information to the docker-compose script