diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..918c5d3bd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,116 @@ +name: vprofile actions +on: workflow_dispatch +env: + AWS_REGION: us-east-1 + ECR_REPOSITORY: vprofileapp + EKS_CLUSTER: vprofile-eks + +jobs: + Testing: + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + with: + repository: frost4190/vprofile-action + + # Setup java 11 to be default (sonar-scanner requirement as of 5.x) + - name: Set Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '11' + + - name: Maven test + run: mvn test + + - name: Checkstyle + run: mvn checkstyle:checkstyle + + # Setup sonar-scanner + - name: Setup SonarQube + uses: warchant/setup-sonar-scanner@v7 + + + # Run sonar-scanner + - name: SonarQube Scan + run: sonar-scanner + -Dsonar.host.url=${{ secrets.SONAR_URL }} + -Dsonar.login=${{ secrets.SONAR_TOKEN }} + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} + -Dsonar.sources=src/ + -Dsonar.junit.reportsPath=target/surefire-reports/ + -Dsonar.jacoco.reportsPath=target/jacoco.exec + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ + + # Check the Quality Gate status. + - name: SonarQube Quality Gate check + id: sonarqube-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + # Force to fail step after specific time. + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #OPTIONAL + + BUILD_AND_PUBLISH: + needs: Testing + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + with: + repository: frost4190/vprofile-action + + - 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: ./ + + DeployToEKS: + needs: BUILD_AND_PUBLISH + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + with: + repository: frost4190/vprofile-action + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + 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: Get Kube config file + run: aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ env.EKS_CLUSTER }} + + - name: Print config file + run: cat ~/.kube/config + + - name: Login to ECR + run: kubectl create secret docker-registry regcred --docker-server=${{ secrets.REGISTRY }} --docker-username=AWS --docker-password=$(aws ecr get-login-password) + + - name: Deploy Helm + uses: bitovi/github-actions-deploy-eks-helm@v1.2.8 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + cluster-name: ${{ env.EKS_CLUSTER }} + #config-files: .github/values/dev.yaml + chart-path: helm/vprofilecharts + namespace: default + values: appimage=${{ secrets.REGISTRY }}/${{ env.ECR_REPOSITORY }},apptag=${{ github.run_number }} + name: vprofile-stack diff --git "a/.github\\workflows/main.yml" "b/.github\\workflows/main.yml" new file mode 100644 index 000000000..54ccbdda7 --- /dev/null +++ "b/.github\\workflows/main.yml" @@ -0,0 +1,74 @@ +name: vprofile actions +on: workflow_dispatch +env: + AWS_REGION: us-east-1 + ECR_REPOSITORY: vprofileapp + EKS_CLUSTER: vprofile-eks + +jobs: + Testing: + runs-on: ubuntu-latest + steps: + - name: Code checkout + uses: actions/checkout@v4 + + - name: Maven test + run: mvn test + + - name: Checkstyle + run: mvn checkstyle:checkstyle + + # Setup java 11 to be default (sonar-scanner requirement as of 5.x) + - name: Set Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '11' + + # Setup sonar-scanner + - name: Setup SonarQube + uses: warchant/setup-sonar-scanner@v7 + + + # Run sonar-scanner + - name: SonarQube Scan + run: sonar-scanner + -Dsonar.host.url=${{ secrets.SONAR_URL }} + -Dsonar.login=${{ secrets.SONAR_TOKEN }} + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} + -Dsonar.sources=src/ + -Dsonar.junit.reportsPath=target/surefire-reports/ + -Dsonar.jacoco.reportsPath=target/jacoco.exec + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ + + # Check the Quality Gate status. + - name: SonarQube Quality Gate check + id: sonarqube-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + # Force to fail step after specific time. + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_URL }} #OPTIONAL + + BUILD_AND_PUBLISH: + needs: Testing + 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 267c05711..95ce3c835 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM openjdk:11 AS BUILD_IMAGE +FROM eclipse-temurin:11-jdk AS BUILD_IMAGE RUN apt update && apt install maven -y COPY ./ vprofile-project RUN cd vprofile-project && mvn install -FROM tomcat:9-jre11 +FROM tomcat:9.0-jdk11 LABEL "Project"="Vprofile" LABEL "Author"="Imran" RUN rm -rf /usr/local/tomcat/webapps/* diff --git a/helm/vprofilecharts/.helmignore b/helm/vprofilecharts/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/vprofilecharts/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/vprofilecharts/Chart.yaml b/helm/vprofilecharts/Chart.yaml new file mode 100644 index 000000000..582281f71 --- /dev/null +++ b/helm/vprofilecharts/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: vprofilecharts +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/helm/vprofilecharts/templates/app-secret.yml b/helm/vprofilecharts/templates/app-secret.yml new file mode 100644 index 000000000..17771a782 --- /dev/null +++ b/helm/vprofilecharts/templates/app-secret.yml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: app-secret +type: Opaque +data: + db-pass: dnByb2RicGFzcw== + rmq-pass: Z3Vlc3Q= diff --git a/helm/vprofilecharts/templates/db-CIP.yml b/helm/vprofilecharts/templates/db-CIP.yml new file mode 100644 index 000000000..2ecb8da72 --- /dev/null +++ b/helm/vprofilecharts/templates/db-CIP.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: vprodb +spec: + ports: + - port: 3306 + targetPort: vprodb-port + protocol: TCP + selector: + app: vprodb + type: ClusterIP diff --git a/helm/vprofilecharts/templates/mc-CIP.yml b/helm/vprofilecharts/templates/mc-CIP.yml new file mode 100644 index 000000000..ab74ddb75 --- /dev/null +++ b/helm/vprofilecharts/templates/mc-CIP.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: vprocache01 +spec: + ports: + - port: 11211 + targetPort: vpromc-port + protocol: TCP + selector: + app: vpromc + type: ClusterIP diff --git a/helm/vprofilecharts/templates/mcdep.yml b/helm/vprofilecharts/templates/mcdep.yml new file mode 100644 index 000000000..d7e1804eb --- /dev/null +++ b/helm/vprofilecharts/templates/mcdep.yml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vpromc + labels: + app: vpromc +spec: + selector: + matchLabels: + app: vpromc + replicas: 1 + template: + metadata: + labels: + app: vpromc + spec: + containers: + - name: vpromc + image: memcached + ports: + - name: vpromc-port + containerPort: 11211 diff --git a/helm/vprofilecharts/templates/rmq-CIP-service.yml b/helm/vprofilecharts/templates/rmq-CIP-service.yml new file mode 100644 index 000000000..129c62435 --- /dev/null +++ b/helm/vprofilecharts/templates/rmq-CIP-service.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: vpromq01 +spec: + ports: + - port: 5672 + targetPort: vpromq01-port + protocol: TCP + selector: + app: vpromq01 + type: ClusterIP diff --git a/helm/vprofilecharts/templates/rmq-dep.yml b/helm/vprofilecharts/templates/rmq-dep.yml new file mode 100644 index 000000000..b8c6ea4ad --- /dev/null +++ b/helm/vprofilecharts/templates/rmq-dep.yml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vpromq01 + labels: + app: vpromq01 +spec: + selector: + matchLabels: + app: vpromq01 + replicas: 1 + template: + metadata: + labels: + app: vpromq01 + spec: + containers: + - name: vpromq01 + image: rabbitmq + ports: + - name: vpromq01-port + containerPort: 15672 + env: + - name: RABBITMQ_DEFAULT_PASS + valueFrom: + secretKeyRef: + name: app-secret + key: rmq-pass + - name: RABBITMQ_DEFAULT_USER + value: "guest" + diff --git a/helm/vprofilecharts/templates/vproapp-service.yml b/helm/vprofilecharts/templates/vproapp-service.yml new file mode 100644 index 000000000..3c5510cc9 --- /dev/null +++ b/helm/vprofilecharts/templates/vproapp-service.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: my-app +spec: + ports: + - port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: vproapp + type: ClusterIP diff --git a/helm/vprofilecharts/templates/vproappdep.yml b/helm/vprofilecharts/templates/vproappdep.yml new file mode 100644 index 000000000..58672c5d8 --- /dev/null +++ b/helm/vprofilecharts/templates/vproappdep.yml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vproapp + labels: + app: vproapp +spec: + replicas: 1 + selector: + matchLabels: + app: vproapp + template: + metadata: + labels: + app: vproapp + spec: + containers: + - name: vproapp + image: {{ .Values.appimage }}:{{ .Values.apptag }} + ports: + - name: vproapp-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;'] + - 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;'] diff --git a/helm/vprofilecharts/templates/vprodbdep.yml b/helm/vprofilecharts/templates/vprodbdep.yml new file mode 100644 index 000000000..a11b9e9c0 --- /dev/null +++ b/helm/vprofilecharts/templates/vprodbdep.yml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vprodb + labels: + app: vprodb +spec: + selector: + matchLabels: + app: vprodb + replicas: 1 + template: + metadata: + labels: + app: vprodb + spec: + containers: + - name: vprodb + image: vprofile/vprofiledb + ports: + - name: vprodb-port + containerPort: 3306 + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: app-secret + key: db-pass +# env: +# - name: MYSQL_ROOT_PASSWORD +# value: "vprodbpass" + diff --git a/helm/vprofilecharts/templates/vproingress.yaml b/helm/vprofilecharts/templates/vproingress.yaml new file mode 100644 index 000000000..f703ddb05 --- /dev/null +++ b/helm/vprofilecharts/templates/vproingress.yaml @@ -0,0 +1,19 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: vpro-ingress + annotations: + nginx.ingress.kubernetes.io/use-regex: "true" +spec: + ingressClassName: nginx + rules: + - host: vprofile.deninfozyx.ca + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: my-app + port: + number: 8080 diff --git a/helm/vprofilecharts/values.yaml b/helm/vprofilecharts/values.yaml new file mode 100644 index 000000000..8935f15dc --- /dev/null +++ b/helm/vprofilecharts/values.yaml @@ -0,0 +1,161 @@ +# Default values for vprofilecharts. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ +replicaCount: 1 + +# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ +image: + repository: nginx + # This sets the pull policy for images. + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ +imagePullSecrets: [] +# This is to override the chart name. +nameOverride: "" +fullnameOverride: "" + +# This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ +serviceAccount: + # Specifies whether a service account should be created. + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account. + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template. + name: "" + +# This is for setting Kubernetes Annotations to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +podAnnotations: {} +# This is for setting Kubernetes Labels to a Pod. +# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/ +service: + # This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + type: ClusterIP + # This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports + port: 80 + +# This block is for setting up the ingress for more information can be found here: https://kubernetes.io/docs/concepts/services-networking/ingress/ +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +# -- Expose the service via gateway-api HTTPRoute +# Requires Gateway API resources and suitable controller installed within the cluster +# (see: https://gateway-api.sigs.k8s.io/guides/) +httpRoute: + # HTTPRoute enabled. + enabled: false + # HTTPRoute annotations. + annotations: {} + # Which Gateways this Route is attached to. + parentRefs: + - name: gateway + sectionName: http + # namespace: default + # Hostnames matching HTTP header. + hostnames: + - chart-example.local + # List of rules and filters applied. + rules: + - matches: + - path: + type: PathPrefix + value: /headers + # filters: + # - type: RequestHeaderModifier + # requestHeaderModifier: + # set: + # - name: My-Overwrite-Header + # value: this-is-the-only-value + # remove: + # - User-Agent + # - matches: + # - path: + # type: PathPrefix + # value: /echo + # headers: + # - name: version + # value: v2 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/ +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] + # - name: foo + # secret: + # secretName: mysecret + # optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] + # - name: foo + # mountPath: "/etc/foo" + # readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/kubernetes/vpro-app/vproingress.yaml b/kubernetes/vpro-app/vproingress.yaml index 9c6a1cd22..f703ddb05 100644 --- a/kubernetes/vpro-app/vproingress.yaml +++ b/kubernetes/vpro-app/vproingress.yaml @@ -7,7 +7,7 @@ metadata: spec: ingressClassName: nginx rules: - - host: vprofile.thehkh.com + - host: vprofile.deninfozyx.ca http: paths: - path: / diff --git a/target/classes/accountsdb.sql b/target/classes/accountsdb.sql new file mode 100644 index 000000000..d224d810f --- /dev/null +++ b/target/classes/accountsdb.sql @@ -0,0 +1,104 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64) +-- +-- Host: localhost Database: accounts +-- ------------------------------------------------------ +-- Server version 5.7.18-0ubuntu0.16.10.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `role` +-- + +DROP TABLE IF EXISTS `role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `role` +-- + +LOCK TABLES `role` WRITE; +/*!40000 ALTER TABLE `role` DISABLE KEYS */; +INSERT INTO `role` VALUES (1,'ROLE_USER'); +/*!40000 ALTER TABLE `role` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) DEFAULT NULL, + `userEmail` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; +INSERT INTO `user` VALUES (4,'admin_vp','admin@visualpathit.com','$2a$11$DSEIKJNrgPjG.iCYUwErvOkREtC67mqzQ.ogkZbc/KOW1OPOpZfY6'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_role` +-- + +DROP TABLE IF EXISTS `user_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_role` ( + `user_id` int(11) NOT NULL, + `role_id` int(11) NOT NULL, + PRIMARY KEY (`user_id`,`role_id`), + KEY `fk_user_role_roleid_idx` (`role_id`), + CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_role` +-- + +LOCK TABLES `user_role` WRITE; +/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; +INSERT INTO `user_role` VALUES (4,1); +/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2017-08-28 10:50:51 diff --git a/target/classes/application.properties b/target/classes/application.properties new file mode 100644 index 000000000..ae31700df --- /dev/null +++ b/target/classes/application.properties @@ -0,0 +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.username=root +jdbc.password=vprodbpass + +#Memcached Configuration For Active and StandBy Host +#For Active Host +memcached.active.host=vprocache01 +memcached.active.port=11211 +#For StandBy Host +memcached.standBy.host=vprocache02 +memcached.standBy.port=11211 + +#RabbitMq Configuration +rabbitmq.address=vpromq01 +rabbitmq.port=15672 +rabbitmq.username=guest +rabbitmq.password=guest + +#Elasticesearch Configuration +elasticsearch.host =vprosearch01 +elasticsearch.port =9300 +elasticsearch.cluster=vprofile +elasticsearch.node=vprofilenode \ No newline at end of file diff --git a/target/classes/com/visualpathit/account/beans/Components.class b/target/classes/com/visualpathit/account/beans/Components.class new file mode 100644 index 000000000..5e3095d47 Binary files /dev/null and b/target/classes/com/visualpathit/account/beans/Components.class differ diff --git a/target/classes/com/visualpathit/account/controller/ElasticSearchController.class b/target/classes/com/visualpathit/account/controller/ElasticSearchController.class new file mode 100644 index 000000000..746f049a9 Binary files /dev/null and b/target/classes/com/visualpathit/account/controller/ElasticSearchController.class differ diff --git a/target/classes/com/visualpathit/account/controller/FileUploadController.class b/target/classes/com/visualpathit/account/controller/FileUploadController.class new file mode 100644 index 000000000..b5eb23f81 Binary files /dev/null and b/target/classes/com/visualpathit/account/controller/FileUploadController.class differ diff --git a/target/classes/com/visualpathit/account/controller/UserController.class b/target/classes/com/visualpathit/account/controller/UserController.class new file mode 100644 index 000000000..89fecc438 Binary files /dev/null and b/target/classes/com/visualpathit/account/controller/UserController.class differ diff --git a/target/classes/com/visualpathit/account/model/Role.class b/target/classes/com/visualpathit/account/model/Role.class new file mode 100644 index 000000000..929351b9c Binary files /dev/null and b/target/classes/com/visualpathit/account/model/Role.class differ diff --git a/target/classes/com/visualpathit/account/model/User.class b/target/classes/com/visualpathit/account/model/User.class new file mode 100644 index 000000000..0e90c2414 Binary files /dev/null and b/target/classes/com/visualpathit/account/model/User.class differ diff --git a/target/classes/com/visualpathit/account/repository/RoleRepository.class b/target/classes/com/visualpathit/account/repository/RoleRepository.class new file mode 100644 index 000000000..ea5943ffc Binary files /dev/null and b/target/classes/com/visualpathit/account/repository/RoleRepository.class differ diff --git a/target/classes/com/visualpathit/account/repository/UserRepository.class b/target/classes/com/visualpathit/account/repository/UserRepository.class new file mode 100644 index 000000000..e6e9ace0f Binary files /dev/null and b/target/classes/com/visualpathit/account/repository/UserRepository.class differ diff --git a/target/classes/com/visualpathit/account/service/ConsumerService.class b/target/classes/com/visualpathit/account/service/ConsumerService.class new file mode 100644 index 000000000..2efb215f0 Binary files /dev/null and b/target/classes/com/visualpathit/account/service/ConsumerService.class differ diff --git a/target/classes/com/visualpathit/account/service/ConsumerServiceImpl.class b/target/classes/com/visualpathit/account/service/ConsumerServiceImpl.class new file mode 100644 index 000000000..c10ffa849 Binary files /dev/null and b/target/classes/com/visualpathit/account/service/ConsumerServiceImpl.class differ diff --git a/target/classes/com/visualpathit/account/service/ProducerService.class b/target/classes/com/visualpathit/account/service/ProducerService.class new file mode 100644 index 000000000..36065ad5f Binary files /dev/null and b/target/classes/com/visualpathit/account/service/ProducerService.class differ diff --git a/target/classes/com/visualpathit/account/service/ProducerServiceImpl.class b/target/classes/com/visualpathit/account/service/ProducerServiceImpl.class new file mode 100644 index 000000000..cfe2c6f06 Binary files /dev/null and b/target/classes/com/visualpathit/account/service/ProducerServiceImpl.class differ diff --git a/target/classes/com/visualpathit/account/service/SecurityService.class b/target/classes/com/visualpathit/account/service/SecurityService.class new file mode 100644 index 000000000..3dd66bfdb Binary files /dev/null and b/target/classes/com/visualpathit/account/service/SecurityService.class differ diff --git a/target/classes/com/visualpathit/account/service/SecurityServiceImpl.class b/target/classes/com/visualpathit/account/service/SecurityServiceImpl.class new file mode 100644 index 000000000..5f6244126 Binary files /dev/null and b/target/classes/com/visualpathit/account/service/SecurityServiceImpl.class differ diff --git a/target/classes/com/visualpathit/account/service/UserDetailsServiceImpl.class b/target/classes/com/visualpathit/account/service/UserDetailsServiceImpl.class new file mode 100644 index 000000000..2b6dbe5b0 Binary files /dev/null and b/target/classes/com/visualpathit/account/service/UserDetailsServiceImpl.class differ diff --git a/target/classes/com/visualpathit/account/service/UserService.class b/target/classes/com/visualpathit/account/service/UserService.class new file mode 100644 index 000000000..35f247faf Binary files /dev/null and b/target/classes/com/visualpathit/account/service/UserService.class differ diff --git a/target/classes/com/visualpathit/account/service/UserServiceImpl.class b/target/classes/com/visualpathit/account/service/UserServiceImpl.class new file mode 100644 index 000000000..68c463792 Binary files /dev/null and b/target/classes/com/visualpathit/account/service/UserServiceImpl.class differ diff --git a/target/classes/com/visualpathit/account/utils/ElasticsearchUtil.class b/target/classes/com/visualpathit/account/utils/ElasticsearchUtil.class new file mode 100644 index 000000000..36805dc9e Binary files /dev/null and b/target/classes/com/visualpathit/account/utils/ElasticsearchUtil.class differ diff --git a/target/classes/com/visualpathit/account/utils/MemcachedUtils.class b/target/classes/com/visualpathit/account/utils/MemcachedUtils.class new file mode 100644 index 000000000..8b7738c25 Binary files /dev/null and b/target/classes/com/visualpathit/account/utils/MemcachedUtils.class differ diff --git a/target/classes/com/visualpathit/account/utils/RabbitMqUtil.class b/target/classes/com/visualpathit/account/utils/RabbitMqUtil.class new file mode 100644 index 000000000..5c144de0d Binary files /dev/null and b/target/classes/com/visualpathit/account/utils/RabbitMqUtil.class differ diff --git a/target/classes/com/visualpathit/account/validator/UserValidator.class b/target/classes/com/visualpathit/account/validator/UserValidator.class new file mode 100644 index 000000000..3bc9554b5 Binary files /dev/null and b/target/classes/com/visualpathit/account/validator/UserValidator.class differ diff --git a/target/classes/db_backup.sql b/target/classes/db_backup.sql new file mode 100644 index 000000000..2f17a4df3 --- /dev/null +++ b/target/classes/db_backup.sql @@ -0,0 +1,133 @@ +-- MySQL dump 10.13 Distrib 5.7.18, for Linux (x86_64) +-- +-- Host: localhost Database: accounts +-- ------------------------------------------------------ +-- Server version 5.7.18-0ubuntu0.16.10.1 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `role` +-- + +DROP TABLE IF EXISTS `role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `role` +-- + +LOCK TABLES `role` WRITE; +/*!40000 ALTER TABLE `role` DISABLE KEYS */; +INSERT INTO `role` VALUES (1,'ROLE_USER'); +/*!40000 ALTER TABLE `role` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user` +-- + +DROP TABLE IF EXISTS `user`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(255) DEFAULT NULL, + `userEmail` varchar(255) DEFAULT NULL, + `profileImg` varchar(255) DEFAULT NULL, + `profileImgPath` varchar(255) DEFAULT NULL, + `dateOfBirth` varchar(255) DEFAULT NULL, + `fatherName` varchar(255) DEFAULT NULL, + `motherName` varchar(255) DEFAULT NULL, + `gender` varchar(255) DEFAULT NULL, + `maritalStatus` varchar(255) DEFAULT NULL, + `permanentAddress` varchar(255) DEFAULT NULL, + `tempAddress` varchar(255) DEFAULT NULL, + `primaryOccupation` varchar(255) DEFAULT NULL, + `secondaryOccupation` varchar(255) DEFAULT NULL, + `skills` varchar(255) DEFAULT NULL, + `phoneNumber` varchar(255) DEFAULT NULL, + `secondaryPhoneNumber` varchar(255) DEFAULT NULL, + `nationality` varchar(255) DEFAULT NULL, + `language` varchar(255) DEFAULT NULL, + `workingExperience` varchar(255) DEFAULT NULL, + `password` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user` +-- + +LOCK TABLES `user` WRITE; +/*!40000 ALTER TABLE `user` DISABLE KEYS */; + +INSERT INTO `user` VALUES (7,'admin_vp','admin@hkhinfo.com',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'$2a$11$0a7VdTr4rfCQqtsvpng6GuJnzUmQ7gZiHXgzGPgm5hkRa3avXgBLK') +,(8,'Abrar Nirban','abrar.nirban74@gmail.com',NULL,NULL,'27/01/2002','A nirban','T nirban','male','unMarried','Dubai,UAE','Dubai,UAE','Software Engineer','Software Engineer','Java HTML CSS ','8888888888','8888888888','Indian','english','2 ','$2a$11$UgG9TkHcgl02LxlqxRHYhOf7Xv4CxFmFEgS0FpUdk42OeslI.6JAW'), +(9,'Amayra Fatima','amayra@gmail.com',NULL,NULL,'20/06/1993','K','L','female','unMarried','Dubai,UAE','Dubai,UAE','Software Engineer','Software Engineer','Java HTML CSS ','9999999999','9999999999','India','english','5','$2a$11$gwvsvUrFU.YirMM1Yb7NweFudLUM91AzH5BDFnhkNzfzpjG.FplYO'), +(10,'Aron','aron.DSilva@gmail.com',NULL,NULL,'27/01/2002','M nirban','R nirban','male','unMarried','Dubai,UAE','Dubai,UAE','Software Engineer','Software Engineer','Java HTML CSS ','7777777777','777777777','India','english','7','$2a$11$6oZEgfGGQAH23EaXLVZ2WOSKxcEJFnBSw2N2aghab0s2kcxSQwjhC'), +(11,'Kiran Kumar','kiran@gmail.com',NULL,NULL,'8/12/1993','K K','RK','male','unMarried','SanFrancisco','James Street','Software Engineer','Software Engineer','Java HTML CSS ','1010101010','1010101010','India','english','10','$2a$11$EXwpna1MlFFlKW5ut1iVi.AoeIulkPPmcOHFO8pOoQt1IYU9COU0m'), +(12,'Balbir Singh','balbir@gmail.com',NULL,NULL,'20/06/1993','balbir RK','balbir AK','male','unMarried','SanFrancisco','US','Software Engineer','Software Engineer','Java HTML CSS AWS','8888888111','8888888111','India','english','8','$2a$11$pzWNzzR.HUkHzz2zhAgqOeCl0WaTgY33NxxJ7n0l.rnEqjB9JO7vy'), +(4,'Hibo Prince','hibo.prince@gmail.com',NULL,NULL,'6/09/2000','Abara','Queen','male','unMarried','Electronic City,UAE','Electronic City,UAE','Tester','Freelancing','Python PHP ','9146389863','9146389871','Indian','hindi','3 ','$2a$11$UgG9TkHcgl02LxlqxRHYhOf7Xv4CxFmFEgS0FpUdk42OeslI.6JAR'), +(5,'Aejaaz Habeeb','aejaaz.habeeb@gmail.com',NULL,NULL,'16/02/2001','Imran','Ziya','male','unMarried','AbuDhabi,UAE','AbuDhabi,UAE','Developer','Developer','Azure Devops ','9566489863','9566489863','Indian','hindi','4 ','$2a$11$UgG9TkHcgl02LxlqxRHYhOf7Xv4CxFmFEgS0FpUdk42OeslI.6JAR'), +(6,'Jackie','jackie.chan@gmail.com',NULL,NULL,'28/09/1992','Charles','Chan','male','Married','HongKong,China','HongKong,China','MartialArtist','MartialArtist','KungFu ','9246488863','9246488863','Chinese','Mandrian','1 ','$2a$11$UgG9TkHcgl02LxlqxRHYhOf7Xv4CxFmFEgS0FpUdk42OeslI.6RAR'), +(13,'Srinath Goud','sgoud@gmail.com',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'$2a$11$6BSmYPrT8I8b9yHmx.uTRu/QxnQM2vhZYQa8mR33aReWA4WFihyGK'); + + +/*!40000 ALTER TABLE `user` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `user_role` +-- + +DROP TABLE IF EXISTS `user_role`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `user_role` ( + `user_id` int(11) NOT NULL, + `role_id` int(11) NOT NULL, + PRIMARY KEY (`user_id`,`role_id`), + KEY `fk_user_role_roleid_idx` (`role_id`), + CONSTRAINT `fk_user_role_roleid` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_user_role_userid` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `user_role` +-- + +LOCK TABLES `user_role` WRITE; +/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; +INSERT INTO `user_role` VALUES (4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1); +/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2023-21-06 05:49:31 diff --git a/target/classes/logback.xml b/target/classes/logback.xml new file mode 100644 index 000000000..35b81df4d --- /dev/null +++ b/target/classes/logback.xml @@ -0,0 +1,24 @@ + + + + + + + %date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line %msg\n + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/classes/validation.properties b/target/classes/validation.properties new file mode 100644 index 000000000..0453cdd3a --- /dev/null +++ b/target/classes/validation.properties @@ -0,0 +1,5 @@ +NotEmpty=This field is required. +Size.userForm.username=Please use between 6 and 32 characters. +Duplicate.userForm.username= User has already taken this Username. +Size.userForm.password=Try one with at least 8 characters. +Diff.userForm.passwordConfirm=These passwords don't match. \ No newline at end of file diff --git a/target/test-classes/com/visualpathit/account/controllerTest/SampleTest.class b/target/test-classes/com/visualpathit/account/controllerTest/SampleTest.class new file mode 100644 index 000000000..00fd98a02 Binary files /dev/null and b/target/test-classes/com/visualpathit/account/controllerTest/SampleTest.class differ diff --git a/target/test-classes/com/visualpathit/account/controllerTest/UserControllerTest.class b/target/test-classes/com/visualpathit/account/controllerTest/UserControllerTest.class new file mode 100644 index 000000000..0fc899186 Binary files /dev/null and b/target/test-classes/com/visualpathit/account/controllerTest/UserControllerTest.class differ diff --git a/target/test-classes/com/visualpathit/account/modelTest/RoleTest.class b/target/test-classes/com/visualpathit/account/modelTest/RoleTest.class new file mode 100644 index 000000000..3851d4ffb Binary files /dev/null and b/target/test-classes/com/visualpathit/account/modelTest/RoleTest.class differ diff --git a/target/test-classes/com/visualpathit/account/modelTest/UserTest.class b/target/test-classes/com/visualpathit/account/modelTest/UserTest.class new file mode 100644 index 000000000..fc0166942 Binary files /dev/null and b/target/test-classes/com/visualpathit/account/modelTest/UserTest.class differ diff --git a/target/test-classes/com/visualpathit/account/setup/StandaloneMvcTestViewResolver.class b/target/test-classes/com/visualpathit/account/setup/StandaloneMvcTestViewResolver.class new file mode 100644 index 000000000..74a522193 Binary files /dev/null and b/target/test-classes/com/visualpathit/account/setup/StandaloneMvcTestViewResolver.class differ