Skip to content

Develop switch kub #567

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

Open
wants to merge 54 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
14cd63a
Merge pull request #562 from hobbit-project/develop
MichaelRoeder Jan 22, 2024
8517e05
Merge pull request #564 from hobbit-project/develop
MichaelRoeder Jan 22, 2024
33624f1
start migrating to kubernetes
farshad68 Jan 16, 2025
bdb8e48
first class migrated
farshad68 Jan 24, 2025
b55c430
add ClusterManagerImpl for Kub
farshad68 Jan 27, 2025
5d317b3
move to kub directory
farshad68 Jan 28, 2025
3db7479
add yaml files
farshad68 Feb 3, 2025
006e5ab
add yaml files, storage service running
farshad68 Feb 3, 2025
53c6825
add yaml files , redis and role
farshad68 Feb 4, 2025
0af737e
update yaml files
farshad68 Feb 10, 2025
e4eba4e
add pv
farshad68 Feb 10, 2025
47265c7
add user ID to use NFS
farshad68 Feb 10, 2025
bc96290
update security Context
farshad68 Feb 11, 2025
a70a6fd
Cluster role
farshad68 Feb 11, 2025
258f246
add a lot of logs
farshad68 Feb 13, 2025
ec954e1
add yaml files , keycloak db2 file
farshad68 Feb 19, 2025
b923293
middle way of converting container name to IP
farshad68 Mar 7, 2025
ea8e80c
change yaml files
farshad68 Mar 17, 2025
6a3c105
all changes until now , error with hostname in modules
farshad68 Mar 17, 2025
6f7197d
working version . need refactor and code cleaning
farshad68 Apr 1, 2025
4b47533
make the code cleaner
farshad68 Apr 2, 2025
5a4285b
remove extra unnecessary codes of methods getContainerPodId and getCo…
farshad68 Apr 3, 2025
8b64ec9
minor changes
farshad68 Apr 4, 2025
68ee813
split the code of platform controller init between docker and kubern…
farshad68 Apr 7, 2025
e3db039
remove extra logs
farshad68 Apr 7, 2025
accfcbf
add some javadoc
farshad68 Apr 7, 2025
21e41c2
remove extra Override
farshad68 Apr 7, 2025
3a19415
add RUN_ON env to git workflow
farshad68 Apr 8, 2025
659dfc8
remove external true from docker compose then make the network itself
farshad68 Apr 8, 2025
53e89d7
try create network for docker
farshad68 Apr 8, 2025
483b17d
undo changes in git make workflow
farshad68 Apr 8, 2025
b8ca8cf
change make.yml to make docker socket reachable
farshad68 Apr 8, 2025
f377602
init docker swarm
farshad68 Apr 8, 2025
92c848f
init docker swarm before anything
farshad68 Apr 8, 2025
3aff943
start rabitMQ manually
farshad68 Apr 8, 2025
9a12137
add HOBBIT_RABBIT_EXPERIMENTS_HOST to environment of docke compose
farshad68 Apr 9, 2025
1aec5cf
start rabbitmq cluster also in test
farshad68 Apr 9, 2025
1c0889b
print massages in makefile
farshad68 Apr 9, 2025
0be4951
docker-compose change with docker compose for rabbitmq
farshad68 Apr 9, 2025
5efe053
run single rabbitmq
farshad68 Apr 9, 2025
48bbf41
try finding where is the problem with rabitmq
farshad68 Apr 9, 2025
25cf0f7
connect rabbit to network core
farshad68 Apr 9, 2025
dd3b74d
ler rabbitmq run from controller test makefile
farshad68 Apr 9, 2025
3ed1dfb
change in platform controller make file remove extra echo
farshad68 Apr 9, 2025
2d99947
change in platform controller make file remove extra echo
farshad68 Apr 9, 2025
ee3a5e7
add MAX_EXECUTION_TIME
farshad68 Apr 9, 2025
5a8c43d
now ENV should set correctly !
farshad68 Apr 10, 2025
94e8de1
now ENV should set correctly !
farshad68 Apr 10, 2025
b457d77
Log the network list after creation
denkv Apr 14, 2025
02632bf
add ContainerEngine
farshad68 Apr 15, 2025
7aaa7fc
add comments , javadoc
farshad68 Apr 15, 2025
94e1a82
add more documentation
farshad68 Apr 15, 2025
8731126
add readme.md for yaml files
farshad68 Apr 16, 2025
b8235fc
add @author to all files I changed, not the files add log or change …
farshad68 Apr 16, 2025
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
79 changes: 67 additions & 12 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,73 @@
#name: make
#on: push
#jobs:
# make:
# # https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-java@v1
# with:
# java-version: 11
# - uses: actions/setup-node@v2
# with:
# node-version: 8
# - run: |
# docker swarm init
# - run: docker compose -f docker-compose-dev.yml pull cadvisor node-exporter prometheus rabbit redis
# - run: make test
name: make
on: push

jobs:
make:
# https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job
runs-on: ubuntu-22.04

services:
docker:
image: docker:24.0.7-dind
options: --privileged
env:
DOCKER_TLS_CERTDIR: ""
ports:
- 2375:2375

env:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/setup-node@v2
with:
node-version: 8
- run: |
docker swarm init
- run: docker compose -f docker-compose-dev.yml pull cadvisor node-exporter prometheus rabbit redis
- run: make test
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: 11

- uses: actions/setup-node@v2
with:
node-version: 8

- name: Wait for Docker to start
run: |
sleep 10
docker version

- name: Initialize Docker Swarm
run: docker swarm init

- name: Pull required images
run: docker compose -f docker-compose-dev.yml pull cadvisor node-exporter prometheus rabbit redis

# - name: Wait for RabbitMQ to be ready
# run: |
# echo "Waiting for RabbitMQ..."
# for i in {1..30}; do
# nc -z rabbit 5672 && echo "RabbitMQ is up!" && exit 0
# echo "Still waiting for RabbitMQ..."
# sleep 3
# done
# echo "RabbitMQ not responding on port 5672" >&2
# docker ps
# exit 1
- name: Run make test
run: make test
61 changes: 56 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,24 @@ start-dev: start-rabbitmq-cluster start-dev-platform
start-dev-elk: start-rabbitmq-cluster start-dev-platform start-dev-elk

start-rabbitmq-cluster:
@echo "📡 Starting RabbitMQ cluster..."
cd rabbitmq-cluster && make start

@echo "✅ RabbitMQ cluster started."

# start-rabbitmq:
# @echo "📡 Starting standalone RabbitMQ container on 'hobbit' network..."
# @docker network inspect hobbit >/dev/null || (echo "❌ Network 'hobbit' not found. Run 'make create-networks' first." && exit 1)
# @docker rm -f hobbit-rabbitmq >/dev/null 2>&1 || true
# @docker run -d \
# --name hobbit-rabbitmq \
# --network hobbit \
# -p 5672:5672 \
# -p 15672:15672 \
# rabbitmq:3-management
# @docker network connect hobbit-core hobbit-rabbitmq
# @echo "✅ RabbitMQ is running at:"
# @echo " AMQP: amqp://localhost:5672"
# @echo " Management: http://localhost:15672 (user: guest, pass: guest)"
start-dev-platform:
docker-compose -f docker-compose-dev.yml up -d

Expand All @@ -40,9 +56,20 @@ build-dev-storage-image:
docker build -t hobbitproject/hobbit-storage-service:dev --file ./platform-storage/storage-service/Dockerfile .

create-networks:
@docker network inspect hobbit >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.100.0/24 hobbit && echo "Created network: hobbit")
@docker network inspect hobbit-core >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.101.0/24 hobbit-core && echo "Created network: hobbit-core")
@docker network inspect hobbit-services >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.102.0/24 hobbit-services && echo "Created network: hobbit-services")
# @docker network inspect hobbit >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.100.0/24 hobbit && echo "Created network: hobbit")
# @docker network inspect hobbit-core >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.101.0/24 hobbit-core && echo "Created network: hobbit-core")
# @docker network inspect hobbit-services >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.102.0/24 hobbit-services && echo "Created network: hobbit-services")
@echo "🔌 Checking or creating Docker network: hobbit"
@docker network inspect hobbit >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.100.0/24 hobbit && echo "✅ Created network: hobbit")

@echo "🔌 Checking or creating Docker network: hobbit-core"
@docker network inspect hobbit-core >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.101.0/24 hobbit-core && echo "✅ Created network: hobbit-core")

@echo "🔌 Checking or creating Docker network: hobbit-services"
@docker network inspect hobbit-services >/dev/null || (docker network create -d overlay --attachable --subnet 172.16.102.0/24 hobbit-services && echo "✅ Created network: hobbit-services")

docker network ls --no-trunc
@echo "🌐 Docker networks ready."

set-keycloak-permissions:
@chmod --changes 777 config/keycloak
Expand All @@ -61,15 +88,39 @@ run-platform-elk:
docker stack deploy --compose-file docker-compose-elk.yml elk
docker stack deploy --compose-file docker-compose.yml platform

# test: create-networks install-parent-pom start-rabbitmq-cluster
# make --directory=platform-controller test
# cd platform-storage/storage-service && mvn --quiet --update-snapshots clean test
# cd analysis-component && mvn --quiet --update-snapshots clean test
# cd hobbit-gui/gui-client && sh -c 'test "$$TRAVIS" = "true" && npm --quiet ci; true' && sh -c 'test "$$TRAVIS" = "true" || npm --quiet install; true' && npm --quiet run lint && npm --quiet run build-prod
# cd hobbit-gui/gui-serverbackend && mvn --quiet --update-snapshots clean test

test: create-networks install-parent-pom
@echo "🔧 Running tests in platform-controller..."
make --directory=platform-controller test

@echo "💾 Running tests in platform-storage/storage-service..."
cd platform-storage/storage-service && mvn --quiet --update-snapshots clean test

@echo "📊 Running tests in analysis-component..."
cd analysis-component && mvn --quiet --update-snapshots clean test
cd hobbit-gui/gui-client && sh -c 'test "$$TRAVIS" = "true" && npm --quiet ci; true' && sh -c 'test "$$TRAVIS" = "true" || npm --quiet install; true' && npm --quiet run lint && npm --quiet run build-prod

@echo "🖥️ Running lint and build in hobbit-gui/gui-client..."
cd hobbit-gui/gui-client && \
sh -c 'test "$$TRAVIS" = "true" && npm --quiet ci; true' && \
sh -c 'test "$$TRAVIS" = "true" || npm --quiet install; true' && \
npm --quiet run lint && \
npm --quiet run build-prod

@echo "🔙 Running tests in hobbit-gui/gui-serverbackend..."
cd hobbit-gui/gui-serverbackend && mvn --quiet --update-snapshots clean test

@echo "✅ All tests completed successfully!"

install-parent-pom:
@echo "📦 Installing parent POM..."
cd parent-pom && mvn --quiet install
@echo "✅ Parent POM installed."

local-controller: lc-build lc-run

Expand Down
61 changes: 61 additions & 0 deletions docker-compose-dev-temp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: '3.3'
services:
# message bus
rabbit:
image: rabbitmq:management
networks:
- hobbit
- hobbit-core
ports:
- "8081:15672"
# Forwarding the port for testing
- "5672:5672"

# DB for controller
redis:
image: redis:4.0.7
volumes:
- ./config/redis-db:/data
command: ["redis-server", "/data/redis.conf"]
networks:
- hobbit-core
ports:
# Forwarding the port for tests
- "6379:6379"

node-exporter:
image: prom/node-exporter
networks:
- hobbit-core

cadvisor:
image: gcr.io/cadvisor/cadvisor
networks:
- hobbit-core
volumes:
- /:/rootfs:ro
- /dev/disk:/dev/disk:ro
- /sys:/sys:ro
- /var/lib/docker:/var/lib/docker:ro
- /var/run:/var/run:rw

prometheus:
image: prom/prometheus
networks:
- hobbit-core
ports:
- "9090:9090"
volumes:
- ./config/prometheus:/config:ro
command: --config.file=/config/prometheus.conf
depends_on:
- node-exporter
- cadvisor

networks:
hobbit:
external: true
driver: overlay
hobbit-core:
external: true
driver: overlay
2 changes: 2 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
HOBBIT_RABBIT_IMAGE: "rabbitmq:management"
HOBBIT_RABBIT_HOST: "rabbit"
HOBBIT_REDIS_HOST: "redis"
HOBBIT_RABBIT_EXPERIMENTS_HOST: "redis"
DEPLOY_ENV: "develop"
GITLAB_USER: "${GITLAB_USER}"
GITLAB_EMAIL: "${GITLAB_EMAIL}"
Expand All @@ -20,6 +21,7 @@ services:
USE_GITLAB: "false"
LOCAL_METADATA_DIRECTORY: "/metadata"
DOCKER_AUTOPULL: "0"
RUN_ON: "docker"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./metadata:/metadata
Expand Down
14 changes: 14 additions & 0 deletions kubernetes-yaml-files/00-1-rabbitmq-pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: rabbitmq-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain # or Delete, depending on your needs
storageClassName: "" # Important: Leave this empty if not using Storage Classes
nfs:
server: 131.234.29.64
path: /data/nfs/kubedata/rabbitmq
10 changes: 10 additions & 0 deletions kubernetes-yaml-files/00-rabbitmq-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rabbitmq-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
80 changes: 80 additions & 0 deletions kubernetes-yaml-files/01-rabbitmq-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#apiVersion: apps/v1
#kind: Deployment
#metadata:
# name: rabbitmq
# labels:
# app: rabbitmq
#spec:
# replicas: 1
# selector:
# matchLabels:
# app: rabbitmq
# template:
# metadata:
# labels:
# app: rabbitmq
# spec:
# containers:
# - name: rabbitmq
# image: rabbitmq:3-management
# ports:
# - containerPort: 5672 # AMQP protocol (for applications)
# - containerPort: 15672 # Management UI (for admins)
# env:
# - name: RABBITMQ_DEFAULT_USER
# value: "guest"
# - name: RABBITMQ_DEFAULT_PASS
# value: "guest"
# volumeMounts:
# - mountPath: /var/lib/rabbitmq
# name: rabbitmq-storage
# volumes:
# - name: rabbitmq-storage
# persistentVolumeClaim:
# claimName: rabbitmq-pvc
apiVersion: apps/v1
kind: Deployment
metadata:
name: rabbitmq
labels:
app: rabbitmq
spec:
replicas: 1
selector:
matchLabels:
app: rabbitmq
template:
metadata:
labels:
app: rabbitmq
spec:
containers:
- name: rabbitmq
image: rabbitmq:3-management
securityContext:
runAsUser: 79184 # Replace with the actual numeric user ID
runAsGroup: 10000
ports:
- containerPort: 5672 # AMQP protocol (for applications)
- containerPort: 15672 # Management UI (for admins)
env:
- name: RABBITMQ_DEFAULT_USER
value: "guest"
- name: RABBITMQ_DEFAULT_PASS
value: "guest"
volumeMounts:
- mountPath: /var/lib/rabbitmq
name: rabbitmq-storage
initContainers:
- name: configure-rabbitmq
image: busybox
command: ['sh', '-c', 'echo "loopback_users.guest = false" > /etc/rabbitmq/rabbitmq.conf']
volumeMounts:
- mountPath: /etc/rabbitmq
name: rabbitmq-config
volumes:
- name: rabbitmq-storage
persistentVolumeClaim:
claimName: rabbitmq-pvc
- name: rabbitmq-config
emptyDir: {}
17 changes: 17 additions & 0 deletions kubernetes-yaml-files/02-rabbitmq-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: rabbitmq
labels:
app: rabbitmq
spec:
selector:
app: rabbitmq
ports:
- name: amqp
port: 5672 # Exposes AMQP port inside the cluster
targetPort: 5672
- name: management
port: 15672 # Exposes the Management UI inside the cluster
targetPort: 15672
type: ClusterIP # Internal access only
14 changes: 14 additions & 0 deletions kubernetes-yaml-files/03-01-virtuoso-pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: virtuoso-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain # or Delete, as needed
storageClassName: "" # Important: Leave empty if not using Storage Classes
nfs:
server: 131.234.29.64 # Your NFS server IP
path: /data/nfs/kubedata/virtuoso # The path to your exported NFS share
Loading
Loading