argus

command module
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 37 Imported by: 0

README

argus

(pronounced "ar-gus")

Build Status codecov.io Code Climate Issue Count Go Report Card Apache V2 License GitHub release

Summary

The XMiDT server for storing webhooks to be used by caduceus. This service is used to replace SNS. Refer the overview docsfor more information on how argus fits into the overall picture.

Table of Contents

Code of Conduct

This project and everyone participating in it are governed by the XMiDT Code Of Conduct. By participating, you agree to this Code.

Details

argus has one function: interact with a database whether it is internal or external. To enable this, argus has two endpoints: 1) individual items, and 2) buckets containing items.

Create Individual Item - store/{bucket} endpoint

This endpoint allows for clients to PUT an object into argus. The body must be in json format with identifier and data. ttl is an optional field in seconds, if not set it will become 5 minutes. An optional header X-Midt-Owner can be sent to associate the object with an owner.

An example put object

{
  "identifier" : "earth",
  "data": {
    "year":  1967,
     "words": ["What", "a", "Wonderful", "World"]
  },
  "ttl" : 300
}

An example response:

{
  "bucket" : "world",
  "id":  "ZWFydGjjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ"
}
Bucket - store/{bucket} endpoint

This endpoint allows for GET to retrieve all the items in the bucket organized by the id. An example response will look like where "earth" is the id of the item. An optional header X-Midt-Owner can be sent with the request, if supplied the results will be filtered down. If X-Midt-Owner is empty then all the items will be returned.

An example response:

{
    "ZWFydGjjsMRCmPwcFJr79MiZb7kkJ65B5GSbk0yklZkbeFK4VQ": {
        "identifier": "earth",
        "data": {
            "words": [
                "What",
                "a",
                "Wonderful",
                "World"
            ],
            "year": 1967
        },
        "ttl": 255
    }
}
Individual Item - store/{bucket}/{id} endpoint

This endpoint allows for GET, and DELETE REST methods to interact with any json object that was created with the previous PUT request. An optional header X-Midt-Owner can be sent with the request, if the owner of the object matches the header value the object is returned, otherwise 404 will be returned.

An example response:

{
    "identifier": "earth",
    "data": {
        "words": [
            "What",
            "a",
            "Wonderful",
            "World"
        ],
        "year": 1967
    },
    "ttl": 295
}

Build

Source

In order to build from the source, you need a working Go environment with version 1.11 or greater. Find more information on the Go website.

You can directly use go get to put the argus binary into your GOPATH:

go get github.com/xmidt-org/argus

You can also clone the repository yourself and build using make:

mkdir -p $GOPATH/src/github.com/xmidt-org
cd $GOPATH/src/github.com/xmidt-org
git clone git@github.com:xmidt-org/argus.git
cd argus
make build
Makefile

The Makefile has the following options you may find helpful:

  • make build: builds the argus binary
  • make docker: builds a docker image for argus, making sure to get all dependencies
  • make local-docker: builds a docker image for argus with the assumption that the dependencies can be found already
  • make test: runs unit tests with coverage for argus
  • make clean: deletes previously-built binaries and object files
RPM

First have a local clone of the source and go into the root directory of the repository. Then use rpkg to build the rpm:

rpkg srpm --spec <repo location>/<spec file location in repo>
rpkg -C <repo location>/.config/rpkg.conf sources --outdir <repo location>'
Docker

The docker image can be built either with the Makefile or by running a docker command. Either option requires first getting the source code.

See Makefile on specifics of how to build the image that way.

For running a command, either you can run docker build after getting all dependencies, or make the command fetch the dependencies. If you don't want to get the dependencies, run the following command:

docker build -t argus:local -f deploy/Dockerfile .

If you want to get the dependencies then build, run the following commands:

go mod vendor
docker build -t argus:local -f deploy/Dockerfile.local .

For either command, if you want the tag to be a version instead of local, then replace local in the docker build command.

Kubernetes

A helm chart can be used to deploy argus to kubernetes

helm install xmidt-argus deploy/helm/argus

Deploy

For deploying a XMiDT cluster refer to getting started.

For running locally, ensure you have the binary built. If it's in your GOPATH, run:

argus

If the binary is in your current folder, run:

./argus

Contributing

Refer to CONTRIBUTING.md.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package chrysom provides a client in order to interact with argus.
Package chrysom provides a client in order to interact with argus.
db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL