Memberships Reader/Writer for Neo4j (memberships-rw-neo4j) [RETIRED]
An API for reading/writing memberships into Neo4j. Expects the memberships json supplied to be in the format
that comes out of the memberships transformer.
Installation
For the first time:
go get github.com/Financial-Times/memberships-rw-neo4j
or update:
go get -u github.com/Financial-Times/memberships-rw-neo4j
Running
-
Download the code.
-
Build it:
go install
-
Download, install and start neo4j (otherwise the app will panic and exit).
-
Run it:
$GOPATH/bin/memberships-rw-neo4j --neo-url={neo4jUrl} --port={port} --batchSize=50 --timeoutMs=20
All arguments are optional, they default to a local Neo4j install on the default port (7474), application running on port 8080,
batchSize of 1024 and timeoutMs of 50. NB: the default batchSize
is much higher than the throughput the instance data
ingester currently can cope with.
Updating the model
Use gojson against a transformer endpoint to create a person struct and update the
model.go file. NB: we DO need a separate identifier struct.
curl http://ftaps35629-law1a-eu-t:8080/transformers/memberships/g10e101c-dbcf-356f-929e-669573defa56
Building
This service is built and deployed via Jenkins. The build chain can be found at
JOBS-memberships-rw-neo4j.
The build works via git tags. To prepare a new release:
- update the version in the Modulefile, e.g. to 0.0.12.
- git tag that commit using
git tag 0.0.12
git push --tags
The deploy also works via git tag and you can also select the environment to deploy to.
Try it!
Note the data in the example (e.g. UUIDs) is not real.
View your data in the database
MATCH (m:Membership {uuid:"g10e101c-dbcf-356f-929e-669573defa56"}) RETURN m
Logging
The application uses logrus, the log file is initialised in main.go.
Logging requires an env
app parameter, for all environments other than local logs are written to file.
When running locally, logging is written to console (if you want to log locally to file you need to pass in an env parameter
that is != local
.)