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

Develop (0.1.0) #94

Merged
merged 28 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
dd803dd
Cluster Query Command (#87)
akageun Jul 29, 2024
ec7a054
Build Script (#88)
akageun Jul 29, 2024
35342d8
Logback file (#89)
akageun Jul 30, 2024
34dd509
UI Refactoring 4 (#90)
akageun Jul 30, 2024
31cc6d1
Apply API Context (#91)
akageun Jul 30, 2024
c4fccb8
Feature/session pool test (#93)
akageun Jul 30, 2024
9aeca36
UI Refactoring
akageun Jul 30, 2024
88e4522
driver bugfix
akageun Jul 30, 2024
5d7cca0
driver bugfix
akageun Jul 30, 2024
246e247
driver bugfix
akageun Jul 30, 2024
442cca7
driver bugfix
akageun Jul 30, 2024
08d9a63
Merge branch 'refs/heads/main' into develop
seungh0 Jul 31, 2024
9c81029
Enable CI/CD for develop branch (#99)
seungh0 Jul 31, 2024
047911e
Enable Sonarqube (#100)
seungh0 Jul 31, 2024
7b77618
Enable SonarQube (#100)
seungh0 Jul 31, 2024
6660153
Update README (License) & Auto Assign Code Reviewers (#97)
seungh0 Jul 31, 2024
1f3d51c
Update README.md
seungh0 Jul 31, 2024
3664460
Refactoring CqlSessionFactory in IntegrationTest (#96)
seungh0 Jul 31, 2024
6ae8083
Remove Code Smell (#101)
seungh0 Jul 31, 2024
7edb271
Cluster Version Evaluator (#98)
seungh0 Jul 31, 2024
34f0a4e
Add Quality Gate section to README.md
seungh0 Jul 31, 2024
ae865b9
Bump tough-cookie and node-sass in /cassdio-web/src/main/webapp (#102)
dependabot[bot] Jul 31, 2024
0250602
Enable CI/CD for develop branch
seungh0 Jul 31, 2024
f51ff2b
Refactor Code Smell (#104)
seungh0 Jul 31, 2024
01a7209
Apply Cluster Session Clear (#106)
akageun Aug 3, 2024
f4e8d8d
UI Refactoring
akageun Aug 5, 2024
4079eac
Docs: Update README Typo (#95)
wjdrbs96 Aug 5, 2024
d32eb41
Npm to Yarn (#103)
seungh0 Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @akageun
* @seungh0
30 changes: 20 additions & 10 deletions .github/workflows/ci-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ on:
pull_request:
branches:
- main
- develop
types:
- opened
- synchronize
- reopened
push:
branches:
- main
- develop
workflow_dispatch:

env:
Expand All @@ -31,22 +33,30 @@ jobs:
with:
node-version: ${{ matrix.node }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache yarn cache
id: cache-yarn
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
${{ runner.os }}-node_modules-

- name: Install and Build
run: |
npm install
npm run build
yarn install --frozen-lockfile
yarn run build
working-directory: cassdio-web/src/main/webapp
16 changes: 16 additions & 0 deletions .github/workflows/ci-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ on:
pull_request:
branches:
- main
- develop
types:
- opened
- synchronize
- reopened
push:
branches:
- main
- develop
workflow_dispatch:

jobs:
Expand All @@ -29,9 +31,23 @@ jobs:
cache: gradle
timeout-minutes: 3

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Test
run: ./gradlew unitTest

- name: Sonarqube analyze
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./gradlew sonar

integration-test:
name: Build on Cassandra
runs-on: ubuntu-latest
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# Cassdio (`Cass`andra Stu`dio`)

Cassdio is centralized web management system for managing [Apache Cassandra](https://cassandra.apache.org/_/index.html)!

Cassdio provide powerful tools to efficiently manage and monitor Apache Cassandra databases. You can monitor the real-time status of your database clusters and perform various tasks intuitively through a user-friendly interface.
Cassdio provide powerful tools to efficiently manage and monitor Apache Cassandra databases. You can monitor the
real-time status of your database clusters and perform various tasks intuitively through a user-friendly interface.

This management system helps simplify system operations and enhance stability. It's an essential tool for managing Apache Cassandra databases, offering excellent functionality and user convenience.
This management system helps simplify system operations and enhance stability. It's an essential tool for managing
Apache Cassandra databases, offering excellent functionality and user convenience.

[![latest-tag](https://badgen.net/github/release/hakdang/cassdio)](https://github.com/hakdang/cassdio/releases)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=hakdang_cassdio&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=hakdang_cassdio)

## Demo

![intro_screenshot](./docs/screenshot/intro_s1.gif)

## Features

- `Multi Cassandra Cluster(With AuthCredentials)`
- Node Monitoring
- `View Keysapce`
Expand All @@ -22,16 +28,17 @@ This management system helps simplify system operations and enhance stability. I
- CQL Query

## Requirements

- JDK 21

### Support Versions
### Support Cassandra Versions

Version | Supported | Cassandra Docs
-- | -- | --
3.11 | O | [Link](https://cassandra.apache.org/doc/3.11/index.html)
4.0 | O | [Link](https://cassandra.apache.org/doc/4.0/index.html)
4.1 | O | [Link](https://cassandra.apache.org/doc/4.1/index.html)
5.0 | O | [Link](https://cassandra.apache.org/doc/5.0/index.html)
Version | Supported | Cassandra Docs
---------|-----------|----------------------------------------------------------
3.11 | O | [Link](https://cassandra.apache.org/doc/3.11/index.html)
4.0 | O | [Link](https://cassandra.apache.org/doc/4.0/index.html)
4.1 | O | [Link](https://cassandra.apache.org/doc/4.1/index.html)
5.0 | O | [Link](https://cassandra.apache.org/doc/5.0/index.html)

## Getting Started

Expand All @@ -45,7 +52,7 @@ java -jar ./cassdio-0.0.2.jar

### Browser

> http://locahost:20000
> http://localhost:20000

### Jar Build Command

Expand All @@ -54,6 +61,7 @@ java -jar ./cassdio-0.0.2.jar
[//]: # (## Environment)

[//]: # ()

[//]: # (env name | description | env value | default value)

[//]: # (-- | -- | -- | --)
Expand All @@ -62,3 +70,7 @@ java -jar ./cassdio-0.0.2.jar

[//]: # ()

## License

Cassdio is Open Source software released under
the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html).
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
id 'org.springframework.boot' version '3.3.2'
id 'io.spring.dependency-management' version '1.1.6'
id 'com.github.node-gradle.node' version '7.0.2'
id "org.sonarqube" version "5.1.0.4882"
}

allprojects {
Expand Down Expand Up @@ -77,3 +78,11 @@ subprojects {
}
}
}

sonar {
properties {
property "sonar.projectKey", "hakdang_cassdio"
property "sonar.organization", "hakdang"
property "sonar.host.url", "https://sonarcloud.io"
}
}
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

echo "Cassdio Build!! Start!!!!"

./gradlew :cassdio-web:clean :cassdio-web:build -Pfrontend=true

echo "Cassdio Build!! Complete!!!"
7 changes: 3 additions & 4 deletions cassdio-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ dependencies {
// Spring Boot
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.mapdb:mapdb:3.1.0")
//TODO ClusterFactory 만들어지면 변경
api("com.datastax.oss:java-driver-core:${datastaxJavaDriverVersion}")
api("com.datastax.oss:java-driver-query-builder:${datastaxJavaDriverVersion}")
api("com.datastax.oss:java-driver-mapper-runtime:${datastaxJavaDriverVersion}")
implementation("com.datastax.oss:java-driver-core:${datastaxJavaDriverVersion}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core 영역에서만 driver 관련 로직 작성하도록 설정 변경했습니다.

implementation("com.datastax.oss:java-driver-query-builder:${datastaxJavaDriverVersion}")
implementation("com.datastax.oss:java-driver-mapper-runtime:${datastaxJavaDriverVersion}")
// implementation("com.datastax.oss:java-driver-core:${datastaxJavaDriverVersion}")
// implementation("com.datastax.oss:java-driver-query-builder:${datastaxJavaDriverVersion}")
// implementation("com.datastax.oss:java-driver-mapper-runtime:${datastaxJavaDriverVersion}")
Comment on lines 8 to 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

제거해도 좋을거 같네요

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package kr.hakdang.cassdio.common.utils;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.UUID;
import java.util.zip.CRC32;

Expand All @@ -9,7 +12,8 @@
* @author akageun
* @since 2024-07-17
*/
public abstract class IdGenerator {
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class IdGenerator {

public static String makeId() {
String uuid = UUID.randomUUID().toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package kr.hakdang.cassdio.core.domain;

import kr.hakdang.cassdio.core.domain.cluster.CassdioConsistencyLevel;
import com.datastax.oss.driver.api.core.DefaultConsistencyLevel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* BootstrapProvider
*
* @author akageun
* @since 2024-07-30
*/
@Slf4j
@Service
public class BootstrapProvider {

public Map<String, Object> consistencyLevels() {
Map<String, Object> result = new HashMap<>();
result.put("consistencyLevels", CassdioConsistencyLevel.makeList(DefaultConsistencyLevel.values()));
result.put("defaultConsistencyLevel", CassdioConsistencyLevel.make(DefaultConsistencyLevel.LOCAL_ONE)); //TODO : System Config

return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.datastax.oss.driver.internal.core.util.Strings;
import kr.hakdang.cassdio.common.utils.Jsons;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;
Expand All @@ -28,6 +29,9 @@
@Slf4j
public abstract class BaseClusterCommander {

@Autowired
protected CqlSessionFactory cqlSessionFactory;

protected List<Map<String, Object>> convertRows(CqlSession session, ResultSet resultSet) {
ColumnDefinitions definitions = resultSet.getColumnDefinitions();
CodecRegistry codecRegistry = session.getContext().getCodecRegistry();
Expand All @@ -47,40 +51,44 @@ protected Map<String, Object> convertRow(CodecRegistry codecRegistry, ColumnDefi
TypeCodec<Object> codec = codecRegistry.codecFor(definition.getType());
Object value = codec.decode(row.getBytesUnsafe(i), row.protocolVersion());

String formatedValue;
if (codec instanceof MapCodec) {
DataType cqlType = codec.getCqlType();
DataType keyType = ((MapType) cqlType).getKeyType();
DataType valueType = ((MapType) cqlType).getValueType();
TypeCodec<Object> keyCodec = codecRegistry.codecFor(keyType);
TypeCodec<Object> valueCodec = codecRegistry.codecFor(valueType);
Map<Object, Object> valueMap = (Map<Object, Object>) value;
Map<String, String> convertedMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : valueMap.entrySet()) {
String key = keyCodec.format(entry.getKey());
if (Strings.isQuoted(key)) {
key = Strings.unquote(key);
}

String entryValue = valueCodec.format(entry.getValue());
if (Strings.isQuoted(entryValue)) {
entryValue = Strings.unquote(entryValue);
}

convertedMap.put(key, entryValue);
String formatedValue = makeFormatedValue(codecRegistry, codec, value);

result.put(name, formatedValue);
}

return result;
}

private static String makeFormatedValue(CodecRegistry codecRegistry, TypeCodec<Object> codec, Object value) {
if (codec instanceof MapCodec) {
DataType cqlType = codec.getCqlType();
DataType keyType = ((MapType) cqlType).getKeyType();
DataType valueType = ((MapType) cqlType).getValueType();
TypeCodec<Object> keyCodec = codecRegistry.codecFor(keyType);
TypeCodec<Object> valueCodec = codecRegistry.codecFor(valueType);
Map<Object, Object> valueMap = (Map<Object, Object>) value;
Map<String, String> convertedMap = new HashMap<>();
for (Map.Entry<Object, Object> entry : valueMap.entrySet()) {
String key = keyCodec.format(entry.getKey());
if (Strings.isQuoted(key)) {
key = Strings.unquote(key);
}

formatedValue = Jsons.toJson(convertedMap);
} else {
formatedValue = codec.format(value);
if (Strings.isQuoted(formatedValue)) {
formatedValue = Strings.unquote(formatedValue);
String entryValue = valueCodec.format(entry.getValue());
if (Strings.isQuoted(entryValue)) {
entryValue = Strings.unquote(entryValue);
}

convertedMap.put(key, entryValue);
}

result.put(name, formatedValue);
return Jsons.toJson(convertedMap);
}

return result;
String formatedValue = codec.format(value);
if (Strings.isQuoted(formatedValue)) {
formatedValue = Strings.unquote(formatedValue);
}
return formatedValue;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kr.hakdang.cassdio.web.common.dto.response;
package kr.hakdang.cassdio.core.domain.cluster;

import com.datastax.oss.driver.api.core.DefaultConsistencyLevel;
import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package kr.hakdang.cassdio.core.domain.cluster;

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.Version;
import kr.hakdang.cassdio.common.error.NotSupportedCassandraVersionException;
import org.springframework.stereotype.Service;

/**
* CassdioVersionChecker
*
* @author seungh0
* @since 2024-07-31
*/
@Service
public class CassdioVersionChecker {

private static final Version MIN_SUPPORT_VERSION = Version.V3_0_0;

private final ClusterVersionEvaluator clusterVersionEvaluator;
private final ClusterConnector clusterConnector;

public CassdioVersionChecker(ClusterVersionEvaluator clusterVersionEvaluator, ClusterConnector clusterConnector) {
this.clusterVersionEvaluator = clusterVersionEvaluator;
this.clusterConnector = clusterConnector;
}

public void verifyCompatibilityCassandraVersion(ClusterConnection connection) {
try (CqlSession session = clusterConnector.makeSession(connection)) {
if (clusterVersionEvaluator.isLessThan(session, MIN_SUPPORT_VERSION)) {
throw new NotSupportedCassandraVersionException("Not supported cassandra with cluster version");
}
}
}

}
Loading
Loading