Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/NashTech-Labs/car-demo into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
abidknashtech committed Nov 8, 2023
2 parents 99a26a0 + 42d57f3 commit 787e479
Show file tree
Hide file tree
Showing 29 changed files with 1,314 additions and 1 deletion.
2 changes: 1 addition & 1 deletion admin-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring:
profiles:
active: cosmos
active: firestore

5 changes: 5 additions & 0 deletions cart-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan (basePackages = "com.nashtech.car.cart")
public class CartApplication {
public static void main(String[] args) {
SpringApplication.run(CartApplication.class, args);
Expand Down
19 changes: 19 additions & 0 deletions cart-service/src/main/java/com/nashtech/car/cart/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.nashtech.car.cart;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@ComponentScan
public class WebConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:4200/") // Allow requests from Angular app
.allowedMethods("GET", "POST", "PUT", "DELETE")
.maxAge(3600);
}
}
33 changes: 33 additions & 0 deletions elastic-search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
17 changes: 17 additions & 0 deletions elastic-search/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
container_name: elasticsearch
environment:
- node.name=elasticsearch
- cluster.name=mycluster
- discovery.type=single-node
ports:
- "9200:9200"
- "9300:9300"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
23 changes: 23 additions & 0 deletions elastic-search/k8s-azure/elastic-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
name: elasticsearch
spec:
version: 7.6.0
nodeSets:
- name: default
count: 1
config:
node.master: true
node.data: true
node.ingest: true
node.store.allow_mmap: false
xpack.security.authc:
anonymous:
username: anonymous
roles: superuser
authz_exception: false
http:
tls:
selfSignedCertificate:
disabled: true
17 changes: 17 additions & 0 deletions elastic-search/k8s-azure/elastic-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: elasticsearch-es-http
spec:
selector:
app.kubernetes.io/name: MyApp
ports:
- protocol: TCP
port: 9200
targetPort: 9200
clusterIP: 10.0.232.81
type: LoadBalancer
status:
loadBalancer:
ingress:
- ip: 192.0.2.127
35 changes: 35 additions & 0 deletions elastic-search/k8s-azure/scripts/azure-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Variables to be used
resourceGroupName="az-nashtech-resource-group"
resourceLocation="EastUS"
clusterName="ntdemocluster"

#Scripts

#Login to Azure in Local
az login

#Create Resource Group
az group create --name $resourceGroupName --location $resourceLocation

#Create an AKS Cluster with default setting
az aks create --resource-group $resourceGroupName --name $clusterName

#Get the Kubernetes Configuration to run further commands
az aks get-credentials --resource-group $resourceGroupName --name $clusterName

#Run this command to install CRDS
kubectl create -f https://download.elastic.co/downloads/eck/2.9.0/crds.yaml

# Download the required repo for elastic
kubectl apply -f https://download.elastic.co/downloads/eck/2.9.0/operator.yaml

#Apply the deployment File
kubectl apply -f elastic-deployment.yaml

# Once Pod is up take the Cluster Ip and add it into the elastic-svc.yaml file
kubectl apply -f elastic-svc.yaml





Loading

0 comments on commit 787e479

Please sign in to comment.