詳細検索

How to auto-deploy in AWS OpsWorks on push on GitHub

Avatar
by 平形大樹
2 min read

How to auto-deploy in AWS OpsWorks on push on GitHub
Translated from 日本語 • View original

It is a flat form of development.

Today, we'll teach you how to auto-deploy in AWS OpsWorks when pushed on GitHub.

OpsWorks is a deployment service provided on AWS.

*For more information about OpsWorks, please visit this website.

This story assumes that OpsWorks has stacks, layers, and instances.

OpsWorks itself, I just touched it recently,
I understand that it is very easy to deploy.

But as a greedy person, I wonder if I can automate more? I thought.

Normally, the source is versioned on GitHub, so
If I push to GitHub, I wonder if I can't deploy it at the same time? When.

Then it was surprisingly easy to realize.

You can configure it on GitHub.
On the application repository page, click Settings

bigplants_opsworks-demo-php-simple-app-2

「Service Hooks」

Options

AWS OpsWorks

Service_Hooks-2

All of the following fields are required, so fill in them all.

Service_Hooks-4

This is where you need information from the OpsWorks side.

First of all, the Stack Id, which is not visible at first glance on the AWS Managed Console screen.
A quick way to check this is to look at the URL on the Stack screen.

Stack_-_ops_stack_01_–_AWS_OpsWorks_と_Bootstrap_101_Template-7

Next is the App ID, but also on the OpsWorks screen, click "Apps" = > "Application Name"

Apps_-_ops_stack_01_–_AWS_OpsWorks-5

The OpsWorks ID is the App ID.

sample_app_-_Apps_–_AWS_OpsWorks-4

Branch Name specifies the branch name you want to deploy the repository to.

Enter your AWS access key and secret key, then click Update settings.

All you have to do is push to the relevant branch!

This will automatically run the OpsWorks deployment.

I was impressed by this!

However, I was greedy and thought again.

In OpsWorks, you operate the stack separately from the production and staging environments.

Then,

  • Release branch is staging
  • Master branch is the real thing.

I hope I can automatically deploy each.

However, you can only set up one stack per repository.

I found out that I couldn't do it, and I was distraught.

Well, in actual operation, it seems that suddenly deploying just by pushing the master will be a source of trouble.
That's what it is. I said to myself and regained my composure.

Still, it's still convenient.

May your deployment life be more fulfilling.

The above is delivered by Hiragata.

Related Articles