https://github.com/inket/opsdeploy
Gem for performing deployment & checks on AWS OpsWorks
https://github.com/inket/opsdeploy
Last synced: 4 months ago
JSON representation
Gem for performing deployment & checks on AWS OpsWorks
- Host: GitHub
- URL: https://github.com/inket/opsdeploy
- Owner: inket
- Created: 2015-07-14T05:31:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-11T08:06:29.000Z (over 9 years ago)
- Last Synced: 2025-08-28T09:51:32.163Z (5 months ago)
- Language: Ruby
- Size: 49.8 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### OpsDeploy
A simple gem to perform deployment & checks on AWS OpsWorks. You can deploy, wait for deployments to finish, and check on the instances responses for a successful deployment flow. Also implements Slack notifications for each step.
### Usage
```shell
gem install ops_deploy
```
In your code:
```ruby
require 'ops_deploy'
ops = OpsDeploy.new(aws_config)
# Start deployment (sync)
success = ops.start_deployment(stack_id, app_id, migrate)
# Wait for deployments (async)
ops.deployments_callback = Proc.new {
|aws_deployment_obj|
# whatever
}
a_thread = ops.wait_for_deployments(stack_id)
a_thread.join
# Check instances (async)
ops.instances_check_callback = Proc.new {
|aws_instance_obj, http_response, exception|
# whatever
}
a_thread = ops.check_instances(stack_id)
a_thread.join
```
or using the CLI:
```shell
opsdeploy --aws-region= --aws-profile=<...> --stack= --slack-webhook-url=<...> --slack-username=<...> --slack-channel=<...>
```
The tasks are:
- deploy (starts a deployment)
- migrate (will also migrate during the deployment [for Rails apps])
- wait (waits for the deployments)
- check (checks the instances)
Example:
```shell
opsdeploy deploy wait check --stack="Example" --aws-region="us-east-1"
```
Output:
```
-> Getting stack 'Example'...
-> Found stack 'Example' (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
-> Starting deployment on stack 'Example'...
✓ Deployment started on stack 'Example'
-> Checking deployments...
-> Waiting for deployments to finish...
..............................................................
✓ Deployment OK (58s)
// Deployments finished
-> Checking instances' HTTP response...
.
✓ Response from rails-app1: 200 OK
// Response check finished
```
If you want to post info about the latest commit to slack:
WARNING: This posts the latest commit in the current local git branch, not the latest one on github
```shell
opsdeploy deploy wait check --stack="Example" --aws-region="us-east-1" --post-latest-commit=true
```
Output:
```
-> Getting stack 'Example'...
-> Found stack 'Example' (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
-> Latest commit: commit b5fed5c32df0613df06a8e1452d194cafabc22bc
Author: Martin Morava
Date: Tue Aug 9 11:49:56 2016 +0200
Enable Slack notifications about the latest commit
-> Starting deployment on stack 'Example'...
✓ Deployment started on stack 'Example'
-> Checking deployments...
-> Waiting for deployments to finish...
..............................................................
✓ Deployment OK (58s)
// Deployments finished
-> Checking instances' HTTP response...
.
✓ Response from rails-app1: 200 OK
// Response check finished
```