Skip to content

Commit

Permalink
Improve SQLDumpRestoration.md and README.md files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawadi Kiran committed Sep 3, 2024
1 parent 52521e3 commit a7f823a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ $ docker cp /path/to/your/backup.json container_name:/path/inside/container/back
$ docker-compose -f local.yml run --rm django python manage.py loaddata /path/inside/the/container/backup.json
$ docker-compose -f local.yml run --rm django python manage.py migrate
```
### Restoring the Database from a SQL Dump
If the JSON file is particularly large (>1.5GB), Docker might struggle with this method. In such cases, you can use SQL dump and restore commands as an alternative, as described [here](./SQLDumpRestoration.md).



## Additional Commands

Expand Down Expand Up @@ -191,8 +195,7 @@ Documented [here](https://github.com/NASA-IMPACT/sde-indexing-helper/wiki/How-to

## Adding New Features/Fixes

1. Start with a [GitHub issue](https://github.com/NASA-IMPACT/sde-indexing-helper/issues).
2. Use the GitHub CLI to create branches and pull requests (`gh issue develop -c <issue_number>`).
We welcome contributions to improve the project! Before you begin, please take a moment to review our [Contributing Guidelines](./CONTRIBUTING.md). These guidelines will help you understand the process for submitting new features, bug fixes, and other improvements.

## Job Creation

Expand Down
16 changes: 10 additions & 6 deletions SQLDumpRestoration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ $ docker exec -it 23d33f22cc43 bash
3. Create a connection to the database.

```
psql -U VnUvMKBSdkoFIETgLongnxYHrYVJKufn -d sde_indexing_helper
psql -U <POSTGRES_USER> -d <POSTGRES_DB>
```

4. Ensure that the database `sde_indexing_helper` is empty.
**Note**:
- For local deployment, refer to the `.envs/.local/.postgres` file for the `POSTGRES_USER` and `POSTGRES_DB` variables.
- For production deployment, refer to the `.envs/.production/.postgres` file.

4. Ensure that the database `<POSTGRES_DB>` is empty. Here's an example:

```
sde_indexing_helper-# \c
Expand All @@ -44,8 +48,8 @@ Did not find any relations.
If the database is not empty, delete its contents to create a fresh database:

```
sde_indexing_helper=# \c postgres
You are now connected to database "postgres" as user "VnUvMKBSdkoFIETgLongnxYHrYVJKufn".
sde_indexing_helper=# \c postgres //connect to a different database before dropping
You are now connected to database "postgres" as user "VnUvMKBSdk....".
postgres=# DROP DATABASE sde_indexing_helper;
DROP DATABASE
postgres=# CREATE DATABASE sde_indexing_helper;
Expand All @@ -62,13 +66,13 @@ docker cp /local/path/backup.sql 23d33f22cc43:/
6. Import the SQL dump into the PostgreSQL container.

```
psql -U VnUvMKBSdkoFIETgLongnxYHrYVJKufn -d sde_indexing_helper -f backup.sql
psql -U <POSTGRES_USER> -d <POSTGRES_DB> -f backup.sql
```

**Note**: To create a SQL dump of your PostgreSQL database, use the following command:

```
pg_dump -U VnUvMKBSdkoFIETgLongnxYHrYVJKufn -W -F p -f backup.sql sde_indexing_helper
pg_dump -U <POSTGRES_USER> -W -F p -f backup.sql <POSTGRES_DB>
```

7. Bring up all containers at once, and create a superuser account for logging in.
Expand Down

0 comments on commit a7f823a

Please sign in to comment.