Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cassandra Support for Repo API Definitions #463

Open
jtesser opened this issue Mar 16, 2021 · 0 comments
Open

Add Cassandra Support for Repo API Definitions #463

jtesser opened this issue Mar 16, 2021 · 0 comments

Comments

@jtesser
Copy link
Contributor

jtesser commented Mar 16, 2021

[Short description of problem here]
Add support to store API Spec in Cassandra.
This is similar to the Mongo approach.

The MongoDB Repo is implemented here.
https://github.com/motiv-labs/janus/blob/master/pkg/api/mongodb_repository.go

Here you can see where the Repository is setup

return NewMongoAppRepository(dsn, refreshTime)

Need to load a configured SQL file on first time start. We can do this like we do for other microservices here at Motiv. The file will have to be placed inside the Container. The default will be the basic schema but one could be added that has default definitions

** Things to be aware of
Need to test to make sure a cluster of Januses will work. Obviously all pointed at the same Cassandra Ring.
Make sure watch works and you can add new API Definitions get propagated to all connected Janus containers
Config of Cassandra and Janus should be able to be controlled via Environment Variables passed into the Docker container. Ultimatly we might need to create a card to update this for Mongo also.

  [database]
    dsn = "cassandra:......:user..."

** More code to be aware of
Definitions are stored here for APIs

type Definition struct {

type Definition struct {

The file_repo impl

"github.com/fsnotify/fsnotify"

The in_memory repo
https://github.com/motiv-labs/janus/blob/master/pkg/api/in_memory_repository.go#L28

Where the watcher is hooked up. This should be the thing that allows everything to reload.

if watcher, ok := s.provider.(api.Watcher); ok {

How mongo is unmarshalling the JSON. In mongo it is simply key/value. So all the structs are a big JSON Object

func Decode(rawConfig map[string]interface{}, obj interface{}) error {

func Decode(rawConfig map[string]interface{}, obj interface{}) error {

tuxranger added a commit that referenced this issue Mar 17, 2021
…s. got cassandra generally working it seems
jtesser added a commit that referenced this issue Mar 21, 2021
updated statement execute to have retry logic
bambulin added a commit to whalebone/janus that referenced this issue Feb 17, 2022
* Delete .comply.yaml

* Godog changed its home

* Fixed godog runner

* Updated godog to v0.10

* Test and build only in the current latest stable go version - 1.14 for now

* Updated deprecated godog api

* Use golangci-lint for code linting

* Fixed code linting issues

* Run linting before tests

* Fixed golangci-lint installation script

* Support dynamic port for deps in integration tests

* Support dynamic port for deps in features tests

* Replace upstreams port in features tests with dynamic value if set

* Testing flow with GH Actions

* Fix resources default value

* remove c-style (incorrect) swtich handling

* Simplified application build

* use pre defined Version field in root cmd

* delete version.go

* update go mod files

* Use ubuntu for docker image and run as nobody

* GH Actions release flow with GoReleaser

* Ignore freebsd/arm64 build as it can not be done

* Updated docker image refs to docker hub

* Go 1.15

* Wrap errors using stdlib

* Updated changelog for new release

* Goreleaser should include all the commits since last release

* Migrate .whitesource configuration file to inheritance mode

* Updated health-go to v3

* Updated redis and limiter libraries

* Use official mongo driver

* Update README.md

* added dockerfile for debugging, fixed bug with strip path not working correctly and added tests

* janus#463 added initial cassandra logic to add definitions

* janus#463 updated opencensus exporter modules

* motiv-labs#463 filled out logic for cassandra oauth plugin. fixed broken queries. got cassandra generally working it seems

* motiv-labs#463 removed motiv-labs module dependencies.

* motiv-labs#465 added basic auth to cassandra

* added hash and salt to store and compare passwords

* janus#463 removed/changed extra logging. added circle config

* janus#463 removed/changed extra logging. added circle config

* added some comments about where to run the dockerfiles from

* updated circle config make command

* updated circle config make command

* updated circle config make command

* updated circle config make command

* updated circle config make command

* motiv-labs#463 updated dockerfile to build image all inside container. updated cirlce config

* motiv-labs#463 reverted changes to mongo example, updated circle config

* Update README.md

* Update README.md

* updated statement execute to have retry logic

* updated statement execute to have retry logic

* updating image in circle (motiv-labs#468)

* Janus#463 cassandra repo (motiv-labs#469)

* updating image in circle

* fixed add user logic

* Janus#463 cassandra repo (motiv-labs#470)

* updating image in circle

* fixed add user logic

* added env var for cassandra cluster consistency

* removed extra debug logging

* updating image

* [skip ci] updated conf file

* #nosmoke flag added

* #nosmoke updated cass env vars

* removed cassandra domain env var since we connect through the dsn in config file

* #nosmoke Add organization plugin (motiv-labs#479)

* added company plugin to janus to pair users with a company

* changed plugin term from company to organization, updated plugin to handle authentication separete from basic auth plugin.

* fixed wrong log type. updated debug entry script to start janus properly

* added page to doc

* go mod tidy

* Dockerfile updated

Co-authored-by: Vladimir Garvardt <[email protected]>
Co-authored-by: Elena Pavlova <[email protected]>
Co-authored-by: Akhil Thayyil <[email protected]>
Co-authored-by: Akhil <[email protected]>
Co-authored-by: Kumar Saurabh <[email protected]>
Co-authored-by: whitesource-for-github-com[bot] <50673670+whitesource-for-github-com[bot]@users.noreply.github.com>
Co-authored-by: Jason Tesser <[email protected]>
Co-authored-by: Aristotle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant