<commit_before># OpsworksWrapper

A simple wrapper for aws-sdk to make handling opsworks operations easier.

## Supported Operations

### Deployment
- Rolling/Non-Rolling deployment by layer
- Update custom cookbooks
- Non-Rolling Deployment Creation for all layers except a specified layer (exclusion by layer name)
- Retrieve all instances for a given layer name

### ELB
- Detach instance from ELB (wait for draining)
- Attach instance to ELB (wait for health check)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'opsworks_wrapper'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install opsworks_wrapper

## Usage

Example OpsWorks Configuration

A simple OpsWorks stack with 2 layers, one is attached to an ELB

Layer 1:
 - name: Frontend
 - ELB attached: yes

Layer 2:
 - name: Backend
 - ELB attached: no

### Rolling Deployment

```ruby
require 'aws-sdk'
require 'opsworks_wrapper'

ACCESS_KEY = "yourAccessKey"
SECRET_KEY = "yourSecretKey"
OPSWORKS_APP_ID = "yourAppID"

# update AWS credentials
Aws.config.update({
                      region: 'us-east-1',
                      credentials: Aws::Credentials.new(ACCESS_KEY, SECRET_KEY)
                  })
                  
opsworks = OpsworksWrapper::Deployer.new(OPSWORKS_APP_ID)

# Do rolling deploy to backend layer
opsworks.deploy_layer_rolling('Backend')


# Do rolling deploy to frontend layer
# Note: Since frontend has an ELB, instances will be detached before deployment
# and re-attached. After re-attaching, wait for ELB health-check to pass
opsworks.deploy_layer_rolling('Frontend')
```

### Update Custom Cookbooks

```ruby
require 'aws-sdk'
require 'opsworks_wrapper'

ACCESS_KEY = "yourAccessKey"
SECRET_KEY = "yourSecretKey"
OPSWORKS_APP_ID = "yourAppID"

# update AWS credentials
Aws.config.update({
                      region: 'us-east-1',
                      credentials: Aws::Credentials.new(ACCESS_KEY, SECRET_KEY)
                  })
                  
opsworks = OpsworksWrapper::Deployer.new(OPSWORKS_APP_ID)

# Run command update-custom-cookbooks on all layers
# Note: this will not run deploy command
opsworks.update_cookbooks
```


Bug reports and pull requests are welcome on GitHub at https://github.com/ukayani/opsworks_wrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).<commit_msg>Fixed link and added header<commit_after># OpsworksWrapper

A simple wrapper for aws-sdk to make handling opsworks operations easier.

## Supported Operations

### Deployment
- Rolling/Non-Rolling deployment by layer
- Update custom cookbooks
- Non-Rolling Deployment Creation for all layers except a specified layer (exclusion by layer name)
- Retrieve all instances for a given layer name

### ELB
- Detach instance from ELB (wait for draining)
- Attach instance to ELB (wait for health check)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'opsworks_wrapper'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install opsworks_wrapper

## Usage

Example OpsWorks Configuration

A simple OpsWorks stack with 2 layers, one is attached to an ELB

Layer 1:
 - name: Frontend
 - ELB attached: yes

Layer 2:
 - name: Backend
 - ELB attached: no

### Rolling Deployment

```ruby
require 'aws-sdk'
require 'opsworks_wrapper'

ACCESS_KEY = "yourAccessKey"
SECRET_KEY = "yourSecretKey"
OPSWORKS_APP_ID = "yourAppID"

# update AWS credentials
Aws.config.update({
                      region: 'us-east-1',
                      credentials: Aws::Credentials.new(ACCESS_KEY, SECRET_KEY)
                  })
                  
opsworks = OpsworksWrapper::Deployer.new(OPSWORKS_APP_ID)

# Do rolling deploy to backend layer
opsworks.deploy_layer_rolling('Backend')


# Do rolling deploy to frontend layer
# Note: Since frontend has an ELB, instances will be detached before deployment
# and re-attached. After re-attaching, wait for ELB health-check to pass
opsworks.deploy_layer_rolling('Frontend')
```

### Update Custom Cookbooks

```ruby
require 'aws-sdk'
require 'opsworks_wrapper'

ACCESS_KEY = "yourAccessKey"
SECRET_KEY = "yourSecretKey"
OPSWORKS_APP_ID = "yourAppID"

# update AWS credentials
Aws.config.update({
                      region: 'us-east-1',
                      credentials: Aws::Credentials.new(ACCESS_KEY, SECRET_KEY)
                  })
                  
opsworks = OpsworksWrapper::Deployer.new(OPSWORKS_APP_ID)

# Run command update-custom-cookbooks on all layers
# Note: this will not run deploy command
opsworks.update_cookbooks
```

## Contributions

Bug reports and pull requests are welcome on GitHub at https://github.com/ukayani/opsworks-wrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
{'fraction_non_alphanumeric': 0.08227246817404522, 'fraction_numerical': 0.0019000570017100513, 'mean_word_length': 3.6094570928196146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5054204', 'n_tokens_mistral': 1593, 'n_tokens_neox': 1538, 'n_words': 534}