diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..a1558a88
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,26 @@
+name: TestApplication
+on: workflow_dispatch
+env:
+ AWS_REGION: us-east-1
+ ECR_REPOSITORY: testapplication
+ EKS_CLUSTER: testapp-eks
+
+jobs:
+ BUILD_AND_PUBLISH:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Code checkout
+ uses: actions/checkout@v4
+
+ - name: Build & Upload image to ECR
+ uses: appleboy/docker-ecr-action@master
+ with:
+ access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
+ secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ registry: ${{ secrets.REGISTRY }}
+ repo: ${{ env.ECR_REPOSITORY }}
+ region: ${{ env.AWS_REGION }}
+ tags: latest,${{ github.run_number }}
+ daemon_off: false
+ dockerfile: ./Dockerfile
+ context: ./
diff --git a/Dockerfile b/Dockerfile
index 267c0571..7a3250e0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,13 @@
FROM openjdk:11 AS BUILD_IMAGE
RUN apt update && apt install maven -y
-COPY ./ vprofile-project
-RUN cd vprofile-project && mvn install
+COPY ./ testapp-project
+RUN cd testapp-project && mvn install
FROM tomcat:9-jre11
-LABEL "Project"="Vprofile"
-LABEL "Author"="Imran"
+LABEL "Project"="Testapp"
+LABEL "Author"="George"
RUN rm -rf /usr/local/tomcat/webapps/*
-COPY --from=BUILD_IMAGE vprofile-project/target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT.war
+COPY --from=BUILD_IMAGE testapp-project/target/testapp-v2.war /usr/local/tomcat/webapps/ROOT.war
EXPOSE 8080
CMD ["catalina.sh", "run"]
diff --git a/Jenkinsfile b/Jenkinsfile
index 7fecd3c2..c1e27839 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -11,8 +11,8 @@ pipeline {
NEXUS_VERSION = "nexus3"
NEXUS_PROTOCOL = "http"
NEXUS_URL = "172.31.40.209:8081"
- NEXUS_REPOSITORY = "vprofile-release"
- NEXUS_REPO_ID = "vprofile-release"
+ NEXUS_REPOSITORY = "testapp-release"
+ NEXUS_REPO_ID = "testapp-release"
NEXUS_CREDENTIAL_ID = "nexuslogin"
ARTVERSION = "${env.BUILD_ID}"
}
@@ -62,8 +62,8 @@ pipeline {
steps {
withSonarQubeEnv('sonar-pro') {
- sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \
- -Dsonar.projectName=vprofile-repo \
+ sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=testapp \
+ -Dsonar.projectName=testapp-repo \
-Dsonar.projectVersion=1.0 \
-Dsonar.sources=src/ \
-Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \
diff --git a/ansible/site.yml b/ansible/site.yml
index 89616a1e..3dfdd498 100644
--- a/ansible/site.yml
+++ b/ansible/site.yml
@@ -1,5 +1,5 @@
---
- import_playbook: tomcat_setup.yml
-- import_playbook: vpro-app-setup.yml
+- import_playbook: testapp-app-setup.yml
###
diff --git a/ansible/templates/application.j2 b/ansible/templates/application.j2
index d930446b..789019d3 100644
--- a/ansible/templates/application.j2
+++ b/ansible/templates/application.j2
@@ -21,5 +21,5 @@ rabbitmq.password=test
#Elasticesearch Configuration
elasticsearch.host =192.168.1.85
elasticsearch.port =9300
-elasticsearch.cluster=vprofile
-elasticsearch.node=vprofilenode
+elasticsearch.cluster=testapp
+elasticsearch.node=testappnode
diff --git a/ansible/vpro-app-setup.yml b/ansible/vpro-app-setup.yml
index 0c3f5d4a..07328cc3 100644
--- a/ansible/vpro-app-setup.yml
+++ b/ansible/vpro-app-setup.yml
@@ -5,10 +5,10 @@
vars:
timestamp: "{{ansible_date_time.date}}_{{ansible_date_time.hour}}_{{ansible_date_time.minute}}"
tasks:
- - name: Download latest VProfile.war from nexus
+ - name: Download latest testapp.war from nexus
get_url:
- url: "http://{{USER}}:{{PASS}}@{{nexusip}}:8081/repository/{{reponame}}/{{groupid}}/{{time}}/{{build}}/{{vprofile_version}}"
- dest: "/tmp/vproapp-{{vprofile_version}}"
+ url: "http://{{USER}}:{{PASS}}@{{nexusip}}:8081/repository/{{reponame}}/{{groupid}}/{{time}}/{{build}}/{{testapp_version}}"
+ dest: "/tmp/testappapp-{{testapp_version}}"
register: wardeploy
tags:
- deploy
@@ -55,9 +55,9 @@
- name: Try deploy artifact else restore from previos old_ROOT
block:
- - name: Deploy vprofile artifact
+ - name: Deploy testapp artifact
copy:
- src: "/tmp/vproapp-{{vprofile_version}}"
+ src: "/tmp/testappapp-{{testapp_version}}"
dest: /usr/local/tomcat8/webapps/ROOT.war
remote_src: yes
register: deploy_info
diff --git a/kubernetes/vpro-app/db-CIP.yml b/kubernetes/vpro-app/db-CIP.yml
index 2ecb8da7..8463375a 100644
--- a/kubernetes/vpro-app/db-CIP.yml
+++ b/kubernetes/vpro-app/db-CIP.yml
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
- name: vprodb
+ name: testappdb
spec:
ports:
- port: 3306
- targetPort: vprodb-port
+ targetPort: testappdb-port
protocol: TCP
selector:
- app: vprodb
+ app: testappdb
type: ClusterIP
diff --git a/kubernetes/vpro-app/mc-CIP.yml b/kubernetes/vpro-app/mc-CIP.yml
index ab74ddb7..bcb6724b 100644
--- a/kubernetes/vpro-app/mc-CIP.yml
+++ b/kubernetes/vpro-app/mc-CIP.yml
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
- name: vprocache01
+ name: testappcache01
spec:
ports:
- port: 11211
- targetPort: vpromc-port
+ targetPort: testappmc-port
protocol: TCP
selector:
- app: vpromc
+ app: testappmc
type: ClusterIP
diff --git a/kubernetes/vpro-app/mcdep.yml b/kubernetes/vpro-app/mcdep.yml
index d7e1804e..dc2f1793 100644
--- a/kubernetes/vpro-app/mcdep.yml
+++ b/kubernetes/vpro-app/mcdep.yml
@@ -1,22 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: vpromc
+ name: testappmc
labels:
- app: vpromc
+ app: testappmc
spec:
selector:
matchLabels:
- app: vpromc
+ app: testappmc
replicas: 1
template:
metadata:
labels:
- app: vpromc
+ app: testappmc
spec:
containers:
- - name: vpromc
+ - name: testappmc
image: memcached
ports:
- - name: vpromc-port
+ - name: testappmc-port
containerPort: 11211
diff --git a/kubernetes/vpro-app/rmq-CIP-service.yml b/kubernetes/vpro-app/rmq-CIP-service.yml
index 129c6243..ad30faba 100644
--- a/kubernetes/vpro-app/rmq-CIP-service.yml
+++ b/kubernetes/vpro-app/rmq-CIP-service.yml
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
- name: vpromq01
+ name: testappmq01
spec:
ports:
- port: 5672
- targetPort: vpromq01-port
+ targetPort: testappmq01-port
protocol: TCP
selector:
- app: vpromq01
+ app: testappmq01
type: ClusterIP
diff --git a/kubernetes/vpro-app/rmq-dep.yml b/kubernetes/vpro-app/rmq-dep.yml
index b8c6ea4a..7c70567b 100644
--- a/kubernetes/vpro-app/rmq-dep.yml
+++ b/kubernetes/vpro-app/rmq-dep.yml
@@ -1,24 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: vpromq01
+ name: testappmq01
labels:
- app: vpromq01
+ app: testappmq01
spec:
selector:
matchLabels:
- app: vpromq01
+ app: testappmq01
replicas: 1
template:
metadata:
labels:
- app: vpromq01
+ app: testappmq01
spec:
containers:
- - name: vpromq01
+ - name: testappmq01
image: rabbitmq
ports:
- - name: vpromq01-port
+ - name: testappmq01-port
containerPort: 15672
env:
- name: RABBITMQ_DEFAULT_PASS
diff --git a/kubernetes/vpro-app/vproapp-service.yml b/kubernetes/vpro-app/testapp-service.yml
similarity index 90%
rename from kubernetes/vpro-app/vproapp-service.yml
rename to kubernetes/vpro-app/testapp-service.yml
index 3c5510cc..89920bb4 100644
--- a/kubernetes/vpro-app/vproapp-service.yml
+++ b/kubernetes/vpro-app/testapp-service.yml
@@ -8,5 +8,5 @@ spec:
protocol: TCP
targetPort: 8080
selector:
- app: vproapp
+ app: testapp
type: ClusterIP
diff --git a/kubernetes/vpro-app/vprodbdep.yml b/kubernetes/vpro-app/testappdbdep.yml
similarity index 67%
rename from kubernetes/vpro-app/vprodbdep.yml
rename to kubernetes/vpro-app/testappdbdep.yml
index a11b9e9c..205e7521 100644
--- a/kubernetes/vpro-app/vprodbdep.yml
+++ b/kubernetes/vpro-app/testappdbdep.yml
@@ -1,24 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: vprodb
+ name: testappdb
labels:
- app: vprodb
+ app: testappdb
spec:
selector:
matchLabels:
- app: vprodb
+ app: testappdb
replicas: 1
template:
metadata:
labels:
- app: vprodb
+ app: testappdb
spec:
containers:
- - name: vprodb
- image: vprofile/vprofiledb
+ - name: testappdb
+ image: testapp/testappdb
ports:
- - name: vprodb-port
+ - name: testappdb-port
containerPort: 3306
env:
- name: MYSQL_ROOT_PASSWORD
@@ -28,5 +28,5 @@ spec:
key: db-pass
# env:
# - name: MYSQL_ROOT_PASSWORD
-# value: "vprodbpass"
+# value: "testappdbpass"
diff --git a/kubernetes/vpro-app/testappdep.yml b/kubernetes/vpro-app/testappdep.yml
new file mode 100644
index 00000000..624b2315
--- /dev/null
+++ b/kubernetes/vpro-app/testappdep.yml
@@ -0,0 +1,29 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: testapp
+ labels:
+ app: testapp
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: testapp
+ template:
+ metadata:
+ labels:
+ app: testapp
+ spec:
+ containers:
+ - name: testapp
+ image: testapp-project/testapp
+ ports:
+ - name: testapp-port
+ containerPort: 8080
+ initContainers:
+ - name: init-mydb
+ image: busybox
+ command: ['sh', '-c', 'until nslookup testappdb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done;']
+ - name: init-memcache
+ image: busybox
+ command: ['sh', '-c', 'until nslookup testappcache01.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done;']
diff --git a/kubernetes/vpro-app/vproingress.yaml b/kubernetes/vpro-app/testappingress.yaml
similarity index 86%
rename from kubernetes/vpro-app/vproingress.yaml
rename to kubernetes/vpro-app/testappingress.yaml
index 9c6a1cd2..47822b4d 100644
--- a/kubernetes/vpro-app/vproingress.yaml
+++ b/kubernetes/vpro-app/testappingress.yaml
@@ -1,13 +1,13 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
- name: vpro-ingress
+ name: testapp-ingress
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
ingressClassName: nginx
rules:
- - host: vprofile.thehkh.com
+ - host: testapp.thehkh.com
http:
paths:
- path: /
diff --git a/kubernetes/vpro-app/vproappdep.yml b/kubernetes/vpro-app/vproappdep.yml
index 79a6b515..cc0ff01c 100644
--- a/kubernetes/vpro-app/vproappdep.yml
+++ b/kubernetes/vpro-app/vproappdep.yml
@@ -1,29 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
- name: vproapp
+ name: testapp
labels:
- app: vproapp
+ app: testapp
spec:
replicas: 1
selector:
matchLabels:
- app: vproapp
+ app: testapp
template:
metadata:
labels:
- app: vproapp
+ app: testapp
spec:
containers:
- - name: vproapp
- image: vprofile/vprofileapp
+ - name: testapp
+ image: testapp/testapp
ports:
- - name: vproapp-port
+ - name: testapp-port
containerPort: 8080
initContainers:
- name: init-mydb
image: busybox
- command: ['sh', '-c', 'until nslookup vprodb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done;']
+ command: ['sh', '-c', 'until nslookup testappdb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done;']
- name: init-memcache
image: busybox
- command: ['sh', '-c', 'until nslookup vprocache01.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done;']
+ command: ['sh', '-c', 'until nslookup testappcache01.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done;']
diff --git a/pom.xml b/pom.xml
index df25e831..64748fdd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.visualpathit
- vprofile
+ testapp
war
v2
Visualpathit VProfile Webapp
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index ae31700d..cdf969a9 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,25 +1,25 @@
#JDBC Configutation for Database Connection
jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://vprodb:3306/accounts?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
+jdbc.url=jdbc:mysql://testappdb:3306/accounts?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
jdbc.username=root
-jdbc.password=vprodbpass
+jdbc.password=testappdbpass
#Memcached Configuration For Active and StandBy Host
#For Active Host
-memcached.active.host=vprocache01
+memcached.active.host=testapcache01
memcached.active.port=11211
#For StandBy Host
-memcached.standBy.host=vprocache02
+memcached.standBy.host=testappcache02
memcached.standBy.port=11211
#RabbitMq Configuration
-rabbitmq.address=vpromq01
+rabbitmq.address=testappmq01
rabbitmq.port=15672
rabbitmq.username=guest
rabbitmq.password=guest
#Elasticesearch Configuration
-elasticsearch.host =vprosearch01
+elasticsearch.host =testappsearch01
elasticsearch.port =9300
-elasticsearch.cluster=vprofile
-elasticsearch.node=vprofilenode
\ No newline at end of file
+elasticsearch.cluster=testapp
+elasticsearch.node=testappnode
\ No newline at end of file