<commit_before># Diddy Deploy Dat

A deployment tool geared primarily for @RevoltTV's deployment process, but may
be beneficial/extensible to other deployment patterns.

This tool performs the following primary tasks:

1. Create a new Docker build with appropriate tags
2. Push this new Docker build to Amazon Elastic Container Repository
3. Create/Update an Elastic Container Service task with the new build
4. Create/Update an Elastic Container Service service to redeploy with the new build
5. Ensure the new services start correctly, and perform any cleanup of old resources

## Installation

```
npm install -g diddy-deploy-dat
```

## Configuring

`diddy-deploy-dat` can be configured in a few different ways:

* environment variables
* command line arguments
* a `diddy.yml` file

It's recommended to use a `diddy.yml` file for most of the configuration, but
anything that can be considered sensitive can be passed in via the command line
or an environment variable

### `diddy.yml` structure

The key `common` in the YAML file is used for shared configuration details that
can be used for any deployment environment. It is recommended to use this for
setting up the repository configuration at the very least

Additional top level keys refer to deployment environments which can be set with
the `DEPLOYMENT_ENV` environment variable, or the `--env` command line argument

**EXAMPLE**

```
common:
    repository:
        accountId: 'AWS_ACCOUNT_NUMBER'
        name: 'repository-name'
        region: 'aws-region-1'

production:
    cluster: 'name-of-cluster'
    regions:
        - 'aws-region-1'
        - 'aws-region-2'
    service:
        name: 'name-of-service'
        count: 2
        minimumPercent: 50
        maximumPercent: 200
    task:
        name: 'the-task-name'
        networkMode: 'bridge|host|none'
        container:
            name: 'the-container-name'
            cpu: 256
            memory: 512
            memoryReservation: 256
            ports:
                - 9999
                -
                    host: 9998
                    container: 9473
                    protocol: 'tcp|udp'
            environment:
                NODE_ENV: 'production'
                LOG_LEVEL: 'info'
```

## Deploying

Each deployment will create a Docker image and tag it with information from the
project's `package.json` by default (`package.name` and `package.version`
respectively). This can be overridden with environment variables `DEPLOYMENT_NAME`
and `DEPLOYMENT_TAG` or command line arguments `--name` and `--tag`.

**EXAMPLE**

```
$: cd /your/project
$: DEPLOYMENT_ENV=production diddy-deploy-dat --tag $CI_BUILD_NUMBER
```<commit_msg>:books: docs: add a bit more about configuration and limitations<commit_after># Diddy Deploy Dat

A deployment tool geared primarily for @RevoltTV's deployment process, but may
be beneficial/extensible to other deployment patterns.

This tool performs the following primary tasks:

1. Create a new Docker build with appropriate tags
2. Push this new Docker build to Amazon Elastic Container Repository
3. Create/Update an Elastic Container Service task with the new build
4. Create/Update an Elastic Container Service service to redeploy with the new build
5. Ensure the new services start correctly, and perform any cleanup of old resources

## Installation

```
npm install -g diddy-deploy-dat
```

## Configuring

`diddy-deploy-dat` can be configured in a few different ways:

* environment variables
* command line arguments
* a `diddy.yml` file

It's recommended to use a `diddy.yml` file for most of the configuration, but
anything that can be considered sensitive can be passed in via the command line
or an environment variable

### `diddy.yml` structure

The key `common` in the YAML file is used for shared configuration details that
can be used for any deployment environment. It is recommended to use this for
setting up the repository configuration at the very least

Additional top level keys refer to deployment environments which can be set with
the `DEPLOYMENT_ENV` environment variable, or the `--env` command line argument

**EXAMPLE**

```
common:
    repository:
        accountId: 'AWS_ACCOUNT_NUMBER'
        name: 'repository-name'
        region: 'aws-region-1'

production:
    cluster: 'name-of-cluster'
    regions:
        - 'aws-region-1'
        - 'aws-region-2'
    service:
        name: 'name-of-service'
        count: 2
        minimumPercent: 50
        maximumPercent: 200
    task:
        name: 'the-task-name'
        networkMode: 'bridge|host|none'
        container:
            name: 'the-container-name'
            cpu: 256
            memory: 512
            memoryReservation: 256
            ports:
                - 9999
                -
                    host: 9998
                    container: 9473
                    protocol: 'tcp|udp'
            environment:
                NODE_ENV: 'production'
                LOG_LEVEL: 'info'
```

### AWS Configuration

`diddy-deploy-dat` does not make any assumptions about how AWS is configured in the system. As such, any method listed
in http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html should be sufficient.

It's recommended to use the Environmental Variable configuration method.

## Deploying

Each deployment will create a Docker image and tag it with information from the
project's `package.json` by default (`package.name` and `package.version`
respectively). This can be overridden with environment variables `DEPLOYMENT_NAME`
and `DEPLOYMENT_TAG` or command line arguments `--name` and `--tag`.

**EXAMPLE**

```
$: cd /your/project
$: DEPLOYMENT_ENV=production diddy-deploy-dat --tag $CI_BUILD_NUMBER
```

## Limitations

As of right now, `diddy-deploy-dat` does not do the following:

* Add EC2 instances to a new cluster
* Attach an Elastic Load Balancer to a new service

These tasks will need to be completed manually at the moment, though this may change sometime in the future.
{'fraction_non_alphanumeric': 0.07266666666666667, 'fraction_numerical': 0.011833333333333333, 'mean_word_length': 2.9325032765399737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6900646', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1556, 'n_words': 690}