* Attempting to fix Postgres issue
* Attempting to fix Postgres issue
trying to stop loop
* Attempting to fix Postgres
isolating postgres calls
* Attempting to fix Postgres issue
Separating jobs
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
Separating builds again
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
Just added back version 10, just in case it gets called
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Update .travis.yml
* Attempting to fix postgres
Removed postgres installs from unneeded test cases. Added the ability to test Postgres 10 and 11
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
* Attempting to fix postgres
Added test for postgres 12 that's allowed to fail
* Attempting to fix postgres
* Attempting to fix postgres
Second round to see if it fails eventually
* Attempting to fix postgres
Round 3
* Attempting to fix postgres
Allowing all postgres to fail since it seems to occur randomly
* Temporary fix: separated mongo and postgres in travis
Now the mongo and postgres scripts are independent of each other to prevent the `ERROR: could not access file "$libdir/postgis-2.4": No such file or directory` of showing up in the rest of the builds.
In addition, a test for postgres-12 has been added for future compatibility. Both the postgres-11 and postgres-12 have been added to `allow_failures` because the aforementioned error still creeps up. Important note is that the error has nothing to do with compatibility with postgres, but rather seems to be an error of how postgres (or really postgis) is being referenced in the respective travis distribution. Lastly, this error, if truly random should appear less than before as the postgres scripts aren't being run for every build as it previously was running.
* Allowing all postgres to fail
* Allowing multiple names to fail
* Removing preinstalled versions of postgres from list
Seeing if this gets rid of the random error
* Use postgres made for dist
* Second round
* Round 3
* Round 4
* Round 5
* Fixed issue with random postgres fail
Removing the native postgres builds at the right time seems to have fixed the random error from before.
The postgres tests are now not allowed to fail.
* Added back postgres 11 and 12 to allow_failures
The actual problem is fixed, but it seems there are some instability with some of the test cases for postgres that need to be addressed at another time.
The issues that pop up are:
- Postgres-11
```Failures:
1) Cloud Code cloud jobs should set the message / success on the job
Message:
Expected undefined to equal 'hello'.
Stack:
Error: Expected undefined to equal 'hello'.
at <Jasmine>
at req.message.then.then.jobStatus (/home/travis/build/parse-community/parse-server/spec/CloudCode.spec.js:1571:46)
at process._tickCallback (internal/process/next_tick.js:68:7)
```
- Postgres-12
```
Failures:
1) Cloud Code cloud jobs should set the message / success on the job
Message:
Expected undefined to equal 'hello'.
Stack:
Error: Expected undefined to equal 'hello'.
at <Jasmine>
at req.message.then.then.jobStatus (/home/travis/build/parse-community/parse-server/spec/CloudCode.spec.js:1571:46)
at process._tickCallback (internal/process/next_tick.js:68:7)
Message:
Expected 'running' to equal 'succeeded'.
Stack:
Error: Expected 'running' to equal 'succeeded'.
at <Jasmine>
at promise.then.then.jobStatus (/home/travis/build/parse-community/parse-server/spec/CloudCode.spec.js:1580:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
```
* added travis scripts for postgres
* Setting up before_install and before_script
This should shrink the footprint of the file and and reduce the redundancy of calls for postgres.
Added support for testing of Postgres 9 and 10 in the scripts, not adding the tests though
* make scripts executable
* Update .travis.yml
* add sourcing in script
* trying to fix source
* fixing env var in script
* fixed ; near then
* Cleaning up travis file
removed old lines
* Finishing clean up
* Fixing allow_failures since "name" was removed
* Update .travis.yml
* Removed Postgres 11 from allow_failures
* I think using travis default postgres port of 5433 will allow us to not have to remove anything from the image
* Switching travis to postgres port 5433
* modifying script for test
* modifying script for test
* modifying script for test
* reverting back to working way with removing postgres from image
* Reverted back to removing postgres from image
* removing postgres 12
* removed postgres-12 from allow_failures
* updated postgres method from deprecated. Also updating postgis to 3.0
* updated postgis to 3.0
* Update .travis.yml
* fix Postgres test issues that causes some tests to fail locally when using PARSE_SERVER_TEST_DATABASE_URI
* removed dependence on creating adapter locally in testcase and use config instead.
* fixed one more potential issue with postgres adapter
* modified travis and script to leverage PARSE_SERVER_TEST_DATABASE_URI
* changes to before install to reduce time
* add updated port to script for psql connection
* fixed arg for psql
* added back conf file as it probably contains the default permissions
* seeing if stopping/starting postgres back-to-back was the issue
* checking fix
* revert to working version of install script
* leave default port
* removing uninstall of postgres from script
* looks like postgres won't start until the others are removed
* forgoing using posgres service and starting directly, hoping it allows to skip remove
* removed sudo for starting postgres
* adding back sude, but using default user for postgres
* fix
* don't start service
* init db cluster before starting
* remove folder befor init
* remove folder befor init
* still have to stop service
* switch ports after new configs are made
* switch ports after new configs are made
* went back to removing to get it to start properly
* seeing if you can use postgres installaition out of the box
* seeing if you can use postgres installaition out of the box
* copy hba file, then stop,start
* testing using port as argument
* working version
* round 2
* updated documentation to reflect changes
* use restart instead of stop/start for postgres
* removed extra lines to ensure consistency with future builds
* reload instead of restart postgres
* restart postgres since we can't currently connect
* Switch to testonly for postgres
* run testonly
* Declare as mongo test since it's handed coded to a mongo uri
6.3 KiB
Contributing to Parse Server
We really want Parse to be yours, to see it grow and thrive in the open source community.
If you are not familiar with Pull Requests and want to know more about them, you can visit the Creating a pull request article. It contains detailed informations about the process.
Setting up the project for debugging and contributing:
Recommended setup:
- vscode, the popular IDE.
- Jasmine Test Explorer, a very practical test exploration plugin which let you run, debug and see the test results inline.
Setting up you local machine:
- Fork this project and clone the fork on your local machine:
$ git clone https://github.com/parse-community/parse-server
$ cd parse-server # go into the clone directory
$ npm install # install all the node dependencies
$ code . # launch vscode
$ npm run watch # run babel watching for local file changes
To launch VS Code from the terminal with the
codecommand you first need to follow the launching from the command line section in the VS Code setup documentation.
Once you have babel running in watch mode, you can start making changes to parse-server.
Good to know:
- The
lib/folder is not commited, so never make changes in there. - Always make changes to files in the
src/folder. - All the tests should point to sources in the
lib/folder.
Troubleshooting:
Question: I modify the code in the src folder but it doesn't seem to have any effect.
Answer: Check that npm run watch is running
Question: How do I use breakpoints and debug step by step?
Answer: The easiest way is to install Jasmine Test Explorer, it will let you run selectively tests and debug them.
Question: How do I deploy my forked version on my servers?
Answer: In your package.json, update the parse-server dependency to https://github.com/MY_USERNAME/parse-server#MY_FEATURE. Run npm install, commit the changes and deploy to your servers.
Please Do's
- Begin by reading the Development Guide to learn how to get started running the parse-server.
- Take testing seriously! Aim to increase the test coverage with every pull request. To obtain the test coverage of the project, run:
npm run coverage - Run the tests for the file you are working on with the following command:
npm test spec/MyFile.spec.js - Run the tests for the whole project to make sure the code passes all tests. This can be done by running the test command for a single file but removing the test file argument. The results can be seen at <PROJECT_ROOT>/coverage/lcov-report/index.html.
- Lint your code by running
npm run lintto make sure the code is not going to be rejected by the CI. - Do not publish the lib folder.
Run your tests against Postgres (optional)
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 PARSE_SERVER_TEST_DATABASE_URI=postgres://postgres:password@localhost:5432/parse_server_postgres_adapter_test_database npm run testonly. You'll need to have postgres running on your machine and setup appropriately or useDocker. -
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:
describe_only_db('mongo')// will create adescribethat runs only on mongoDBit_only_db('mongo')// will make a test that only runs on mongoit_exclude_dbs(['postgres'])// will make a test that runs against all DB's but postgres
-
Similarly, if your feature is intended to only work with PostgreSQL, you should disable MongoDB-specific tests with:
describe_only_db('postgres')// will create adescribethat runs only on postgresit_only_db('postgres')// will make a test that only runs on postgresit_exclude_dbs(['mongo'])// will make a test that runs against all DB's but mongo
Run a Parse Postgres with Docker
To launch the compatible Postgres instance, copy and paste the following line into your shell:
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:
docker stop parse-postgres
Generate Parse Server Config Definition
If you want to make changes to Parse Server Configuration add the desired configuration to src/Options/index.js and run npm run definitions. This will output src/Options/Definitions.js and src/Options/docs.js.
To view docs run npm run docs and check the /out directory.
Code of Conduct
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to honor this code.