Skip to content

Commit

Permalink
Merge pull request #44 from Financial-Times/fix/UPPSF-778-log-libs-up…
Browse files Browse the repository at this point in the history
…date

Fix/uppsf 778 log libs update
  • Loading branch information
epavlova committed Oct 16, 2019
2 parents 1eb14ea + 18ba2be commit a29ab9c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
39 changes: 29 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,42 @@ __A service and an API for reading/writing annotations into Neo4j.
If the consumer is enabled: the messages are consumed from the queue, they get written into Neo4j, and finally, if the producer is also enabled, they got forwarded into the next (PostAnnotations) queue.
The above flow can be initiated by the PUT endpoint as well. In this case, the service expects the annotations json to be supplied in the format that comes out of the annotations consumer.__

## Installation
* `go get -u github.com/kardianos/govendor`
* `go get -u github.com/Financial-Times/annotations-rw-neo4j`
* `cd $GOPATH/src/github.com/Financial-Times/annotations-rw-neo4j`
* `govendor sync`
* `go build .`
## Build from source
* download the source code of the project in a directory of your choice
* `cd {the-chosen-directory}/annotations-rw-neo4j`
* `go build -mod=readonly`

## Running locally
* `govendor test -v -race`
* `go install`
* `$GOPATH/bin/annotations-rw-neo4j [--help]`
* `{the-chosen-directory}/annotations-rw-neo4j [--help]`

You have more options here:
You have the following options here:
- run neo4j and kafka locally (by docker, or as native apps)
- open a tunnel to one of your team clusters that your app can connect to
- disable the functionality that requires kafka by setting the env var `SHOULD_FORWARD_MESSAGES=false`

Command line options:
```
--neoUrl neo4j endpoint URL (env $NEO_URL) (default "http://localhost:7474/db/data")
--port Port to listen on (env $APP_PORT) (default 8080)
--batchSize Maximum number of statements to execute per batch (env $BATCH_SIZE) (default 1024)
--logLevel Logging level (DEBUG, INFO, WARN, ERROR) (env $LOG_LEVEL) (default "INFO")
--lifecycleConfigPath Json Config file - containing two config maps: one for originHeader to lifecycle, another for lifecycle to platformVersion mappings. (env $LIFECYCLE_CONFIG_PATH) (default "annotation-config.json")
--zookeeperAddress Address of the zookeeper service (env $ZOOKEEPER_ADDRESS) (default "localhost:2181")
--shouldConsumeMessages Boolean value specifying if this service should consume messages from the specified topic (env $SHOULD_CONSUME_MESSAGES)
--consumerGroup Kafka consumer group name (env $CONSUMER_GROUP)
--consumerTopic Kafka consumer topic name (env $CONSUMER_TOPIC)
--brokerAddress Kafka address (env $BROKER_ADDRESS) (default "localhost:9092")
--producerTopic Topic to which received messages will be forwarded (env $PRODUCER_TOPIC) (default "PostPublicationMetadataEvents")
--shouldForwardMessages Decides if annotations messages should be forwarded to a post publication queue (env $SHOULD_FORWARD_MESSAGES) (default true)
--appName Name of the service (env $APP_NAME) (default "annotations-rw")
```

## Running unit tests locally
* Start the local Neo4j instance
`docker run --rm -e NEO4J_ACCEPT_LICENSE_AGREEMENT=yes -e NEO4J_AUTH=none -p 7474:7474 -p 7687:7687 -it neo4j:3.4.10-enterprise`
* Run the unit tests
`go test ./... -race`

## Endpoints

### PUT
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.13
require (
github.com/Financial-Times/go-fthealth v0.0.0-20180807113633-3d8eb430d5b5
github.com/Financial-Times/go-logger v0.0.0-20180323124113-febee6537e90
github.com/Financial-Times/go-logger/v2 v2.0.0
github.com/Financial-Times/http-handlers-go/v2 v2.0.0
github.com/Financial-Times/go-logger/v2 v2.0.1
github.com/Financial-Times/http-handlers-go/v2 v2.1.0
github.com/Financial-Times/kafka-client-go v0.0.0-20180521133824-5aa30a327517
github.com/Financial-Times/neo-model-utils-go v0.0.0-20180712095719-aea1e95c8305
github.com/Financial-Times/neo-utils-go v0.0.0-20180807105745-1fe6ae2f38f3
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ github.com/Financial-Times/go-logger/v2 v2.0.0-20190912083702-aeff0296ae63 h1:Az
github.com/Financial-Times/go-logger/v2 v2.0.0-20190912083702-aeff0296ae63/go.mod h1:Jpky5JYSX7xjGUClfA9hEMDmn40tUbfQQITjVIFGQiM=
github.com/Financial-Times/go-logger/v2 v2.0.0 h1:amSYqq+6KmOS5E0mg4BtnO+6zLQK9OSWAALxXaaf8wA=
github.com/Financial-Times/go-logger/v2 v2.0.0/go.mod h1:Jpky5JYSX7xjGUClfA9hEMDmn40tUbfQQITjVIFGQiM=
github.com/Financial-Times/go-logger/v2 v2.0.1 h1:iekEfSsUtlkg+YkXTZo+/fIN2VbZ2/3Hl9yolP3z5X8=
github.com/Financial-Times/go-logger/v2 v2.0.1/go.mod h1:Jpky5JYSX7xjGUClfA9hEMDmn40tUbfQQITjVIFGQiM=
github.com/Financial-Times/http-handlers-go v0.0.0-20180517120644-2c20324ab887 h1:4qEj6CB6jF9eloZIV/SCS7mQ/9iyx+3Ru/w7m10c69w=
github.com/Financial-Times/http-handlers-go v0.0.0-20180517120644-2c20324ab887/go.mod h1:sAkXv1oPYgNTYBYsYs83HwpYp7R50mvgBGGcsOlJtOw=
github.com/Financial-Times/http-handlers-go v0.0.0-20190912120151-7895ef3e4137 h1:wZhxHtPoeEUYPaYMINeDvbV2yl1UE/LYaeQxDjQ0xxI=
github.com/Financial-Times/http-handlers-go v0.0.0-20190912120151-7895ef3e4137/go.mod h1:CZXXAjkdoEjLSkBQegsyquFAwzTjpQNyrev+qav3cQo=
github.com/Financial-Times/http-handlers-go/v2 v2.0.0 h1:EdJ/8doaqAWR3AJOsoAiA/6qXWk6KKGpTaWUcqxCidI=
github.com/Financial-Times/http-handlers-go/v2 v2.0.0/go.mod h1:sEw9YdfjBaquNsZyAWIQqNXW2pW+SOwlMiVNVbUxZoY=
github.com/Financial-Times/http-handlers-go/v2 v2.1.0 h1:kBj41WrDXUGUiLHEjWI1zQUbRTNEw0JxSaaXQwZkib8=
github.com/Financial-Times/http-handlers-go/v2 v2.1.0/go.mod h1:Tgkc7TqJXl/NFxB8eP8CX7YU5X01gbrL55LqNzo4YVY=
github.com/Financial-Times/kafka-client-go v0.0.0-20180521133824-5aa30a327517 h1:H+qEU050p9nLp7LwZiFU4mCFB9Z1IwzkdUF3OAjZC7M=
github.com/Financial-Times/kafka-client-go v0.0.0-20180521133824-5aa30a327517/go.mod h1:IRxo6zPqM44uCWpM7YBkm5o9lOxwPgR0/WvCX0KcV/Y=
github.com/Financial-Times/neo-model-utils-go v0.0.0-20180712095719-aea1e95c8305 h1:ob+VRuAq7QGfqT4ccoH5Ru0nfnBmjmNgUEaLzXTzUNw=
Expand Down
6 changes: 3 additions & 3 deletions healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func (h healthCheckHandler) readQueueCheck() fthealth.Check {
ID: "read-message-queue-reachable",
Name: "Read Message Queue Reachable",
Severity: 1,
BusinessImpact: "Content V1 Metadata can't be read from queue. This will negatively impact V1 metadata availability.",
BusinessImpact: "Content metadata can't be read from queue. This will negatively impact metadata/annotations availability.",
TechnicalSummary: "Read message queue is not reachable/healthy",
PanicGuide: "https://dewey.ft.com/",
PanicGuide: "https://runbooks.in.ft.com/annotations-rw-neo4j",
Checker: h.checkKafkaConnectivity,
}
}
Expand All @@ -72,7 +72,7 @@ func (h healthCheckHandler) writerCheck() fthealth.Check {
Severity: 1,
BusinessImpact: "Unable to respond to Annotation API requests",
TechnicalSummary: "Cannot connect to Neo4j a instance with at least one person loaded in it",
PanicGuide: "https://dewey.ft.com/",
PanicGuide: "https://runbooks.in.ft.com/annotations-rw-neo4j",
Checker: h.Checker,
}
}
Expand Down

0 comments on commit a29ab9c

Please sign in to comment.