<commit_before># THE CLUSTERNATOR

## Setup

#### Install the `clusternator` CLI

```
npm install -g clusternator
```

Check and see if it installed successfully

```
clusternator --help
```


#### Export AWS keys

You have to create an Administrator AWS user first.

```
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
```

#### Create app definition file

In your project's root folder:

```
clusternator app:new > YOUR_APP_DEFINITION.json
```

### AWS console setup

Before being able to launch clusters from the clusternator, you have to
preconfigure the network.

#### Create VPC
- https://console.aws.amazon.com/vpc/home
- https://aws.amazon.com/documentation/vpc/
- On the Step 1: Select a VPC Configuration page, ensure that VPC with a Single Public Subnet is selected, and choose Select.
![VPC page](scrots/vpc_setup_1.png)

#### Create security group
- Replace `us-east-1` with your region https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#SecurityGroups
- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
- Create a security group associated with the VPC you just made
![Security Group](scrots/security_group_1.png)

#### Create network interface
- https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#NIC
- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html
- Create network interface associated with SG you just made
![Network Interface](scrots/network_interface_1.png)


#### On VPC page, create a subnet
- https://console.aws.amazon.com/vpc/home?region=us-east-1#subnets
- http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html

VPC Subnet page:
![VPC Subnet page](scrots/subnet_1.png)

Create subnet:
![Create subnet](scrots/subnet_2.png)

Et Voila
![Create subnet](scrots/subnet_3.png)



## Developing Clusternator

_yay contributions!_

All code is in `src/`. The CLI entry point is `bin/clusternatorCli.js`,
but includes from `lib/` (the compile destination).


`bin/clusternatorCli-es5.js` is ultimately what gets run as the CLI
from `bin/clusternator.sh`.

<commit_msg>Update README with appdef docs<commit_after># THE CLUSTERNATOR

## Setup

#### Install the `clusternator` CLI

```
npm install -g clusternator
```

Check and see if it installed successfully

```
clusternator --help
```


#### Export AWS keys

You have to create an Administrator AWS user first.

```
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
```

#### Create app definition file

In your project's root folder:

```
clusternator app:new > YOUR_APP_DEFINITION.json
```

### AWS console setup

Before being able to launch clusters from the clusternator, you have to
preconfigure the network.

#### Create VPC
- https://console.aws.amazon.com/vpc/home
- https://aws.amazon.com/documentation/vpc/
- On the Step 1: Select a VPC Configuration page, ensure that VPC with a Single Public Subnet is selected, and choose Select.
![VPC page](scrots/vpc_setup_1.png)

#### Create security group
- Replace `us-east-1` with your region https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#SecurityGroups
- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html
- Create a security group associated with the VPC you just made
![Security Group](scrots/security_group_1.png)

#### Create network interface
- https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#NIC
- http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html
- Create network interface associated with SG you just made
![Network Interface](scrots/network_interface_1.png)


#### On VPC page, create a subnet
- https://console.aws.amazon.com/vpc/home?region=us-east-1#subnets
- http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html

VPC Subnet page:
![VPC Subnet page](scrots/subnet_1.png)

Create subnet:
![Create subnet](scrots/subnet_2.png)

Et Voila
![Create subnet](scrots/subnet_3.png)


## App Definition File

This is the _hard part_ (kinda, not really). The application definition file
(which we will call `appdef.json`) is a JSON file which specifies the following
details about how to run your application:

- Docker images running
- Environment variables
- Links between containers
- Physical -> virtual port mappings
- Data volumes and their physical mount points
  (hard drives, can share between containers)
- CPU and RAM on the physical EC2 instance

You can create an `appdef.json` by running `clusternator app:new > appdef.json`.
More information about the parameters can be found at
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html
 

## Developing Clusternator

_yay contributions!_

All code is in `src/`. The CLI entry point is `bin/clusternatorCli.js`,
but includes from `lib/` (the compile destination).


`bin/clusternatorCli-es5.js` is ultimately what gets run as the CLI
from `bin/clusternator.sh`.


{'fraction_non_alphanumeric': 0.11814086814086815, 'fraction_numerical': 0.007575757575757576, 'mean_word_length': 4.54483541430193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3241739', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1554, 'n_words': 470}