diff --git a/.travis.yml b/.travis.yml index eb0c6f89a..c266b5f0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ install: - docker-compose -f docker-compose.yml -f docker-compose.travis.yml up --build -d # avoid "Database constraints have changed after this transaction started" - wait-on http://localhost:7474 + - docker-compose exec neo4j db_setup script: - export CYPRESS_RETRIES=1 diff --git a/backend/package.json b/backend/package.json index 294c61cf6..3c3f16096 100644 --- a/backend/package.json +++ b/backend/package.json @@ -50,7 +50,7 @@ "apollo-link-context": "~1.0.18", "apollo-link-http": "~1.5.15", "apollo-server": "~2.8.2", - "apollo-server-express": "^2.8.1", + "apollo-server-express": "^2.9.0", "babel-plugin-transform-runtime": "^6.23.0", "bcryptjs": "~2.4.3", "cheerio": "~1.0.0-rc.3", @@ -110,7 +110,7 @@ "@babel/plugin-proposal-throw-expressions": "^7.2.0", "@babel/preset-env": "~7.5.5", "@babel/register": "~7.5.5", - "apollo-server-testing": "~2.8.2", + "apollo-server-testing": "~2.9.0", "babel-core": "~7.0.0-0", "babel-eslint": "~10.0.2", "babel-jest": "~24.9.0", diff --git a/backend/src/middleware/sentryMiddleware.js b/backend/src/middleware/sentryMiddleware.js index b1130ad37..da8ef32d0 100644 --- a/backend/src/middleware/sentryMiddleware.js +++ b/backend/src/middleware/sentryMiddleware.js @@ -14,13 +14,16 @@ if (sentryConfigs.SENTRY_DSN_BACKEND) { }, withScope: (scope, error, context) => { scope.setUser({ - id: context.user.id, + id: context.user && context.user.id, }) scope.setExtra('body', context.req.body) scope.setExtra('origin', context.req.headers.origin) scope.setExtra('user-agent', context.req.headers['user-agent']) }, }) +} else { + // eslint-disable-next-line no-console + if (process.env.NODE_ENV !== 'test') console.log('Warning: Sentry middleware inactive.') } export default sentryMiddleware diff --git a/backend/yarn.lock b/backend/yarn.lock index 39a7a152c..288af0717 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1702,6 +1702,33 @@ apollo-server-core@2.8.2: subscriptions-transport-ws "^0.9.11" ws "^6.0.0" +apollo-server-core@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.9.0.tgz#5db251093ee121a5f4d90a24d51aa4c21e421243" + integrity sha512-IvKIgqOqEEB8nszlpHWzlhAu4376So2PgNhFP6UrlfNTllt/WDti5YMOHnVimPWIDHmLPKFan0+wfzpsoRCRdg== + dependencies: + "@apollographql/apollo-tools" "^0.4.0" + "@apollographql/graphql-playground-html" "1.6.24" + "@types/graphql-upload" "^8.0.0" + "@types/ws" "^6.0.0" + apollo-cache-control "0.8.1" + apollo-datasource "0.6.1" + apollo-engine-reporting "1.4.3" + apollo-server-caching "0.5.0" + apollo-server-env "2.4.1" + apollo-server-errors "2.3.1" + apollo-server-plugin-base "0.6.1" + apollo-server-types "0.2.1" + apollo-tracing "0.8.1" + fast-json-stable-stringify "^2.0.0" + graphql-extensions "0.10.0" + graphql-tag "^2.9.2" + graphql-tools "^4.0.0" + graphql-upload "^8.0.2" + sha.js "^2.4.11" + subscriptions-transport-ws "^0.9.11" + ws "^6.0.0" + apollo-server-env@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/apollo-server-env/-/apollo-server-env-2.4.1.tgz#58264ecfeb151919e0f480320b4e3769be9f18f3" @@ -1715,7 +1742,7 @@ apollo-server-errors@2.3.1: resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-2.3.1.tgz#033cf331463ebb99a563f8354180b41ac6714eb6" integrity sha512-errZvnh0vUQChecT7M4A/h94dnBSRL213dNxpM5ueMypaLYgnp4hiCTWIEaooo9E4yMGd1qA6WaNbLDG2+bjcg== -apollo-server-express@2.8.2, apollo-server-express@^2.8.1: +apollo-server-express@2.8.2: version "2.8.2" resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-2.8.2.tgz#cd1c6994cf5adceea057a088aff52f289bb36377" integrity sha512-eA7IupNbx3PjIW4E0uMjQU9WvxcHznzgdFWRxJ4RqDiIwrrwROb7dgmPm3TJaatU/etjGq482pdfJIlMDNYPeA== @@ -1735,6 +1762,27 @@ apollo-server-express@2.8.2, apollo-server-express@^2.8.1: subscriptions-transport-ws "^0.9.16" type-is "^1.6.16" +apollo-server-express@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-2.9.0.tgz#9d2a2d9823422ef26bca15931669d3153dc8a08b" + integrity sha512-+057V6Ui1BX69jUlV6YDQ7Xw9CCBfowN/GauvyF09KnsjYUJ+cB1xf4mkj/HAjaz4ReXQaALJNr2qPYPXS4R6w== + dependencies: + "@apollographql/graphql-playground-html" "1.6.24" + "@types/accepts" "^1.3.5" + "@types/body-parser" "1.17.1" + "@types/cors" "^2.8.4" + "@types/express" "4.17.1" + accepts "^1.3.5" + apollo-server-core "2.9.0" + apollo-server-types "0.2.1" + body-parser "^1.18.3" + cors "^2.8.4" + graphql-subscriptions "^1.0.0" + graphql-tools "^4.0.0" + parseurl "^1.3.2" + subscriptions-transport-ws "^0.9.16" + type-is "^1.6.16" + apollo-server-plugin-base@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.6.1.tgz#b9c209aa2102a26c6134f51bfa1e4a8307b63b11" @@ -1742,12 +1790,12 @@ apollo-server-plugin-base@0.6.1: dependencies: apollo-server-types "0.2.1" -apollo-server-testing@~2.8.2: - version "2.8.2" - resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.8.2.tgz#8faa8f1778fa4893f5bf705f7cea84a69477aa3f" - integrity sha512-ccp1DpmjdmLT98ww4NtSiDPbeIPlVZJ5Iy408ToyhAGwNXRHk5f8Czf+JAgSayvgt4cxCm1fzxnVe1OjO8oIvA== +apollo-server-testing@~2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.9.0.tgz#fb5276e0761992ed493d84e998eaa4f696914519" + integrity sha512-N6c+wx5MaDZ0mWPzA11nKkkJjX+E3ubATY3G5ejprUsN8BiHENyEQ0EZh+dO0yL9+q/mUHix3p7Utax9odxBcw== dependencies: - apollo-server-core "2.8.2" + apollo-server-core "2.9.0" apollo-server-types@0.2.1: version "0.2.1" @@ -4079,6 +4127,15 @@ graphql-custom-directives@~0.2.14: moment "^2.22.2" numeral "^2.0.6" +graphql-extensions@0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.10.0.tgz#ceafc42e16554930b0dc90f64d5727ee2a9e9cf9" + integrity sha512-qz9Ev0NgsRxdTYqYSCpYwBWS9r1imm+vCBt3PmHzqZlE7SEpUPGddn9oKcLRB/P8uXT6dsr60hDmDHukIxiVOw== + dependencies: + "@apollographql/apollo-tools" "^0.4.0" + apollo-server-env "2.4.1" + apollo-server-types "0.2.1" + graphql-extensions@0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.8.1.tgz#f5f1fed5fe49620c4e70c5d08bdbd0039e91c402" @@ -6773,7 +6830,7 @@ parse5@^3.0.1: dependencies: "@types/node" "*" -parseurl@~1.3.3: +parseurl@^1.3.2, parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile index 56175e423..1cfa04507 100644 --- a/neo4j/Dockerfile +++ b/neo4j/Dockerfile @@ -5,7 +5,6 @@ ARG BUILD_COMMIT ENV BUILD_COMMIT=$BUILD_COMMIT COPY db_setup.sh /usr/local/bin/db_setup -COPY entrypoint.sh /docker-entrypoint-wrapper.sh -RUN apt-get update && apt-get -y install procps wget + +RUN apt-get update && apt-get -y install wget htop RUN wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.4/apoc-3.5.0.4-all.jar -P plugins/ -ENTRYPOINT ["/docker-entrypoint-wrapper.sh"] diff --git a/neo4j/README.md b/neo4j/README.md index 78c4bc62e..fe8825734 100644 --- a/neo4j/README.md +++ b/neo4j/README.md @@ -18,6 +18,16 @@ docker-compose up You can access Neo4J through [http://localhost:7474/](http://localhost:7474/) for an interactive cypher shell and a visualization of the graph. +### Database Indices and Constraints + +Database indices and constraints need to be created when the database is +running. So start the container with the command above and run: + +```bash +docker-compose exec neo4j db_setup +``` + + ## Installation without Docker Install the community edition of [Neo4j](https://neo4j.com/) along with the plugin @@ -35,6 +45,20 @@ Then make sure to allow Apoc procedures by adding the following line to your Neo ``` dbms.security.procedures.unrestricted=apoc.* ``` +### Database Indices and Constraints + +If you have `cypher-shell` available with your local installation of neo4j you +can run: + +```bash +# in folder neo4j/ +$ cp .env.template .env +$ ./db_setup.sh +``` + +Otherwise, if you don't have `cypher-shell` available, copy the cypher +statements [from the `db_setup.sh` script](https://github.com/Human-Connection/Human-Connection/blob/master/neo4j/db_setup.sh) and paste the scripts into your +[database browser frontend](http://localhost:7474). ### Alternatives @@ -50,21 +74,3 @@ in `backend/.env`. Start Neo4J and confirm the database is running at [http://localhost:7474](http://localhost:7474). -## Database Indices and Constraints - -If you are not running our dedicated Neo4J [docker image](https://hub.docker.com/r/humanconnection/neo4j), -which is the case if you setup Neo4J locally without docker, then you have to -setup unique indices and database constraints manually. - -If you have `cypher-shell` available with your local installation of neo4j you -can run: - -```bash -# in folder neo4j/ -$ cp .env.template .env -$ ./db_setup.sh -``` - -Otherwise, if you don't have `cypher-shell` available, copy the cypher -statements [from the `db_setup.sh` script](https://github.com/Human-Connection/Human-Connection/blob/master/neo4j/db_setup.sh) and paste the scripts into your -[database browser frontend](http://localhost:7474). diff --git a/neo4j/entrypoint.sh b/neo4j/entrypoint.sh deleted file mode 100755 index f9c1afbe1..000000000 --- a/neo4j/entrypoint.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# credits: https://github.com/javamonkey79 -# https://github.com/neo4j/docker-neo4j/issues/166 - -# turn on bash's job control -set -m - -# Start the primary process and put it in the background -/docker-entrypoint.sh neo4j & - -# Start the helper process -db_setup - -# the my_helper_process might need to know how to wait on the -# primary process to start before it does its work and returns - - -# now we bring the primary process back into the foreground -# and leave it there -fg %1 diff --git a/webapp/components/Registration/Signup.vue b/webapp/components/Registration/Signup.vue index 175db1fd6..dcf4f0e88 100644 --- a/webapp/components/Registration/Signup.vue +++ b/webapp/components/Registration/Signup.vue @@ -9,17 +9,21 @@ :schema="formSchema" @submit="handleSubmit" > -