HUB
Sign inSign up

coco/nativerw

By coco

•Updated 4 months ago

Writes any raw content/data from native CMS in mongoDB without transformation.

Image
0

10K+

coco/nativerw repository overview

⁠Native Store Reader Writer (nativerw)

Coverage Status

Writes any raw content/data from native CMS in mongoDB without transformation. The same data can then be read from here just like from the original CMS.

⁠Installation

You need Go to be installed⁠. Please read about Go and about How to Write Go Code⁠ before jumping right in. For example you will need Git, Mercurial, Bazaar installed and working, so that Go can use them to retrieve dependencies. For this additionally you will also need a computer etc. Hope this helps.

For the first time: go get github.com/Financial-Times/nativerw and dep ensure -vendor-only.

go install github.com/Financial-Times/nativerw

⁠Building docker
CGO_ENABLED=0 go build -a -installsuffix cgo -o nativerw .
docker build -t coco/nativerw .

⁠Running

The following params can be injected in the nativerw app on startup through environment variables:

  • MONGOS This env var is mandatory. Mongo addresses to connect to in format: host1:port1[,host2:port2,...] the app will exit (with exit code 1) it is not valid. The MONGOS value is considered to be valid if the number of provided URLs matches the provided MONGO_NODE_COUNT and each MongoDb URL has host:port.
  • MONGO_NODE_COUNT The number of MongoDB instances. Default value is 3.
  • CONFIG Config file in json format. If not set, the default config.json will be used.

⁠API

The nativerw supports the following endpoints:

  • GET /{collection}/{uuid} retrieves the native document, and returns it in either json or binary (depending on how it is saved).
  • PUT /{collection}/{uuid} upserts a new native document for the given uuid.
  • GET /{collection}/__ids returns all uuids for the given collection on a best efforts basis. If the collection is very large, the endpoint is likely to time out (timeout duration is hardcoded to 10s) before all uuids have been returned. This will be indistinguishable from a request which sends back the complete set of uuids, however, if there are less than ~10,000 uuids returned, you can be fairly confident you have the entire set.
  • GET /__gtg the good to go endpoint.
  • GET /__health the health endpoint.
⁠Logging

Tag summary

Content type

Image

Digest

sha256:7318c9d06…

Size

10.1 MB

Last updated

4 months ago

docker pull coco/nativerw