Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying 2 apps from the same git using CodeDeploy

We have an app with web and worker nodes - the code for both is in the same git but gets deployed to different autoscaling groups. The problem is that there is only one appspec file, however the deployment scripts (AfterInstall, AppStart, etc.) for the web/worker nodes are different. How would I go about setting my CodeDeploy to deploy both apps and execute different deployment scripts ?

  • (Right now we have an appspec file that just invokes chef recipes that execute different actions based on the role of the node)
like image 945
EugeneMi Avatar asked May 07 '26 19:05

EugeneMi


1 Answers

I know this question is very old, but I had the same question/issue recently and found an easy way to make it work.

I have added two appspec files on the same git: appspec-staging.yml, appspec-storybook.yml.

Also added two buildspec files buildspec-staging.yml, buildspec-storybook.yml(AWS CodeBuild allows specify the buildspec file).

The idea is after the build is done, we will copy and rename the specific appspec-xx.yml file to the final appspec.yml file, so finally, in the stage of CodeDeploy, we will have a proper appspec.yml file to deploy. Below command is for linux environment.

   post_build:
    commands:
      - mv appspec-staging.yml appspec.yml
like image 157
Leon Avatar answered May 10 '26 01:05

Leon