mirror of
https://github.com/Thumbscrew/nextcloud-docker-compose.git
synced 2025-01-18 09:35:46 +00:00
feat: Separate compose files (#1)
* separate postgres db into separate override compose file * add instructions for docker compose up with or without postgres
This commit is contained in:
parent
2df8d080b3
commit
4275b50e2d
@ -11,3 +11,4 @@ NEXTCLOUD_MEM_LIMIT=4g
|
|||||||
|
|
||||||
# postgres
|
# postgres
|
||||||
POSTGRES_TAG=14
|
POSTGRES_TAG=14
|
||||||
|
POSTGRES_HOST=db
|
@ -1,5 +1,5 @@
|
|||||||
# Nextcloud (Docker Compose)
|
# Nextcloud (Docker Compose)
|
||||||
Build a Nextcloud instance in Docker Compose complete with PostgreSQL and Redis
|
Build a Nextcloud instance in Docker Compose complete with Redis and optional PostgreSQL
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@ -36,7 +36,11 @@ cp .env.example .env
|
|||||||
7. Bring up the containers!
|
7. Bring up the containers!
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# No PostgreSQL (if you have your own PostgreSQL DB)
|
||||||
sudo docker-compose -p nextcloud up --build -d
|
sudo docker-compose -p nextcloud up --build -d
|
||||||
|
|
||||||
|
# With Dockerized PostgreSQL
|
||||||
|
sudo docker-compose -f docker-compose.yaml -f docker-compose.db.yaml -p nextcloud up --build -d
|
||||||
```
|
```
|
||||||
|
|
||||||
8. (Optional) To enable some file previews copy [previews.config.php](nextcloud/previews.config.php) into your Nextcloud's `config` directory (replace `$volume` with the path you have set in the `VOLUME_PATH` environment variable):
|
8. (Optional) To enable some file previews copy [previews.config.php](nextcloud/previews.config.php) into your Nextcloud's `config` directory (replace `$volume` with the path you have set in the `VOLUME_PATH` environment variable):
|
||||||
|
24
docker-compose.db.yaml
Normal file
24
docker-compose.db.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:${POSTGRES_TAG}
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ${VOLUME_PATH}/var/lib/postgresql/data:/var/lib/postgresql/data:rw
|
||||||
|
secrets:
|
||||||
|
- postgres_db
|
||||||
|
- postgres_user
|
||||||
|
- postgres_password
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
||||||
|
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
||||||
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||||
|
nextcloud:
|
||||||
|
environment:
|
||||||
|
POSTGRES_HOST: db
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
cron:
|
||||||
|
depends_on:
|
||||||
|
- db
|
@ -17,22 +17,6 @@ networks:
|
|||||||
backend:
|
backend:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
|
||||||
image: postgres:${POSTGRES_TAG}
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- ${VOLUME_PATH}/var/lib/postgresql/data:/var/lib/postgresql/data:rw
|
|
||||||
secrets:
|
|
||||||
- postgres_db
|
|
||||||
- postgres_user
|
|
||||||
- postgres_password
|
|
||||||
networks:
|
|
||||||
- backend
|
|
||||||
environment:
|
|
||||||
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
|
||||||
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
|
||||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@ -62,14 +46,13 @@ services:
|
|||||||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||||||
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
POSTGRES_DB_FILE: /run/secrets/postgres_db
|
||||||
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
POSTGRES_USER_FILE: /run/secrets/postgres_user
|
||||||
POSTGRES_HOST: db
|
POSTGRES_HOST: ${POSTGRES_HOST}
|
||||||
NEXTCLOUD_ADMIN_PASSWORD_FILE: /run/secrets/nextcloud_admin_password
|
NEXTCLOUD_ADMIN_PASSWORD_FILE: /run/secrets/nextcloud_admin_password
|
||||||
NEXTCLOUD_ADMIN_USER_FILE: /run/secrets/nextcloud_admin_user
|
NEXTCLOUD_ADMIN_USER_FILE: /run/secrets/nextcloud_admin_user
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_DOMAIN}
|
NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_DOMAIN}
|
||||||
OVERWRITEPROTOCOL: https
|
OVERWRITEPROTOCOL: https
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
cron:
|
cron:
|
||||||
@ -81,5 +64,4 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
entrypoint: /cron.sh
|
entrypoint: /cron.sh
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
|
||||||
- redis
|
- redis
|
||||||
|
Loading…
Reference in New Issue
Block a user