Add instructions to launch a compatible Docker Postgres (#5915)

* Add instructions to launch a Docker Postgres

* Update CONTRIBUTING.md

Co-Authored-By: Tom Fox <tomfox@surprises.io>

* Update CONTRIBUTING.md

Co-Authored-By: Tom Fox <tomfox@surprises.io>
This commit is contained in:
Antoine Cormouls
2019-08-14 10:14:56 +02:00
committed by Tom Fox
parent 1a7f64d8d9
commit b61a34356b

View File

@@ -58,7 +58,7 @@ Once you have babel running in watch mode, you can start making changes to parse
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.
* 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)
* 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).
* 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`
* If your feature is intended to only work with MongoDB, you should disable PostgreSQL-specific tests with:
@@ -66,6 +66,19 @@ If your pull request introduces a change that may affect the storage or retrieva
- `it_only_db('mongo')` // will make a test that only runs on mongo
- `it_exclude_dbs(['postgres'])` // will make a test that runs against all DB's but postgres
#### Run a Parse Postgres with Docker
To launch the compatible Postgres instance, copy and paste the following line into your shell:
```sh
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
```
To stop the Postgres instance:
```sh
docker stop parse-postgres
```
### Generate Parse Server Config Definition
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].