mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 20:25:50 +00:00
adding scripts + appspec.yml file for codedeploy
This commit is contained in:
parent
1d1d1d771b
commit
182576ff00
3 changed files with 45 additions and 0 deletions
24
appspec.yml
Normal file
24
appspec.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
version: 0.0
|
||||||
|
os: linux
|
||||||
|
|
||||||
|
files:
|
||||||
|
- source: /target/*.jar
|
||||||
|
destination: /home/ec2-user/spring-petclinic
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
- object: /home/ec2-user/spring-petclinic
|
||||||
|
owner: ec2-user
|
||||||
|
group: ec2-user
|
||||||
|
mode: 755
|
||||||
|
|
||||||
|
hooks:
|
||||||
|
BeforeInstall:
|
||||||
|
- location: scripts/before_install.sh
|
||||||
|
timeout: 300
|
||||||
|
runas: ec2-user
|
||||||
|
ApplicationStart:
|
||||||
|
- location: scripts/start_application.sh
|
||||||
|
timeout: 300
|
||||||
|
runas: ec2-user
|
||||||
|
|
||||||
|
|
10
scripts/before_install.sh
Normal file
10
scripts/before_install.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Updating package list..."
|
||||||
|
sudo yum update -y
|
||||||
|
|
||||||
|
sudo yum install -y openjdk-21-jdk
|
||||||
|
|
||||||
|
echo "Installing Maven..."
|
||||||
|
sudo yum install -y maven
|
||||||
|
|
||||||
|
|
11
scripts/start_application.sh
Normal file
11
scripts/start_application.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "Navigating to the application directory..."
|
||||||
|
cd /home/ec2-user/spring-petclinic
|
||||||
|
|
||||||
|
echo "Building the application using Maven..."
|
||||||
|
mvn clean package -DskipTests
|
||||||
|
|
||||||
|
echo "Starting the Spring Boot application..."
|
||||||
|
java -jar target/spring-petclinic-*.jar > app.log 2>&1 &
|
||||||
|
echo "Application started successfully!"
|
||||||
|
|
Loading…
Reference in a new issue