Latest jar is not running in Auto code deploy

0

This a Java based application. Deploying the application by using Code Deploy. By using Bitbucket pipeline, the latest jar file is uploaded to S3 bucket. The latest .jar is getting replaced with updated jar after pipeline triggered or Auto scaling timings. But the process is not running with latest jar. we are killing the existing processes and starting them manually to run the latest jar.

Could you please guide us on how to resolve the issue to run the jar automatically without triggering manually appspec.yml:

hooks: AfterInstall: - location: deploymentscripts/serviceApp.bash runas: root ApplicationStart: - location: deploymentscripts/startApp.bash runas: root

serviceApp.bash

#Copy jar file to /usr/local/app_name sudo mkdir /usr/local/app_name sudo cp -f /usr/local/app_name/target/app_name-0.0.1-SNAPSHOT.jar /usr/local/app_name/app_name-0.0.1-SNAPSHOT.jar #Create service file sudo touch /etc/systemd/system/app_name.service sudo > /etc/systemd/system/app_name.service #add exucute permission to service file sudo chmod 664 /etc/systemd/system/app_name.service sudo chmod +x /usr/local/app_name/app_name-0.0.1-SNAPSHOT.jar

startApp.bash

sudo java -Dspring.profiles.active=env_name -Dlog_path=/usr/local/app_name -jar /usr/local/app_name/app_name-0.0.1-SNAPSHOT.jar &>/dev/null &

질문됨 일 년 전205회 조회
1개 답변
0

Greetings, From the case notes, I understand that you need guidance on how to run the .jar automatically without triggering manually appspec.yml CodeDeploy will use the appspec.yml file in the source code therefore issuing instruction on how to deploy the application. Once the application has been packaged the appspec file is no longer in use[1]

You can include the same script 'serviceApp.bash' and 'startApp.bash' on the appspec file following the guideline[1] to trigger the desired configurations.

Reference: [1] https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file.html

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠