Skip to content
Open

Stage #150

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
45d654e
Merge pull request #1 from hkhcoder/stage
hkhcoder Nov 13, 2023
b96e209
bucket name and cluster name uodated
salimnextdev Dec 29, 2025
f4df741
staging workflows
salimnextdev Dec 29, 2025
ffa4f37
workflows uploaded
salimnextdev Dec 29, 2025
b1c6e71
github actions trigger
salimnextdev Dec 29, 2025
3430782
trigger
salimnextdev Dec 29, 2025
f6f5ffc
trigger actions
salimnextdev Dec 29, 2025
511a005
terraform.yml
salimnextdev Dec 30, 2025
3bf8381
terraform plan
salimnextdev Dec 30, 2025
e3ff513
Trigger GitHub Actions workflow
salimnextdev Dec 30, 2025
1b18815
terraform apply steps
salimnextdev Dec 30, 2025
f9afe54
stage test
salimnextdev Dec 30, 2025
8cbfe58
Merge branch 'stage'
salimnextdev Dec 30, 2025
5e56e26
hyphen corrected
salimnextdev Dec 30, 2025
3982f4d
Merge branch 'stage'
salimnextdev Dec 30, 2025
35f5c4a
eks version upgraded to 1.28
salimnextdev Dec 30, 2025
e596aa3
terraform ga
salimnextdev Dec 30, 2025
89582e6
apply stage changes
salimnextdev Dec 30, 2025
ef74283
commit test
salimnextdev Dec 30, 2025
a0e4fe3
Merge branch 'main' into stage
salimnextdev Dec 30, 2025
0b842c3
still testing
salimnextdev Dec 30, 2025
10cd48c
Merge branch 'stage' of github.com:salimnextdev/iac-vprofile into stage
salimnextdev Dec 30, 2025
569219f
variables.tf edited
salimnextdev Dec 30, 2025
55463b9
destroy infra
salimnextdev Dec 30, 2025
9e769b6
terraform update
salimnextdev Dec 30, 2025
18c77a5
apply stage
salimnextdev Dec 30, 2025
dc578c6
terraform init
salimnextdev Dec 30, 2025
182c26e
terraform apply again
salimnextdev Dec 30, 2025
6c97989
new Dockerfile
salimnextdev Dec 30, 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
Binary file added .DS_Store
Binary file not shown.
91 changes: 91 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "Vprofile IAC"

on:
push:
branches:
- main
- stage
paths:
- 'terraform/**'
pull_request:
branches:
- main
paths:
- 'terraform/**'

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUCKET_TF_STATE: ${{ secrets.BUCKET_TF_STATE }}
AWS_REGION: us-east-1
EKS_CLUSTER: vprofile-eks
TF_IN_AUTOMATION: true
TF_INPUT: false

jobs:
terraform:
name: "Terraform Apply"
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
shell: bash
working-directory: ./terraform

steps:
- name: "Checkout Repository"
uses: actions/checkout@v4

- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.6.3"
terraform_wrapper: false

- name: "Configure AWS Credentials"
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: "Terraform Init"
id: init
run: |
terraform init \
-backend-config="bucket=${{ env.BUCKET_TF_STATE }}" \
-backend-config="key=terraform.tfstate" \
-backend-config="region=${{ env.AWS_REGION }}" \
-input=false

- name: "Terraform Format Check"
id: fmt
run: terraform fmt -check -recursive

- name: "Terraform Validate"
id: validate
run: terraform validate

- name: "Terraform Plan"
id: plan
run: |
terraform plan \
-no-color \
-input=false \
-out=planfile \
-parallelism=10

- name: "Terraform Apply"
id: apple
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
terraform apply -auto-approve -no-color -input=false -parallelism=1 planfile

- name: "Get Kube Config file"
id: getconfig
if: steps.apple.conclusion == 'success'
run: aws eks update-kubeconfig --name ${{ env.EKS_CLUSTER }} --region ${{ env.AWS_REGION }}

- name: Install Ingress Controller
if: steps.apple.outcome == 'success' && steps.getconfig.outcome == 'success'
run: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/aws/deploy.yaml
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build stage
FROM eclipse-temurin:11-jdk-alpine AS build

WORKDIR /app

# Copy source code
COPY . .

# Build application
RUN ./mvnw clean package -DskipTests

# Runtime stage
FROM tomcat:9.0-jdk17-temurin-alpine

LABEL maintainer="vprofile"

# Remove default webapps
RUN rm -rf /usr/local/tomcat/webapps/*

# Copy WAR from build stage
COPY --from=build /app/target/*.war /usr/local/tomcat/webapps/ROOT.war

# Set environment variables
ENV CATALINA_OPTS="-Xms512m -Xmx1024m"
ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"

# Expose port
EXPOSE 8080

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/ || exit 1

# Start Tomcat
CMD ["catalina.sh", "run"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Terraform version 1.6.3
* terraform apply -auto-approve -input=false -parallelism=1 planfile
####
#####
######
2 changes: 2 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Trigger workflow
##
2 changes: 1 addition & 1 deletion terraform/eks-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module "eks" {
version = "19.19.1"

cluster_name = local.cluster_name
cluster_version = "1.27"
cluster_version = "1.28"

vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
Expand Down
6 changes: 3 additions & 3 deletions terraform/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ terraform {
}

backend "s3" {
bucket = "gitopsterrastate"
bucket = "vprofileactions2973"
key = "terraform.tfstate"
region = "us-east-2"
region = "us-east-1"
}

required_version = "~> 1.6.3"
}
##
##
###
##
5 changes: 3 additions & 2 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
variable "region" {
description = "AWS region"
type = string
default = "us-east-2"
default = "us-east-1"
}

variable "clusterName" {
description = "Name of the EKS cluster"
type = string
default = "kitops-eks"
default = "vprofile-eks"
}
##