Skip to content

Commit

Permalink
Added build.sh script and manifests of kubernets
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorAzevedo09 committed Mar 28, 2024
1 parent 442fd73 commit 55f3f82
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/auth/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Check if Docker is installed
if ! command -v docker &> /dev/null
then
echo "Docker is not installed. Please install Docker to proceed."
exit 1
fi

# Check if script is run with sudo
if [ "$(id -u)" -ne 0 ]; then
echo "Please run this script with sudo."
exit 1
fi

# Build the Docker image
sudo docker buildx build . -t microservice/auth
9 changes: 9 additions & 0 deletions src/auth/manifests/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: auth-configmap
data:
MYSQL_HOST: host.minikube.internal
MYSQL_USER: auth_user
MYSQL_DB: auth
MYSQL_PORT: "3306"
30 changes: 30 additions & 0 deletions src/auth/manifests/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth
labels:
app: auth
spec:
replicas: 2
selector:
matchLabels:
app: auth
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 3
template:
metadata:
labels:
app: auth
spec:
containers:
- name: auth
image: kurupira09/auth
ports:
- containerPort: 80
envFrom:
- configMapRef:
name: auth-configmap
- secretRef:
name: auth-secret
8 changes: 8 additions & 0 deletions src/auth/manifests/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: auth-secret
stringData:
MYSQL_PASSWORD: Auth123
JWT_SECRET: sarcasm
type: Opaque
12 changes: 12 additions & 0 deletions src/auth/manifests/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: auth
spec:
selector:
app: auth
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP

0 comments on commit 55f3f82

Please sign in to comment.