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.
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
-
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.
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
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.
Note the data in the example (e.g. UUIDs) is not real.
-
PUT example: see test_put.bash:
./test_put.bash
-
GET example piping to
jq
(using the same UUID as thePUT
request above): see test_get.bash:./test_get.bash | jq '.'
-
DELETE example:
curl -s -H "X-Request-Id: 123" localhost:8080/memberships/g10e101c-dbcf-356f-929e-669573defa56 | jq '.'
-
Health checks: http://localhost:8080/__health
-
Good-to-go: http://localhost:8080/__gtg
-
Ping: http://localhost:8080/__ping or http://localhost:8080/ping
-
Build Info: http://localhost:8080/__build-info or http://localhost:8080/build-info
MATCH (m:Membership {uuid:"g10e101c-dbcf-356f-929e-669573defa56"}) RETURN m
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
.)