I have created pipeline in CodePipeline. Pipelien is runnig fine, every stage are succeeded.
Even deploy stage is in state succeeded, but there is issue with running app on Elastic Beanstalk. I don't know why, mabe by Enhanced health authorization.
When i upload .war file manually to Elastic Beanstalk, app is runnig well. But when CodePipeline is uploading .war file to Elastic Beanstalk its not working.
My buildspec.yml
version: 0.2
phases:
pre_build:
commands:
- echo In the pre_build phase...
build:
commands:
- echo Build started on `date`
- mvn clean package
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- target/myapp.war
discard-paths: yes
CodePudding user response:
I would guess that this is because a wrong artifact format is deployed. You can check this by going to the S3 bucket the pipeline is using and checking what artifact is produced. I anyways recommend that you upload a zip file and not a single war. This will allow you to use an .ebextensions file and deploy more than one war, if needed. See here for details.
You can deploy a zip file like this:
version: 0.2
phases:
pre_build:
commands:
- echo In the pre_build phase...
build:
commands:
- echo Build started on `date`
- mvn clean package
- mkdir build-output
- cp target/myapp.war build-output/myapp.war
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- build-output/**/*
CodePudding user response:
Hej,
Thank you for answer.
I used your code. Now I have in S3 zip file with folder build-output and .war file inside, but the issue is the same.
Elastic Beanstalk have status Health - Severe
I think it could be a problem with permissions, but i dont know how to fix it