Store PostgreSQL and Redis data in Docker volumes.

This should solve permission issues that can occur in some cases (e.g.
on Windows PostgreSQL can complain about an ownership mismatch of the
/var/lib/postgresql/data directory).
This commit is contained in:
Orne Brocaar 2019-02-11 15:13:52 +01:00
parent 2ad6a3e571
commit b9178714cc
2 changed files with 13 additions and 5 deletions

View File

@ -15,8 +15,6 @@ but keep in mind that for production usage it might need modifications.
* https://www.loraserver.io/lora-app-server/install/config/
* https://www.loraserver.io/lora-geo-server/install/config/
* `configuration/postgresql/initdb/`: directory containing PostgreSQL initialization scripts
* `data/postgresql`: directory containing the PostgreSQL data (auto-created)
* `data/redis`: directory containing the Redis data (auto-created)
## Configuration
@ -25,6 +23,11 @@ The LoRa Server components are pre-configured to work with the provided
to the `configuration/loraserver/loraserver.toml` configuration file to
configure a different band.
# Data persistence
PostgreSQL and Redis data is persisted in Docker volumes, see the `docker-compose.yml`
`volumes` definition.
## Requirements
Before using this `docker-compose.yml` file, make sure you have [Docker](https://www.docker.com/community-edition)

View File

@ -1,4 +1,4 @@
version: "2"
version: "3"
services:
loraserver:
@ -29,14 +29,19 @@ services:
image: postgres:9.6-alpine
volumes:
- ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
- ./data/postgresql:/var/lib/postgresql/data
- postgresqldata:/var/lib/postgresql/data
redis:
image: redis:4-alpine
volumes:
- ./data/redis:/data
- redisdata:/data
mosquitto:
image: eclipse-mosquitto
ports:
- 1883:1883
volumes:
postgresqldata:
redisdata: