Skip to content

Deploys restify-mongodb-parks with ansible, optionally creation with vagrant.

Notifications You must be signed in to change notification settings

snuf/rm-parks-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is it?

A Simple web app deployed with ansible, The app consists of two haproxies, nodejs mongodb and a simple client that does random queries on the rest-api and generates some load (tunable eyes_interval). The used web app is a slightly modified version of the openshift demo app [restify-mongodb-parks|https://github.com/snuf/restify-mongodb-parks] There is also a vagrant file for virtualbox and libvirt that allows easy testing and rollout of multiple machines if required. There are several configuration options availabie. These depend on the hostnames used, and will by default revert to a setup based on the amount of [haproxy] nodes. sorry no ascii art here

TODOs

  1. Real status page instead of dirty 503.
  2. Make MongoDB a real cluster instead of dumb usable nodes.
  3. Add the layer 7 checks to haproxy.

Setup (not vagrant)

When not using vagrant (revamp) there are a couple manual steps required. In the hosts file that is used with ansible :

  1. Go to the ansible directory

    cd /ansible

  2. Make sure the correct user is used and this user has sudo rights:

    ansible_ssh_user=vagrant

  3. If the user above has no ssh key distributed or if a single private ssh key or password can be used for all hosts:

    ansible_ssh_pass=vagrant
    or
    ansible_ssh_private_key_file=~/.ssh/id_bootstrap

  4. Edit the proxies to point at the correct ones or comment the lines out:

    proxy_http: "http://172.28.128.1:3128"
    proxy_https: "http://172.28.128.1:3128"

    Set the interval to a desired float, or 0 for non wait.
    eyes_interval: 0.

  5. Enter the correct IPs/hosts under the groups and the desired options:

    [haproxy]
    1st Loadbalancer sits front of nodejs entities.
    2nd Loadbalancer sits in front of mongodb.
    Minimum 0, advised 2.

    [mongodb]
    Backend servers that contain the data.
    Minimum 1, advised multiuple.

    [nodejs]
    Frontend servers that serve the site and api.
    Minimum 1, advised multiple.

    [eyes]
    Host that runs a script that gets parks from random longtitude and lattitude in the us degrees.
    Minimum 0, advised 1 can be multiple.

You can add multiple hosts/ips for each group, but for [haproxy] we only use one host/ip per group type of [nodejs] and [mongodb]. If a single [haproxy] host/ip is added both [nodejs] and [mongodb] will live behind the single [haproxy]. if no [haproxy] is used a single a [nodejs] is directly wired to a single [mongodb].

Ansible setup on older ubuntu.

Make sure you have a "recent" ansible version on the ubuntu host that runs the playbook (minimal 2.2.2.0) If no proxies are required, leave out the proxies.

sudo bash  
export http_proxy=http://172.28.128.1:3128  
export https_proxy=http://172.28.128.1:3128  
apt-get update  
apt-get install -y software-properties-common  
apt-add-repository -y ppa:ansible/ansible  
apt-get update  
apt-get install -y ansible  

Running the playbook

The ansible playbook can be checked, will have one failure at the end...:

ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook --check -i hosts playbook.yaml  

After successfully runnig the dry-runm the script can be run:

ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts playbook.yaml  

Setup with vagrant

For now the Vagrantfile assumes virtualbox or libvirt. The alterations named in setup above are to be done in the hosts.header file, except for the addition of the hosts/ips themselves, which are generated from vagrant status. Changing the amount of nodes is done in the Vagrantfile, by altiering the hosts list. Names are respectively haproxy, mongodb, nodejs, eyes to create multiple hosts a number is added with a dash -. e.g. haproxy, haproxy-1 ... etc etc etc etc ...

deploy everything: ./revamp full
(re)-deploy vms: ./revamp refresh
update hosts file: ./revamp hosts
run ansible: ./revamp ansible

About

Deploys restify-mongodb-parks with ansible, optionally creation with vagrant.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published