Skip to content

Commit

Permalink
mount a local directory into DB container for saving data after disca… (
Browse files Browse the repository at this point in the history
#2054)

* mount a local directory into DB container for saving data after discarding containers

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

* mount ~/.pg_data as a volume into the container

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

* Update README.md adding data persistence directory

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

* Replace sleep calls with datetime patch (#2079)

* build(deps-dev): bump coverage from 7.6.4 to 7.6.7 (#2076)

Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.6.4 to 7.6.7.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.6.4...7.6.7)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Asa Price <[email protected]>

* update README about existing hosts removal

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Asa Price <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 6, 2024
1 parent 92b8cb0 commit 24ba196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ source .env
To force an ssl connection to the db set `INVENTORY_DB_SSL_MODE` to `"verify-full"`
and provide the path to the certificate you'd like to use.

### Create database data directory
Provide a local directory for holding the database data for persistence. e.g.
```bash
mkdir ~/.pg_data
```
If using a different directory, then update the directory path in `volumes` under `db` in dev.yml > services > db > volumes.

### Install dependencies

This project uses `pipenv` to manage the development and deployment environments.
Expand Down Expand Up @@ -117,7 +124,7 @@ want to destroy that data do the following:
```bash
docker compose -f dev.yml down
```

After running this command, delete the data directory specified in the [create host data directory](#create-database-data-directory) section to ensure the existing data removal.
### Create hosts data in the Database

First, start the `mq` service by running the following command in a new terminal:
Expand Down
3 changes: 3 additions & 0 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ services:
volumes:
- ./.unleash/create_unleashdb.sql:/docker-entrypoint-initdb.d/create_unleashdb.sql
- ./.export-service/create_exportdb.sql:/docker-entrypoint-initdb.d/create_exportdb.sql
# Create .pg_data dir in your home or another destination for saving the db data between runs.
# It is being provided to test DB upgrades
- ~/.pg_data:/var/lib/postgresql/data
healthcheck:
test: "pg_isready -h db"
interval: 2s
Expand Down

0 comments on commit 24ba196

Please sign in to comment.