add pipeline before optimization

This commit is contained in:
lamya1baidouri 2025-01-01 20:32:15 +01:00
parent 6148ddd967
commit 99eb528f29
4 changed files with 63 additions and 91 deletions

View file

@ -1,31 +0,0 @@
name: Deploy and Test Cluster
on:
push:
branches: [main]
paths:
- 'k8s/**'
pull_request:
branches: [main]
paths:
- 'k8s/**'
jobs:
deploy-and-test-cluster:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
- name: Deploy application
run: |
kubectl apply -f k8s/
- name: Wait for Pods to be ready
run: |
kubectl wait --for=condition=ready pod -l app=demo-db --timeout=180s
kubectl wait --for=condition=ready pod -l app=petclinic --timeout=180s

View file

@ -1,31 +0,0 @@
# This workflow will build a Java project with Gradle, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'adopt'
cache: maven
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle
run: ./gradlew build

View file

@ -1,29 +0,0 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'adopt'
cache: maven
- name: Build with Maven Wrapper
run: ./mvnw -B verify

View file

@ -1,3 +1,5 @@
version: '3.8'
services:
mysql:
image: mysql:9.1
@ -11,6 +13,7 @@ services:
- MYSQL_DATABASE=petclinic
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
postgres:
image: postgres:17.0
ports:
@ -19,3 +22,63 @@ services:
- POSTGRES_PASSWORD=petclinic
- POSTGRES_USER=petclinic
- POSTGRES_DB=petclinic
# Ajout de Prometheus pour la collecte des métriques
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
# Ajout de Grafana pour la visualisation
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
depends_on:
- prometheus
# PowerAPI pour la mesure de consommation énergétique
powerapi:
image: powerapi/powerapi:latest
privileged: true
volumes:
- /sys:/sys
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
environment:
- POWERAPI_CPU_EVENTS=cpu-cycles,instructions
- POWERAPI_PUSH_FREQUENCY=1000
- POWERAPI_PUSH_URL=http://prometheus:9091/metrics/job/powerapi
depends_on:
- prometheus
# Node exporter pour les métriques système
node-exporter:
image: prom/node-exporter:latest
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
ports:
- "9100:9100"
volumes:
prometheus_data:
grafana_data: