Skip to content

Commit f9e7c55

Browse files
committed
BUGFIX: Fixed error with apoc procedures not being installed
1 parent 940a88d commit f9e7c55

9 files changed

+445
-569
lines changed

.prettierrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"trailingComma": "es5",
33
"semi": false,
4-
"singleQuote": true
4+
"singleQuote": false
55
}

api/babel.config.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const TARGETS_NODE = '16.13.0'
2+
const CORE_JS_VERSION = '3.6'
3+
4+
module.exports = {
5+
presets: [
6+
[
7+
'@babel/preset-env',
8+
{
9+
targets: { node: TARGETS_NODE },
10+
useBuiltIns: 'usage',
11+
corejs: {
12+
version: CORE_JS_VERSION,
13+
proposals: true,
14+
},
15+
},
16+
],
17+
],
18+
plugins: [
19+
[
20+
'babel-plugin-module-resolver',
21+
{
22+
alias: {
23+
src: './src',
24+
},
25+
},
26+
],
27+
['@babel/plugin-proposal-class-properties', { loose: true }],
28+
[
29+
'@babel/plugin-transform-runtime',
30+
{
31+
corejs: { version: 3, proposals: true },
32+
version: '^7.8.3',
33+
},
34+
],
35+
],
36+
}

api/package.json

-11
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@
3232
"react": "^16.13.1"
3333
},
3434
"devDependencies": {
35-
"@babel/cli": "^7.8.4",
36-
"@babel/core": "^7.9.0",
37-
"@babel/node": "^7.8.7",
38-
"@babel/plugin-proposal-class-properties": "^7.8.3",
39-
"@babel/plugin-transform-runtime": "^7.9.0",
40-
"@babel/preset-env": "^7.9.0",
41-
"@babel/preset-react": "^7.9.4",
42-
"@babel/preset-typescript": "^7.9.0",
43-
"@babel/runtime-corejs3": "^7.9.2",
44-
"babel-plugin-auto-import": "^1.0.5",
45-
"babel-plugin-module-resolver": "^4.0.0",
4635
"cross-env": "^7.0.2",
4736
"nodemon": "^1.19.1",
4837
"shx": "^0.3.2"

api/src/graphql-schema.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import fs from 'fs'
2+
import path from 'path'
3+
4+
/*
5+
* Check for GRAPHQL_SCHEMA environment variable to specify schema file
6+
* fallback to schema.graphql if GRAPHQL_SCHEMA environment variable is not set
7+
*/
8+
9+
export const typeDefs = fs
10+
.readFileSync(
11+
process.env.GRAPHQL_SCHEMA || path.join(__dirname, 'schema.graphql')
12+
)
13+
.toString('utf-8')

api/src/schema.graphql

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
scalar Point
2+
scalar DateTime
3+
scalar PointInput
4+
5+
type User {
6+
id: ID!
7+
name: String!
8+
email: String!
9+
createdAt: DateTime!
10+
updatedAt: DateTime!
11+
sites: [Site] @relationship(type: "ADDED_SITE", direction: OUT)
12+
}
13+
14+
type Site {
15+
id: ID!
16+
url: String!
17+
createdAt: DateTime!
18+
updatedAt: DateTime!
19+
user: User @relationship(type: "ADDED_SITE", direction: IN)
20+
}

docker-compose.yml

+26-33
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
1-
version: '3.8'
2-
1+
version: "3.8"
32
services:
43
neo4j:
5-
##########################
6-
# Uncomment this if spatial support is needed
7-
# Later builds are available but are not compatible with the spatial plugin
8-
# build: ./neo4j/v4.2.3
9-
# container_name: "neo4j-4-2-3"
10-
##########################
11-
# Neo4j v4.3.7
124
build:
135
context: ./neo4j/v${NEO4J_VERSION}
146
args:
15-
VERSION: '${NEO4J_VERSION}'
16-
DB_USER: '${NEO4J_USER}'
17-
DB_PASSWORD: '${NEO4J_PASSWORD}'
18-
DB_AUTH: '${NEO4J_USER}/${NEO4J_PASSWORD}'
19-
container_name: '${NEO4J_CONTAINER_NAME}'
7+
VERSION: "${NEO4J_VERSION}"
8+
DB_USER: "${NEO4J_USER}"
9+
DB_PASSWORD: "${NEO4J_PASSWORD}"
10+
DB_AUTH: "${NEO4J_USER}/${NEO4J_PASSWORD}"
11+
container_name: "${NEO4J_CONTAINER_NAME}"
2012
ports:
2113
- 7474:7474 # HTTP endpoint
2214
- 7473:7473 # HTTPS endpoint
2315
- 7687:7687 # Bolt endpoint
2416
environment:
25-
- DB_HOST=localhost
17+
- DB_HOST='localhost'
2618
- DB_PORT=7474
2719
- DB_USER=${NEO4J_USER}
2820
- DB_PASSWORD=${NEO4J_PASSWORD}
2921
- NEO4J_AUTH=${NEO4J_AUTH}
30-
# Add advertised address so that the Neo4j docker container
31-
# can be accessed from the host when using WSL2
3222
- NEO4J_dbms_connector_https_advertised__address=localhost:7473
3323
- NEO4J_dbms_connector_http_advertised__address=localhost:7474
3424
- NEO4J_dbms_connector_bolt_advertised__address=localhost:7687
35-
- NEO4J_dbms_security_procedures_unrestricted=jwt.sercurity.*,apoc.*, gds.* # ,spatial.*
36-
- NEO4J_apoc_import_file_enabled=true
3725
- NEO4J_apoc_export_file_enabled=true
26+
- NEO4J_apoc_import_file_enabled=true
27+
- NEO4J_apoc_import_file_use__neo4j__config=true
28+
- NEO4J_dbms_security_procedures_unrestricted=apoc.*
29+
- NEO4JLABS_PLUGINS=["apoc"]
30+
- NEO4J_dbms_security_procedures_whitelist=apoc.*
3831
- NEO4J_uuid_enabled=true
3932
- NEO4J_dbms_db_timezone=SYSTEM
4033
- NEO4J_dbms_shell_enabled=true
@@ -45,18 +38,18 @@ services:
4538
- ./neo4j/vol/plugins:/plugins
4639
- ./neo4j/vol/import:/var/lib/neo4j/import
4740

48-
api:
49-
build: ./api
50-
ports:
51-
- 4001:4001
52-
environment:
53-
- NEO4J_URI=bolt://neo4j:7687
54-
- NEO4J_USER=${NEO4J_USER}
55-
- NEO4J_PASSWORD=${NEO4J_PASSWORD}
56-
- GRAPHQL_LISTEN_PORT=4001
57-
- GRAPHQL_URI=http://localhost:4001/graphql
41+
# api:
42+
# build: ./api
43+
# ports:
44+
# - 4001:4001
45+
# environment:
46+
# - NEO4J_URI=bolt://neo4j:7687
47+
# - NEO4J_USER=${NEO4J_USER}
48+
# - NEO4J_PASSWORD=${NEO4J_PASSWORD}
49+
# - GRAPHQL_LISTEN_PORT=4001
50+
# - GRAPHQL_URI=http://localhost:4001/graphql
5851

59-
links:
60-
- neo4j
61-
depends_on:
62-
- neo4j
52+
# links:
53+
# - neo4j
54+
# depends_on:
55+
# - neo4j

neo4j/v4.3.7/Dockerfile

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1+
12
ARG VERSION
23
ARG DB_USER
34
ARG DB_PASSWORD
45
ARG DB_AUTH
56

6-
# Official Neo4j Docker Images available at https://hub.docker.com/_/neo4j
7-
FROM neo4j:$VERSION
8-
7+
FROM neo4j:${VERSION}
98
# Install curl explicitly; it is no longer included in Neo4j base images
10-
RUN apt-get update; apt-get install curl -y
9+
RUN apt-get update && apt-get install curl -y
1110

1211
# Specify the user/password for your Neo4j database
13-
ENV NEO4J_AUTH=$DB_AUTH
12+
ENV NEO4J_AUTH=${DB_AUTH}
1413
#$DB_USER\/$DB_PASSWORD
1514
#neo4j/letmein
1615

1716
# The APOC (Awesome Procedures On Cypher) library consists of many (about 450) procedures and functions to help with many different
1817
# tasks in areas like data integration, graph algorithms or data conversion.
1918
# https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases
2019
ENV APOC_VERSION=4.3.0.4
21-
ENV APOC_URI https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/${APOC_VERSION}/apoc-${APOC_VERSION}-all.jar
22-
RUN sh -c 'cd /var/lib/neo4j/plugins && curl -L -O "${APOC_URI}"'
20+
ENV APOC_URI=https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/${APOC_VERSION}/apoc-${APOC_VERSION}-all.jar
21+
RUN sh -c 'cd /var/lib/neo4j/plugins && curl -L -O ${APOC_URI}'
2322

2423
# The Spatial Library (neo4j spatial) is a library for working with geospatial data.
2524
# https://github.com/neo4j-contrib/spatial/releases/tag/0.28.0-neo4j-4.2.3

neo4j/v4.3.7/wrapper.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ wget --quiet --tries=10 --waitretry=10 -O /dev/null http://${DB_HOST}:${DB_PORT}
2828
log_info "Neo4j has started 🤓"
2929

3030
# Import data
31-
log_info "Loading and importing Cypher file(s)..."
31+
# log_info "Loading and importing Cypher file(s)..."
3232

33-
for cypherFile in /var/lib/neo4j/import/*.cypher; do
34-
log_info "Processing ${cypherFile}..."
35-
contents=$(cat ${cypherFile})
36-
cat ${cypherFile} | cypher-shell -u ${DB_USER} -p ${DB_PASSWORD} --format plain
37-
done
33+
# for cypherFile in /var/lib/neo4j/import/*.cypher; do
34+
# log_info "Processing ${cypherFile}..."
35+
# contents=$(cat ${cypherFile})
36+
# cat ${cypherFile} | cypher-shell -u ${DB_USER} -p ${DB_PASSWORD} --format plain
37+
# done
3838

39-
log_info "Finished loading data."
39+
# log_info "Finished loading data."
4040

4141
# now we bring the primary process back into the foreground
4242
# and leave it there

0 commit comments

Comments
 (0)