I deploy using Bitbucket and AWS CodeDeploy. I have 1 EC2 instance which hosts several websites (staging and production). I also have 2 branches in Bitbucket, develop and master. I configured Bitbucket to deploy to develop and I want the files to go to /var/www/vhosts/staging.com/httpdocs/ directory and when I deploy to master, files should go to /var/www/vhosts/production.com/httpdocs/ directory on the EC2 instance.
I'm only using 1 deployment group.
How can I achieve this?
This is merely a question about AWS CodeDeploy and the docs suggest to make use of multiple deployment groups for the different environments.
The general suggestion is also to not have different environments on the same instance.
However this must not mean that it would not be technically possible. E.g. you can hardencode the environment into the deployment package and when the appspec.yml hooks are fired to take care to copy the application files into the folder of your whish.
From your follow up question it looks to me that you already figured the part out about the deployment groups. Have you managed the different target folders in the life-cycle hooks so far as well? Or did you find a different solution? Please share.
I deployed using two different deployment groups. I first send the files in a temporary folder inside the domain (/var/www/vhosts/example.com/temp/) then configured my after_install script to copy those files inside /temp and send the files to the appropriate directories inside the same domain. /var/www/vhosts/example.com/staging.com/ and /var/www/vhosts/example.com/httpdocs/. This is still work in progress btw.
Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events