nextcloud-docker-compose/README.md

48 lines
1.8 KiB
Markdown
Raw Normal View History

2022-01-31 21:39:54 +00:00
# Nextcloud (Docker Compose)
Build a Nextcloud instance in Docker Compose complete with PostgreSQL and Redis
2022-01-31 21:39:54 +00:00
2022-02-02 17:08:49 +00:00
## Prerequisites
2022-01-31 21:39:54 +00:00
1. [Docker](https://docs.docker.com/engine/install/)
2. [Docker Compose](https://docs.docker.com/compose/install/)
3. A reverse proxy on its own Docker network
2022-01-31 21:39:54 +00:00
2022-02-27 16:19:06 +00:00
### <a id="ReverseProxy">Reverse Proxy Docker Network</a>
This Docker Compose file assumes you have a reverse proxy (like Nginx) in a Docker container on another Docker network. If you are not using a reverse proxy or do not wish to use the Docker network to connect the reverse proxy, you can set the `frontend` network's `external` property to be `false` in [docker-compose.yaml](docker-compose.yaml). You may also need to expose the HTTP port (80) on the `nextcloud` service.
2022-02-02 17:08:49 +00:00
## Setup
2022-01-31 21:39:54 +00:00
1. Create a copy of `.env.example`:
```bash
cp .env.example .env
```
2022-02-27 16:19:06 +00:00
2. Replace the `DOCKER_PROXY_NETWORK` variable with the Docker network where your reverse proxy sits (see [Reverse Proxy Docker Network](#ReverseProxy))
3. Replace the `NEXTCLOUD_HOST` variable with your desired domain
2022-01-31 21:39:54 +00:00
2022-02-27 16:19:06 +00:00
4. Replace `VOLUME_PATH` variable if you wish to change where volume data is stored
2022-01-31 21:39:54 +00:00
2022-02-27 16:19:06 +00:00
5. Modify other variables as needed
2022-01-31 21:39:54 +00:00
2022-02-27 16:19:06 +00:00
6. Create the following required secrets files (you should consider restricting access to these files):
2022-01-31 21:39:54 +00:00
- `secrets/postgres_password.txt`
- `secrets/nextcloud_admin_user.txt`
- `secrets/nextcloud_admin_password.txt`
2022-01-31 21:39:54 +00:00
2022-02-27 16:19:06 +00:00
7. Bring up the containers!
2022-01-31 21:39:54 +00:00
```bash
2022-01-31 22:55:25 +00:00
sudo docker-compose -p nextcloud up --build -d
2022-01-31 21:39:54 +00:00
```
2022-02-27 16:19:06 +00:00
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):
```bash
sudo cp nextcloud/previews.config.php $volume/var/www/html/config/
sudo chown www-data:root $volume/var/www/html/config/previews.config.php
```