diff options
author | Trevor Bramwell <tbramwell@linuxfoundation.org> | 2017-07-26 11:22:54 -0700 |
---|---|---|
committer | Trevor Bramwell <tbramwell@linuxfoundation.org> | 2017-07-26 16:36:16 -0700 |
commit | 34f15a071a9df12986654593193235a21a774fc8 (patch) | |
tree | 2a043a195b099f620ce85f217eda168dc6b6bea4 /tools | |
parent | 7cbe4e7447280d39fdb5a56b3d9a0fea437b5b15 (diff) |
Mount PostgreSQL Data from Persistent Volume
Each time the postgresql container is torn down the database is lost.
By using a presistent volume managed outside of docker compose, the
postgresql data can persist across updates and service restarts.
The volume needs to exist before the postgres container can start: this
is done with the 'make data' command.
Note: postgres container creates a volume at /var/lib/postgresql/data.
Mounting at this location ensures the data is persisted into the
external volume.
Change-Id: I958ba57fc735c594378d575bc7108bee0d30c1e3
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/pharos-dashboard/Makefile | 3 | ||||
-rw-r--r-- | tools/pharos-dashboard/docker-compose.yml | 5 | ||||
-rw-r--r-- | tools/pharos-dashboard/readme.txt | 3 |
3 files changed, 9 insertions, 2 deletions
diff --git a/tools/pharos-dashboard/Makefile b/tools/pharos-dashboard/Makefile index e52e15d2..90709171 100644 --- a/tools/pharos-dashboard/Makefile +++ b/tools/pharos-dashboard/Makefile @@ -10,6 +10,9 @@ start: stop: docker-compose stop +data: + docker volume create --name=pharos-data + shell-nginx: docker exec -ti ng01 bash diff --git a/tools/pharos-dashboard/docker-compose.yml b/tools/pharos-dashboard/docker-compose.yml index 16b8c0fd..44a263f0 100644 --- a/tools/pharos-dashboard/docker-compose.yml +++ b/tools/pharos-dashboard/docker-compose.yml @@ -50,7 +50,7 @@ services: env_file: config.env volumes: - ./config/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - - /var/lib/pharos_dashboard/postgresql:/var/lib/postgresql + - pharos-data:/var/lib/postgresql/data rabbitmq: restart: always @@ -72,3 +72,6 @@ services: - rabbitmq volumes: - ./:/pharos_dashboard +volumes: + pharos-data: + external: true diff --git a/tools/pharos-dashboard/readme.txt b/tools/pharos-dashboard/readme.txt index b21320f3..2a259129 100644 --- a/tools/pharos-dashboard/readme.txt +++ b/tools/pharos-dashboard/readme.txt @@ -18,6 +18,7 @@ Deployment: - install docker, docker-compose and bower - run 'bower install' in ./src/static/ to fetch javascript dependencies - run 'make build' to build the containers +- run 'make data' - run 'make up' to run the dashboard Updating: @@ -32,4 +33,4 @@ If there is migrations that need user input (like renaming a field), they need t Logs / Shell access: -- there is some shortcuts in the makefile
\ No newline at end of file +- there is some shortcuts in the makefile |