Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thierno953/terraform_a_v


https://github.com/thierno953/terraform_a_v

ecr-repositories eks grafana jenkins prometheus rds sonarqube sonarqube-scanner tf

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# TF - RDS - ECR - EKS - JENKINS - SONARQUBE - MONITORING

**Build-Step 1: Git Checkout**

```sh
stage('Configure') {
steps {
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/thierno953/terraform_a_v']])
}
}
```

**Build-Step 2: Building the Docker Image**

```sh
stage('Building image') {
steps {
sh 'docker build -t terraform_a_v .'
}
}
```

**Build-Step 3: Pushing the Docker Image to Amazon ECR**

```sh
stage('Pushing to ECR') {
steps {
withAWS(credentials: 'AWS-CREDS', region: '') {
sh 'aws ecr get-login-password --region | docker login --username AWS --password-stdin '
sh 'docker tag terraform_a_v:latest /:latest'
sh 'docker push /:latest'
}
}
}
```

**Build-Step 4: Deploying to EKS**

```sh
stage('K8S Deploy') {
steps {
script {
withAWS(credentials: 'AWS-CREDS', region: '') {
sh 'aws eks update-kubeconfig --name --region '
sh 'kubectl apply -f EKS-deployment.yaml'
}
}
}
}
```

**Build-Step 5: Retrieving the Service URL**

```sh
stage('Get Service URL') {
steps {
script {
def serviceUrl = ""
// Wait for the LoadBalancer IP to be assigned
timeout(time: 5, unit: 'MINUTES') {
while(serviceUrl == "") {
serviceUrl = sh(script: "kubectl get svc terraform_a_v-service -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'", returnStdout: true).trim()
if(serviceUrl == "") {
echo "Waiting for the LoadBalancer IP..."
sleep 10
}
}
}
echo "Service URL: http://${serviceUrl}"
}
}
}
```