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
72 changes: 0 additions & 72 deletions .github/workflows/maven.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM adoptopenjdk/openjdk11

EXPOSE 8080

ENV APP_HOME /usr/src/app
ENV APP_HOME /usr/src/app

COPY target/*.jar $APP_HOME/app.jar

Expand Down
21 changes: 21 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 0.0
os: linux
files:
- source: target/database_service_project-0.0.4.jar
destination: /opt/database_service_project
overwrite: true

hooks:
BeforeInstall:
- location: scripts/install_depen.sh
timeout: 300
runas: root

ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: root
21 changes: 21 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 0.2

phases:
install:
runtime-versions:
java: corretto17
nodejs: 18
build:
commands:
- echo "Hello World"
- mvn clean install
post_build:
commands:
- mvn test
- mvn package
artifacts:
files:
- target/database_service_project-0.0.4.jar
- appspec.yml
- scripts/*
discard-paths: no
20 changes: 9 additions & 11 deletions deployment-service.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
apiVersion: apps/v1
kind: Deployment # Kubernetes resource kind we are creating
kind: Deployment
metadata:
name: boardgame-deployment
spec:
selector:
matchLabels:
app: boardgame
replicas: 2 # Number of replicas that will be created for this deployment
replicas: 2
template:
metadata:
labels:
app: boardgame
spec:
containers:
- name: boardgame
image: adijaiswal/boardshack:latest # Image that will be used to containers in the cluster
image: adijaiswal/boardshack:latest
imagePullPolicy: Always
ports:
- containerPort: 8080 # The port that the container is running on in the cluster

- containerPort: 8080

---

apiVersion: v1 # Kubernetes API version
kind: Service # Kubernetes resource kind we are creating
metadata: # Metadata of the resource kind we are creating
apiVersion: v1
kind: Service
metadata:
name: boardgame-ssvc
spec:
selector:
app: boardgame
ports:
- protocol: "TCP"
port: 80
targetPort: 8080
type: LoadBalancer # type of the service.
targetPort: 8080
type: LoadBalancer
1 change: 1 addition & 0 deletions scripts/deploy_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions scripts/install_depen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
sudo apt update -y
5 changes: 5 additions & 0 deletions scripts/start_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
echo "Starting Java application..."
chmod +x /opt/database_service_project/database_service_project-0.0.4.jar
nohup java -jar /opt/database_service_project/database_service_project-0.0.4.jar >/opt/database_service_project/app.log 2>&1 &
echo "Application started!"
4 changes: 4 additions & 0 deletions scripts/stop_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
echo "Stopping Java application..."
pkill -f 'java -jar' || echo "No running Java application found"
echo "Java application stopped."