Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/thierno953/terraform_a_v
- Owner: thierno953
- Created: 2024-05-05T15:36:16.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-28T08:11:25.000Z (6 months ago)
- Last Synced: 2024-05-28T20:03:25.415Z (6 months ago)
- Topics: ecr-repositories, eks, grafana, jenkins, prometheus, rds, sonarqube, sonarqube-scanner, tf
- Language: HCL
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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}"
}
}
}
```