Skip to content

Commit

Permalink
Merge pull request #1 from grookage/v0
Browse files Browse the repository at this point in the history
V0 for Concierge
  • Loading branch information
koushikr authored Dec 12, 2024
2 parents ea7b7fa + 602bae0 commit fc39a92
Show file tree
Hide file tree
Showing 114 changed files with 5,527 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build
on:
push:
branches:
- master
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
cache: maven
distribution: 'temurin'
- name: Build with Maven
run: mvn -B clean package --file pom.xml
44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Misc

.idea
*.iws
*.ipr
*.iml
/out/
.idea_modules/
atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
dependency-reduced-pom.xml
target/
*/test-classes/*
\$*
.DS_Store

3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: java
jdk:
- oraclejdk17
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

## [0.0.1-RC1]

- A versioned config registry, to register various configs backed by a RBAC enabled maker-checker process
- A RESTful interface and a console to manage the said configs, to allow for easier integrations
- Listeners on state changes whenever the config state changes
- Extensible repository bindings for config store
- Default repository implementations for Aerospike and Elasticsearch
- A concierge client to fetch configs and keep it in-memory instead of fetching from source everytime.
184 changes: 183 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,184 @@
# concierge
Concierge is an RBAC included, versioned, configuration repository.

> "When you gaze long enough into the abyss, the abyss also gazes into you."
> - Friedrich Nietzsche, The Abyss
Concierge is an RBAC enabled, metadata store aimed at providing versioned,
configuration snapshots, with various state transitions built in.

- A versioned config registry, to register various configs bound by a maker-checker process, with customizable RBAC.
- A RESTful interface and a console to manage the said configs, to allow for easier integrations
- A client for these configs to be fetched runtime and kept in memory for clients to use the config repository
seamlessly

## Maven Dependency

- The bom is available at

```
<dependency>
<groupId>com.grookage.concierge</groupId>
<artifactId>concierge-bom</artifactId>
<versio>latest</version>
</dependency>
```

## Build Instructions

- Clone the source:

git clone github.com/grookage/leia

- Build

mvn install

## Getting Started

### Using the config bundle, with your custom repository as part of your server

```
@NoArgsConstructor
@Getter
public abstract class ConciergeCustomBundle<T extends Configuration, U extends ConfigUpdater> extends ConciergeBundle<T, U> {
@Override
protected Supplier<ConciergeRepository> getRepositorySupplier(T configuration) {
return () -> <your_custom_repo>;
}
@Override
protected List<ConciergeHealthCheck> withHealthChecks(T configuration) {
return List.of(new CustomHealthCheck(elasticConfig, elasticsearchClient));
}
@Override
public void run(T configuration, Environment environment) {
//Any of your initializtion code.
super.run(configuration, environment);
}
protected Supplier<VersionGenerator> getVersionSupplier() {
//Your custom versionId Generator
}
protected abstract Supplier<PermissionValidator<U>> getPermissionResolver(T configuration) {
//Your custom Permission Validator
}
}
```

The above bundle provides

- An Ingestion resource - To help with creating and editing the configs, backed by the `PermissionValidator`
- A Config Resource - To help with getting the config details, backed by the `PermissionValidator`

Additionally, Concierge comes with default implementations for ElasticSaerch and Aerospike

### Using the elastic bundle in your dropwizard project

```
new ConciergeElasticBundle<AppConfiguration>() {
@Override
protected CacheConfig getCacheConfig(Configuration configuration) {
return null;
}
@Override
protected ElasticConfig getElasticConfig(Configuration configuration) {
return null;
}
@Override
protected Supplier<ConfigUpdaterResolver> userResolver(Configuration configuration) {
return null;
}
@Override
protected Supplier<VersionGenerator> getVersionSupplier() {
return null;
}
@Override
protected Supplier<PermissionValidator> getPermissionResolver(Configuration configuration) {
return null;
}
}
```

### Using the Aerospike bundle in your dropwizard project

```
new ConciergeAerospikeBundle<AppConfiguration>() {
@Override
protected CacheConfig getCacheConfig(Configuration configuration) {
return null;
}
@Override
protected AerospikeConfig getElasticConfig(Configuration configuration) {
return null;
}
@Override
protected Supplier<ConfigUpdaterResolver> userResolver(Configuration configuration) {
return null;
}
@Override
protected Supplier<VersionGenerator> getVersionSupplier() {
return null;
}
@Override
protected Supplier<PermissionValidator> getPermissionResolver(Configuration configuration) {
return null;
}
}
```

Concierge also comes with a client, that you can provide to the calling services or wrap it up in your client offering
and provide it further,
to periodically refresh and keep the configs in-memory instead of fetching from source all the time.

### To use the client bundle

```
new ConciergeClientBundle<AppConfiguration>() {
@Override
protected Set<String> getNamespaces(AppConfiguration configuration) {
// Namespaces against which client wants to fetch configs
}
@Override
protected LeiaHttpConfiguration getHttpConfiguration(AppConfiguration configuration) {
// Http Configuration where concierge server resides. Usually supplied by the config manager
}
@Override
protected SerDeFactory getSerDeFactory(AppConfiguration configuration) {
// A custom SerDe Factory if you have different serializations for config. Again can be extended as required.
}
}
```

LICENSE
-------

Copyright 2024 Koushik R <[email protected]>.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
55 changes: 55 additions & 0 deletions concierge-aerospike-dw/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.grookage.concierge</groupId>
<artifactId>concierge-parent</artifactId>
<version>0.0.1-RC1</version>
<relativePath>../concierge-parent</relativePath>
</parent>

<artifactId>concierge-aerospike-dw</artifactId>

<properties>
<dropwizard.version>2.1.10</dropwizard.version>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>

<dependencies>

<dependency>
<artifactId>dropwizard-core</artifactId>
<groupId>io.dropwizard</groupId>
</dependency>

<!-- https://mvnrepository.com/artifact/io.dropwizard/dropwizard-validation -->
<dependency>
<artifactId>dropwizard-validation</artifactId>
<groupId>io.dropwizard</groupId>
</dependency>

<dependency>
<groupId>com.grookage.concierge</groupId>
<artifactId>concierge-core</artifactId>
</dependency>

<dependency>
<groupId>com.grookage.concierge</groupId>
<artifactId>concierge-models</artifactId>
</dependency>

<dependency>
<groupId>com.grookage.concierge</groupId>
<artifactId>concierge-aerospike</artifactId>
</dependency>

<dependency>
<groupId>com.grookage.concierge</groupId>
<artifactId>concierge-dw</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.grookage.concierge.aerospikedw;

import com.google.common.base.Preconditions;
import com.grookage.conceirge.dwserver.ConciergeBundle;
import com.grookage.concierge.aerospike.client.AerospikeConfig;
import com.grookage.concierge.aerospike.repository.AerospikeRepository;
import com.grookage.concierge.models.ConfigUpdater;
import com.grookage.concierge.repository.ConciergeRepository;
import com.grookage.concierge.repository.cache.CacheConfig;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Environment;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.function.Supplier;

@NoArgsConstructor
@Getter
public abstract class ConciergeAerospikeBundle<T extends Configuration, U extends ConfigUpdater> extends ConciergeBundle<T, U> {


private AerospikeRepository aerospikeRepository;

protected abstract AerospikeConfig getAerospikeConfig(T configuration);

protected abstract CacheConfig getCacheConfig(T configuration);

@Override
protected Supplier<ConciergeRepository> getRepositorySupplier(T configuration) {
return () -> aerospikeRepository;
}

@Override
public void run(T configuration, Environment environment) {
final var aerospikeConfig = getAerospikeConfig(configuration);
Preconditions.checkNotNull(aerospikeConfig, "Aerospike Config can't be null");
final var cacheConfig = getCacheConfig(configuration);
this.aerospikeRepository = new AerospikeRepository(aerospikeConfig, cacheConfig);
super.run(configuration, environment);
}
}
Loading

0 comments on commit fc39a92

Please sign in to comment.