Skip to content

Commit b61a343

Browse files
MoumoulsTomWFox
andcommitted
Add instructions to launch a compatible Docker Postgres (#5915)
* Add instructions to launch a Docker Postgres * Update CONTRIBUTING.md Co-Authored-By: Tom Fox <[email protected]> * Update CONTRIBUTING.md Co-Authored-By: Tom Fox <[email protected]>
1 parent 1a7f64d commit b61a343

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

CONTRIBUTING.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,27 @@ Once you have babel running in watch mode, you can start making changes to parse
5858

5959
If your pull request introduces a change that may affect the storage or retrieval of objects, you may want to make sure it plays nice with Postgres.
6060

61-
* Run the tests against the postgres database with `PARSE_SERVER_TEST_DB=postgres npm test`. You'll need to have postgres running on your machine and setup [appropriately](https://github.com/parse-community/parse-server/blob/master/.travis.yml#L37)
61+
* Run the tests against the postgres database with `PARSE_SERVER_TEST_DB=postgres npm test`. You'll need to have postgres running on your machine and setup [appropriately](https://github.com/parse-community/parse-server/blob/master/.travis.yml#L37) or use [`Docker`](#run-a-parse-postgres-with-docker).
6262
* The Postgres adapter has a special debugger that traces all the sql commands. You can enable it with setting the environment variable `PARSE_SERVER_LOG_LEVEL=debug`
6363
* If your feature is intended to only work with MongoDB, you should disable PostgreSQL-specific tests with:
6464

6565
- `describe_only_db('mongo')` // will create a `describe` that runs only on mongoDB
6666
- `it_only_db('mongo')` // will make a test that only runs on mongo
6767
- `it_exclude_dbs(['postgres'])` // will make a test that runs against all DB's but postgres
6868

69+
#### Run a Parse Postgres with Docker
70+
71+
To launch the compatible Postgres instance, copy and paste the following line into your shell:
72+
73+
```sh
74+
docker run -d --name parse-postgres -p 5432:5432 -e POSTGRES_USER=$USER --rm mdillon/postgis:11-alpine && sleep 5 && docker exec -it parse-postgres psql -U $USER -c 'create database parse_server_postgres_adapter_test_database;' && docker exec -it parse-postgres psql -U $USER -c 'CREATE EXTENSION postgis;' -d parse_server_postgres_adapter_test_database && docker exec -it parse-postgres psql -U $USER -c 'CREATE EXTENSION postgis_topology;' -d parse_server_postgres_adapter_test_database
75+
```
76+
To stop the Postgres instance:
77+
78+
```sh
79+
docker stop parse-postgres
80+
```
81+
6982
### Generate Parse Server Config Definition
7083

7184
If you want to make changes to [Parse Server Configuration][config] add the desired configuration to [src/Options/index.js][config-index] and run `npm run definitions`. This will output [src/Options/Definitions.js][config-def] and [src/Options/docs.js][config-docs].

0 commit comments

Comments
 (0)