<commit_before># ansible_go_deploy
Vagrant and Ansible setup to deploy a simple go app


## Instructions:

To run this, please clone this repository, then run the following:

```
vagrant up
```

It should then download and install all required vagrant plugins and start bringing up the hosts and provisioning with ansible.

It uses the ansible_local plugin which is currently broken with vagrant <= 1.8.1 and ansible > 2.0.0. So to get around this ansible 1.9.2 is installed
via a seperate provisioner script. The bug report for it is available here:  https://github.com/mitchellh/vagrant/issues/6793

A typical run output is included in [vagrant_up.log](https://github.com/vamegh/ansible_go_deploy/blob/master/vagrant_up.log)

## Accessing the Site:

Vagrant should have automatically added the hostname to the hosts config file, so accessing:

http://lb1.ev9.io

should show the load balanced site working. If this does not work, accessing:

http://192.168.100.10

should show the site. the nodes are also port forwarded to localhost.

Accessing http://localhost:8080 should be a connection directly to the loadbalancer.

Direct connections to the nodes are also made availabled via localhost ports 8001 / 8002 or via http://app1.ev9.io:8484  / http://app2.ev9.io:8484
or their equivalent ips, which can be found in the hosts.yaml config file.

### Screenshots:

![screenshot_1](https://raw.githubusercontent.com/vamegh/ansible_go_deploy/master/screenshots/screenshot1.jpg)
![screenshot_2](https://raw.githubusercontent.com/vamegh/ansible_go_deploy/master/screenshots/screenshot2.jpg)

<img src="https://raw.githubusercontent.com/vamegh/ansible_go_deploy/master/screenshots/screenshot1.jpg" align=centre width="500" height="500" />
<img src="https://raw.githubusercontent.com/vamegh/ansible_go_deploy/master/screenshots/screenshot2.jpg" align=centre width="500" height="500" />

## How it works:

Vagrant reads in the Hosts.yaml file, this has all of the various hosts defined, it then builds the boxes as defined within this config and generates an environment file based on the hosts name information.

Ansible is called from playbook.yaml, with a limit of the specific host being run from vagrant the exact command run is as follows:

```
cd /opt/vagrant/ansible && PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ansible-playbook --limit='lb1' --inventory-file=/tmp/vagrant-ansible/inventory -v playbook.yaml<commit_msg>should work now<commit_after># ansible_go_deploy
Vagrant and Ansible setup to deploy a simple go app


## Instructions:

To run this, please clone this repository, then run the following:

```
vagrant up
```

It should then download and install all required vagrant plugins and start bringing up the hosts and provisioning with ansible.

It uses the ansible_local plugin which is currently broken with vagrant <= 1.8.1 and ansible > 2.0.0. So to get around this ansible 1.9.2 is installed
via a seperate provisioner script. The bug report for it is available here:  https://github.com/mitchellh/vagrant/issues/6793

A typical run output is included in [vagrant_up.log](https://github.com/vamegh/ansible_go_deploy/blob/master/vagrant_up.log)

## Accessing the Site:

Vagrant should have automatically added the hostname to the hosts config file, so accessing:

http://lb1.ev9.io

should show the load balanced site working. If this does not work, accessing:

http://192.168.100.10

should show the site. the nodes are also port forwarded to localhost.

Accessing http://localhost:8080 should be a connection directly to the loadbalancer.

Direct connections to the nodes are also made availabled via localhost ports 8001 / 8002 or via http://app1.ev9.io:8484  / http://app2.ev9.io:8484
or their equivalent ips, which can be found in the hosts.yaml config file.

### Screenshots:

<img src="https://raw.githubusercontent.com/vamegh/ansible_go_deploy/master/screenshots/screenshot1.jpg" align=center width="600" height="600" />
<img src="https://raw.githubusercontent.com/vamegh/ansible_go_deploy/master/screenshots/screenshot2.jpg" align=center width="600" height="600" />

## How it works:

Vagrant reads in the Hosts.yaml file, this has all of the various hosts defined, it then builds the boxes as defined within this config and generates an environment file based on the hosts name information.

Ansible is called from playbook.yaml, with a limit of the specific host being run from vagrant the exact command run is as follows:

```
cd /opt/vagrant/ansible && PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ansible-playbook --limit='lb1' --inventory-file=/tmp/vagrant-ansible/inventory -v playbook.yaml
{'fraction_non_alphanumeric': 0.08609128271685053, 'fraction_numerical': 0.029418126757516764, 'mean_word_length': 4.78, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2784236', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1391, 'n_words': 519}