Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Crewmeister CI Pipeline

on:
push:
branches:
- sowmya-crewmeister-challenge

pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:

- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Build Application
run: ./mvnw clean package -DskipTests

- name: Build Docker Image
run: docker build -t crewmeister-app .

- name: Verify Docker Image
run: docker images
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM eclipse-temurin:17-jdk-alpine

WORKDIR /app

COPY target/*.jar app.jar

EXPOSE 8080

ENTRYPOINT ["java","-jar","app.jar"]
48 changes: 48 additions & 0 deletions K8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: Deployment

metadata:
name: crewmeister-app

spec:
replicas: 1

selector:
matchLabels:
app: crewmeister-app

template:
metadata:
labels:
app: crewmeister-app

spec:
containers:
- name: crewmeister-app
image: devops-coding-challenge-app:latest

ports:
- containerPort: 8080

env:
- name: SPRING_DATASOURCE_URL
value: jdbc:mysql://mysql:3306/challenge?createDatabaseIfNotExist=true

- name: SPRING_DATASOURCE_USERNAME
value: root

- name: SPRING_DATASOURCE_PASSWORD
value: dev
livenessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10

readinessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
32 changes: 32 additions & 0 deletions K8s/mysql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment

metadata:
name: mysql

spec:
replicas: 1

selector:
matchLabels:
app: mysql

template:
metadata:
labels:
app: mysql

spec:
containers:
- name: mysql
image: mysql:8

ports:
- containerPort: 3306

env:
- name: MYSQL_ROOT_PASSWORD
value: dev

- name: MYSQL_DATABASE
value: challenge
14 changes: 14 additions & 0 deletions K8s/mysql-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service

metadata:
name: mysql

spec:
selector:
app: mysql

ports:
- protocol: TCP
port: 3306
targetPort: 3306
16 changes: 16 additions & 0 deletions K8s/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service

metadata:
name: crewmeister-service

spec:
selector:
app: crewmeister-app

ports:
- protocol: TCP
port: 80
targetPort: 8080

type: LoadBalancer
24 changes: 24 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'

services:

mysql:
image: mysql:8
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: dev
MYSQL_DATABASE: challenge
ports:
- "3306:3306"

app:
build: .
container_name: crewmeister-app
depends_on:
- mysql
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/challenge?createDatabaseIfNotExist=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: dev
6 changes: 6 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: crewmeister-app
description: Crewmeister DevOps Challenge
type: application
version: 1.0.0
appVersion: "1.0"
48 changes: 48 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: Deployment

metadata:
name: crewmeister-app

spec:
replicas: {{ .Values.replicaCount }}

selector:
matchLabels:
app: crewmeister-app

template:
metadata:
labels:
app: crewmeister-app

spec:
containers:
- name: crewmeister-app
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"

ports:
- containerPort: 8080

env:
- name: SPRING_DATASOURCE_URL
value: jdbc:mysql://mysql:3306/challenge?createDatabaseIfNotExist=true

- name: SPRING_DATASOURCE_USERNAME
value: {{ .Values.mysql.username }}

- name: SPRING_DATASOURCE_PASSWORD
value: {{ .Values.mysql.password }}
livenessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10

readinessProbe:
httpGet:
path: /actuator/health
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
32 changes: 32 additions & 0 deletions helm/templates/mysql-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment

metadata:
name: mysql

spec:
replicas: 1

selector:
matchLabels:
app: mysql

template:
metadata:
labels:
app: mysql

spec:
containers:
- name: mysql
image: mysql:8

ports:
- containerPort: 3306

env:
- name: MYSQL_ROOT_PASSWORD
value: dev

- name: MYSQL_DATABASE
value: challenge
14 changes: 14 additions & 0 deletions helm/templates/mysql-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service

metadata:
name: mysql

spec:
selector:
app: mysql

ports:
- protocol: TCP
port: 3306
targetPort: 3306
16 changes: 16 additions & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service

metadata:
name: crewmeister-service

spec:
selector:
app: crewmeister-app

ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: 8080

type: {{ .Values.service.type }}
15 changes: 15 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
replicaCount: 1

image:
repository: devops-coding-challenge-app
tag: latest

service:
type: LoadBalancer
port: 80

mysql:
host: mysql
database: challenge
username: root
password: dev
Loading