Skip to content

Commit

Permalink
helm chart + many changes mostly bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrocjdpereira committed Jul 26, 2024
1 parent 6ea13aa commit 6b0286e
Show file tree
Hide file tree
Showing 23 changed files with 331 additions and 57 deletions.
2 changes: 2 additions & 0 deletions cfs-portal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM node:14

WORKDIR /usr/app

COPY . /usr/app

COPY package*.json ./

RUN npm install
Expand Down
2 changes: 1 addition & 1 deletion cfs-portal/src/api/api.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";

const api = axios.create({
baseURL: 'http://localhost:8080/oss/v1'
baseURL: 'http://10.255.32.88:8080/oss/v1'
});

// App Package
Expand Down
28 changes: 12 additions & 16 deletions cfs-portal/src/components/InstanceGrid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const InstanceGrid = ({ minimalConfig = false, instanceCount }: InstanceGridProp
}, []);

useEffect(() => {
const ws = new WebSocket('ws://localhost:8001');
const ws = new WebSocket('ws://10.255.32.88:8001');
setSocket(ws);
}, []);

Expand All @@ -86,7 +86,15 @@ const InstanceGrid = ({ minimalConfig = false, instanceCount }: InstanceGridProp
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
setMetrics((prevMetrics) => {
if (prevMetrics && data.appi_id in prevMetrics) {
console.log(data)
console.log(prevMetrics)
if(data.appi_id != undefined){
if(!prevMetrics){
prevMetrics = {}
}
if (!(data.appi_id in prevMetrics)){
prevMetrics[data.appi_id] = {}
}
if (data.mem_load != undefined && data.cpu_load != undefined) {
return {
...prevMetrics,
Expand All @@ -98,28 +106,16 @@ const InstanceGrid = ({ minimalConfig = false, instanceCount }: InstanceGridProp
};
}
else {
var temp = {
return {
...prevMetrics,
[data.appi_id]: {
...prevMetrics[data.appi_id],
node: data.node,
lat: data[data.node]
}
};
console.log(temp)
return temp
}
} else {
return {
...prevMetrics,
[data.appi_id]: {
memLoad: data.mem_load,
cpuLoad: data.cpu_load,
node: data.node,
lat: data[data.node]
}
};
}
};
});
};
socket.onclose = () => {
Expand Down
51 changes: 19 additions & 32 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ services:
oss:
build: ./oss
ports:
- "${OSS_PORT}:${OSS_PORT}"
- "${OSS_WS_PORT}:${OSS_WS_PORT}"
- "8080:8080"
- "8001:8001"
expose:
- "${OSS_PORT}"
- "8080"
volumes:
- ./oss:/usr/app
depends_on:
- mongo
environment:
- OSM_HOSTNAME=${OSM_IP}
- OSS_PORT=${OSS_PORT}
- OSS_WS_PORT=${OSS_WS_PORT}
- KAFKA_BOOTSTRAP_SERVERS=${OSM_IP}:${KAFKA_PORT}
- MONGO_USER=${MONGO_USER}
- MONGO_PASSWORD=${MONGO_PASSWORD}
- OSM_HOSTNAME=10.255.32.88:9999
- OSS_PORT=8080
- OSS_WS_PORT=8001
- KAFKA_BOOTSTRAP_SERVERS=10.255.32.88:9999:14000
- MONGO_USER=root
- MONGO_PASSWORD=pass
restart: on-failure
networks:
- temp-network
Expand All @@ -42,35 +42,22 @@ services:
# - zookeeper
- mongo
environment:
- OSM_HOSTNAME=${OSM_IP}
- KAFKA_BOOTSTRAP_SERVERS=${OSM_IP}:${KAFKA_PORT}
- MONGO_USER=${MONGO_USER}
- MONGO_PASSWORD=${MONGO_PASSWORD}
- OSM_HOSTNAME=10.255.32.88:9999
- KAFKA_BOOTSTRAP_SERVERS=10.255.32.88:9999:14000
- MONGO_USER=root
- MONGO_PASSWORD=pass
restart: on-failure
networks:
- temp-network

#container-data-api:
# build: ./container-data-api
# ports:
# - "8000:8000"
# environment:
# - PYTHONUNBUFFERED=1
# - NBI_URL=https://${OSM_IP}/osm
# - KUBECTL_COMMAND=${KUBECTL_COMMAND}
# - KUBECTL_CONFIG_PATH=${KUBECTL_CONFIG_PATH}
# - UPDATE_CONTAINER_IDS_FREQ=${UPDATE_CONTAINER_IDS_FREQ}
# networks:
# - temp-network

mongo:
image: mongo
volumes:
- app-mongo-db-data:/data/db
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: "${MONGO_USER}"
MONGO_INITDB_ROOT_PASSWORD: "${MONGO_PASSWORD}"
MONGO_INITDB_ROOT_USERNAME: "root"
MONGO_INITDB_ROOT_PASSWORD: "pass"
networks:
- temp-network

Expand All @@ -80,10 +67,10 @@ services:
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: "${MONGO_USER}"
ME_CONFIG_MONGODB_ADMINPASSWORD: "${MONGO_PASSWORD}"
ME_CONFIG_MONGODB_URL: mongodb://${MONGO_USER}:${MONGO_PASSWORD}@mongo:27017/
ME_CONFIG_MONGODB_ENABLE_ADMIN: "${MONGO_EXPRESS_ENABLE_ADMIN}"
ME_CONFIG_MONGODB_ADMINUSERNAME: "root"
ME_CONFIG_MONGODB_ADMINPASSWORD: "pass"
ME_CONFIG_MONGODB_URL: mongodb://root:pass@mongo:27017/
ME_CONFIG_MONGODB_ENABLE_ADMIN: "true"
networks:
- temp-network

Expand Down
2 changes: 2 additions & 0 deletions meao/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ENV PYTHONUNBUFFERED=1

WORKDIR /usr/app

COPY . /usr/app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

Expand Down
8 changes: 8 additions & 0 deletions osm-mec-helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: osm-mec
description: A Helm chart for OSM-MEC project
version: 0.0.1
apiVersion: v1
keywords:
- osm-mec
sources:
home:
1 change: 1 addition & 0 deletions osm-mec-helm-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This chart was created by Kompose
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: app-mongo-db-data
name: app-mongo-db-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: cfs-portal-claim0
name: cfs-portal-claim0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
33 changes: 33 additions & 0 deletions osm-mec-helm-chart/templates/cfs-portal-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: cfs-portal
name: cfs-portal
spec:
replicas: 1
selector:
matchLabels:
app: cfs-portal
strategy:
type: Recreate
template:
metadata:
labels:
app: cfs-portal
spec:
containers:
- env:
- name: CHOKIDAR_USEPOLLING
value: "true"
image: localhost:5000/cfs-portal:latest
imagePullPolicy: Always
name: cfs-portal
ports:
- containerPort: 3000
protocol: TCP
restartPolicy: Always
volumes:
- name: cfs-portal-claim0
persistentVolumeClaim:
claimName: cfs-portal-claim0
15 changes: 15 additions & 0 deletions osm-mec-helm-chart/templates/cfs-portal-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: cfs-portal
name: cfs-portal
spec:
type: NodePort
ports:
- name: "3000"
port: 3000
targetPort: 3000
nodePort: 30000
selector:
app: cfs-portal
32 changes: 32 additions & 0 deletions osm-mec-helm-chart/templates/meao-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: meao
name: meao
spec:
replicas: 1
selector:
matchLabels:
app: meao
strategy:
type: Recreate
template:
metadata:
labels:
app: meao
spec:
containers:
- env:
- name: KAFKA_BOOTSTRAP_SERVERS
value: 10.255.32.88:14000
- name: MONGO_PASSWORD
value: pass
- name: MONGO_USER
value: root
- name: OSM_HOSTNAME
value: 10.255.32.88:9999
image: localhost:5000/meao:latest
imagePullPolicy: Always
name: meao
restartPolicy: Always
34 changes: 34 additions & 0 deletions osm-mec-helm-chart/templates/mongo-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mongo
name: mongo
spec:
replicas: 1
selector:
matchLabels:
app: mongo
strategy:
type: Recreate
template:
metadata:
labels:
app: mongo
spec:
containers:
- env:
- name: MONGO_INITDB_ROOT_PASSWORD
value: pass
- name: MONGO_INITDB_ROOT_USERNAME
value: root
image: mongo
name: mongo
volumeMounts:
- mountPath: /data/db
name: app-mongo-db-data
restartPolicy: Always
volumes:
- name: app-mongo-db-data
persistentVolumeClaim:
claimName: app-mongo-db-data
32 changes: 32 additions & 0 deletions osm-mec-helm-chart/templates/mongo-express-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: mongo-express
name: mongo-express
spec:
replicas: 1
selector:
matchLabels:
app: mongo-express
template:
metadata:
labels:
app: mongo-express
spec:
containers:
- env:
- name: ME_CONFIG_MONGODB_ADMINPASSWORD
value: pass
- name: ME_CONFIG_MONGODB_ADMINUSERNAME
value: root
- name: ME_CONFIG_MONGODB_ENABLE_ADMIN
value: "true"
- name: ME_CONFIG_MONGODB_URL
value: mongodb://root:pass@mongo:27017/
image: mongo-express
name: mongo-express
ports:
- containerPort: 8081
protocol: TCP
restartPolicy: Always
14 changes: 14 additions & 0 deletions osm-mec-helm-chart/templates/mongo-express-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: mongo-express
name: mongo-express
spec:
type: ClusterIP
ports:
- name: "8081"
port: 8081
targetPort: 8081
selector:
app: mongo-express
14 changes: 14 additions & 0 deletions osm-mec-helm-chart/templates/mongo-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: mongo
name: mongo
spec:
type: ClusterIP
ports:
- name: "27017"
port: 27017
targetPort: 27017
selector:
app: mongo
Loading

0 comments on commit 6b0286e

Please sign in to comment.