From b9178714ccf721f24f483ffe5eca8abbdaef861a Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Mon, 11 Feb 2019 15:13:52 +0100 Subject: [PATCH] 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). --- README.md | 7 +++++-- docker-compose.yml | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a4d0118..8bb06ee 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docker-compose.yml b/docker-compose.yml index 450aba7..d73be9b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: +