Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Opsworks : How to deploy a particular git tag for an App?

AWS Opsworks lets you deploy an app. The deployment seems to deploy the master branch always.

How can I make it deploy a git tag?

Thanks

like image 714
Mayank Jain Avatar asked Aug 25 '15 04:08

Mayank Jain


People also ask

What shall be the best way to deploy back end layer for an application with structured data?

Recommendation: In general, we recommend using an Amazon RDS layer as an application's backend database because it is more flexible and can be used for any transition scenario. For more information about how to handle transitions, see the Amazon RDS User Guide.

How do I add apps to AWS?

Click Apps in the navigation pane. On the Apps page, click Add an app for your first app. For subsequent apps, click +App. Use the App New page to configure the app, as described in the following section.

Which OpsWorks component defines EC2 instance configurations?

OpsWorks for Puppet Enterprise lets you use Puppet to automate how nodes are configured, deployed, and managed, whether they are Amazon EC2 instances or on-premises devices.

What is OpsWorks stack?

AWS OpsWorks Stacks lets you manage applications and servers on AWS and on-premises. With OpsWorks Stacks, you can model your application as a stack containing different layers, such as load balancing, database, and application server.


2 Answers

There is no elegant solution to this. It's a shame OpsWorks doesn't let you specify branch/tag at deployment time.

EDIT: After some digging around with OpsWorks/Chef/Ruby, you actually can deploy a specific tag relatively simply. Either of the two methods below are still valid.

You can deploy a git tag in one of the following ways:

Method 1: Specify in App settings

  1. Before deploying, edit your App, and change the Branch/Revision value to tags/1.2.3 where 1.2.3 is the tag you want to deploy.
  2. Save changes, then deploy your app as normal.
  3. Remember to manually change this each time you deploy!

Method 2: Pass custom JSON on deployment action

Include the following custom JSON when you deploy your app

{"deploy": {"myapp": {"scm": {"revision": "tags/1.2.3"}}}}

where myapp is the Short name of your app and 1.2.3 is the tag you want deployed. Don't forget to include this custom JSON each time, or your deployment will default to whatever you have in your App:Branch/Revision.

Further Thoughts

For apps in build/test, you could specify develop as your Branch/Revision in App Settings, and not worry about using custom JSON each time. This will always deploy the head of develop for you.

For apps in production, you could have master as your Branch/Revision, then specify the custom JSON at deployment time. This way, if you forget to include the custom JSON, at least it will deploy the latest revision from master, which most of the time should be the same as your latest tag.

It is worth noting that if you add new instances to your layer (manually, or automatically according to your layer rules), the default behaviour would be to deploy a fresh version of your app according to the settings in App:Branch/Revision.... so actually, you'll need to be mindful of both methods depending on your exact requirements.

like image 170
teaforchris Avatar answered Oct 04 '22 06:10

teaforchris


Have you check this? You can check Branch/Revision section it is showing how you can deploy according to branch http://docs.aws.amazon.com/opsworks/latest/userguide/gettingstarted-simple-app.html

like image 44
Arvind Avatar answered Oct 04 '22 06:10

Arvind