Skip to content

Commit

Permalink
Feature: implement basic structure of the project (#13)
Browse files Browse the repository at this point in the history
* feature: added basic project structure

* fix: fixed bugs

* feature: implemented secrets validation

* feature: improved RepoAchiever Cluster module structure

* fix: fixed bugs

* fix: fixed bugs

* fix: added statement closure after execution

* fix: fixed bugs

* fix: fixed bugs

* feature: added diagnostics template processing

* fix: fixed bugs

* feature: added Grafana deployment

* feature: added metrics server

* fix: fixed bugs

* fix: fixed bugs

* feature: added cluster topology withdrawal logic

* fix: fixed bugs

* feature: added logs during RepoAchiever Cluster operations

* fix: fixed bugs

* fix: fixed bugs

* fix: fixed bugs

* fix: fixed bugs

* fix: fixed bugs
  • Loading branch information
YarikRevich authored May 12, 2024
1 parent b01352c commit de36745
Show file tree
Hide file tree
Showing 449 changed files with 25,300 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Idea

.idea/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Yaroslav Svitlytskyi
Copyright (c) 2022 YarikRevich

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
135 changes: 135 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
dev := $(or $(dev), 'false')

ifneq (,$(wildcard .env))
include .env
export
endif

.PHONY: help
.DEFAULT_GOAL := help
help:
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: clean
clean: ## Clean project area
@mvn clean

.PHONY: prepare
prepare: ## Install prerequisites
@mvn org.apache.maven.plugins:maven-dependency-plugin:3.6.0:tree -Dverbose=true

.PHONY: test
test: clean ## Run both unit and integration tests
@mvn test
@mvn verify

.PHONY: lint
lint: ## Run Apache Spotless linter
@mvn spotless:apply

.PHONY: create-local-client
create-local-client: ## Create ResourceTracker local directory for client
@mkdir -p $(HOME)/.repoachiever/config

.PHONY: create-local-api-server
create-local-api-server: ## Create ResourceTracker local directory for API Server
@mkdir -p $(HOME)/.repoachiever/config
@mkdir -p $(HOME)/.repoachiever/diagnostics/prometheus/internal
@mkdir -p $(HOME)/.repoachiever/diagnostics/prometheus/config
@mkdir -p $(HOME)/.repoachiever/diagnostics/grafana/internal
@mkdir -p $(HOME)/.repoachiever/diagnostics/grafana/config/dashboards
@mkdir -p $(HOME)/.repoachiever/diagnostics/grafana/config/datasources
@mkdir -p $(HOME)/.repoachiever/workspace
@mkdir -p $(HOME)/.repoachiever/internal/database
@mkdir -p $(HOME)/.repoachiever/internal/state

.PHONY: clone-client-config
clone-client-config: ## Clone configuration files to local directory
@cp -r ./samples/config/client/user.yaml $(HOME)/.repoachiever/config

.PHONY: clone-api-server-config
clone-api-server-config: ## Clone RepoAchiever API Server configuration files to local directory
@cp -r ./config/grafana/dashboards/dashboard.yml $(HOME)/.repoachiever/diagnostics/grafana/config/dashboards
@cp -r ./config/grafana/dashboards/diagnostics.tmpl $(HOME)/.repoachiever/diagnostics/grafana/config/dashboards
@cp -r ./config/grafana/datasources/datasource.tmpl $(HOME)/.repoachiever/diagnostics/grafana/config/datasources
@cp -r ./config/prometheus/prometheus.tmpl $(HOME)/.repoachiever/diagnostics/prometheus/config
@cp -r ./samples/config/api-server/api-server.yaml $(HOME)/.repoachiever/config

.PHONY: clone-worker
clone-worker: ## Clone Worker JAR into a RepoAchiever local directory
ifeq (,$(wildcard $(HOME)/.repoachiever/bin/worker))
@mkdir -p $(HOME)/.repoachiever/bin
endif
@cp -r ./bin/worker $(HOME)/.repoachiever/bin/

.PHONY: clone-cluster
clone-cluster: ## Clone Cluster JAR into a RepoAchiever local directory
ifeq (,$(wildcard $(HOME)/.repoachiever/bin/cluster))
@mkdir -p $(HOME)/.repoachiever/bin
endif
@cp -r ./bin/cluster $(HOME)/.repoachiever/bin/

.PHONY: clone-api-server
clone-api-server: ## Clone API Server JAR into a RepoAchiever local directory
ifeq (,$(wildcard $(HOME)/.repoachiever/bin/api-server))
@mkdir -p $(HOME)/.repoachiever/bin
endif
@cp -r ./bin/api-server $(HOME)/.repoachiever/bin/

.PHONY: build-worker
build-worker: clean ## Build Worker application
ifneq (,$(wildcard ./bin/worker))
@rm -r ./bin/worker
endif
ifeq ($(dev), 'false')
@mvn -pl worker -T10 install
else
@mvn -P dev -pl worker -T10 install
endif
$(MAKE) clone-worker

.PHONY: build-cluster
build-cluster: clean ## Build Cluster application
ifneq (,$(wildcard ./bin/cluster))
@rm -r ./bin/cluster
endif
ifeq ($(dev), 'false')
@mvn -pl cluster -T10 install
else
@mvn -P dev -pl cluster -T10 install
endif
$(MAKE) clone-cluster

.PHONY: build-api-server
build-api-server: clean create-local-api-server clone-api-server-config ## Build API Server application
ifneq (,$(wildcard ./bin/api-server))
@rm -r ./bin/api-server
endif
ifeq ($(dev), 'false')
@mvn -pl api-server -T10 install
else
@mvn -P dev -pl api-server -T10 install
endif
$(MAKE) clone-api-server

.PHONY: build-cli
build-cli: clean create-local-client clone-client-config ## Build CLI application
ifneq (,$(wildcard ./bin/cli))
@rm -r ./bin/cli
endif
ifeq ($(dev), 'false')
@mvn -pl cli -T10 install
else
@mvn -P dev -pl cli -T10 install
endif

.PHONY: build-gui
build-gui: clean create-local-client clone-client-config create-local-api-server build-api-server ## Build GUI application
ifneq (,$(wildcard ./bin/gui))
@rm -r ./bin/gui
endif
ifeq ($(dev), 'false')
@mvn -pl gui -T10 install
else
@mvn -P dev -pl gui -T10 install
endif
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# RepoAchiever

[![Build](https://github.com/YarikRevich/ResourceTracker/actions/workflows/build.yml/badge.svg)](https://github.com/YarikRevich/ResourceTracker/actions/workflows/build.yml)
![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)
![MacOS](https://img.shields.io/badge/MacOS-8773f5?style=for-the-badge&logo=macos&logoColor=black)
[![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

## General Information

A tool used for remote Git repositories achieving operations.

![](./docs/high-level-design.png)

![](./docs/detailed-design.png)

![](./docs/workspace-design.png)

RepoAchiever uses server-side data validation. It means, that on client side no data transformation or further analysis are made.
Only API Server calls are on client side responsibility.

## Setup

All setup related operations are processed via **Makefile** placed in the root directory.

### CLI

In order to build CLI it's required to execute the following command. Initially it cleans the environment and builds Java project using **Maven**
```shell
make build-cli
```

After the execution of command given above the executable will be generated and placed into **bin** folder in the root directory of the project

**CLI** build automatically places default **user.yaml** configuration file into ~/.resourcetracker/config directory.

### GUI

In order to build GUI it's required to execute the following command. Initially it cleans the environment and build Java project using **Maven**
```shell
make build-gui
```

After the execution of command given above the executable will be generated and placed into **bin** folder in the root directory of the project

**GUI** build automatically compiles **API Server** and places both executable JAR and other dependencies into **~/.resourcetracker/bin/api-server** directory

It's highly recommended not to move **API Server** files from the default local directory

### API Server

In order to build **API Server** it's required to execute the following command. Initially it cleans the environment and build Java project using **Maven**
```shell
make build-api-server
```

After the execution of command given above the executable will be generated and placed into **bin** folder in the root directory of the project

## Use cases

For both **CLI** and **GUI** examples, there was used the following user configuration file:
```yaml
requests:
- name: "first"
frequency: "10 * * * * *"
file: "/Volumes/Files/first.sh"
cloud:
provider: "aws"
credentials:
file: "/Volumes/Files/aws.csv"
region: "us-west-2"
api-server:
host: "http://localhost:8080"
```
And the following request script file:
```shell
#!/bin/bash

echo "Hello world!"
```

### CLI

![cli](./docs/example/cli.gif)

### GUI

![gui](./docs/example/gui.gif)
9 changes: 9 additions & 0 deletions api-server/api-server.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/openapi" isTestSource="false" generated="true" />
</content>
</component>
</module>
Loading

0 comments on commit de36745

Please sign in to comment.