Git Product home page Git Product logo

ansible-consul-demo's Introduction

ansible-consul-demo

Demo of Consul and Ansible. This is the source-code of on-stage demo created for Ansible Fest NY, 2015.

You can view the accompanying slidedeck of the presentation at: http://www.slideshare.net/irakli/ansible-fest-irakli

Installation

  1. Spin-up some Ubuntu servers on AWS (or any other hosting)

  2. Edit the IPs of the servrs in the provided hosts file (present at the same level as this README). Please make sure to indicate public IPs.

  3. Make sure to also edit group_vars/all.yml and enter the IP(s) of all servers that you allocated as consul servers. The entries in hosts and group_vars.all.yml must correspond to each other!

  4. While you are in group_vars/all.yml you may also want to change the shell_user variable. By default it is set to "ubuntu" because that's what AWS wants to log into your Ubuntu servers in as, but another user may make sense to you.

  5. In AWS EC2, the root username for Ubuntu servers is called: ubuntu. If you spin your servers up somewhere where that is not the case, edit group_vars/all.yml and modify the value of the ansible_ssh_user: ubuntu variable.

  6. Create ssh folder under this checkout (same level as README)

  7. Save a private SSH key that corresponds to the root user on all your new servers under: ssh/private-key.pem

  8. Make sure your private key permissions are valid:

    ```consul
    chmod 700 ssh
    chmod 600 ssh/*
    ```
    
  9. You are probably going to need following ports open (based on https://www.consul.io/docs/agent/options.html customize as you see fit):

  10. If you need to copy security group configuration across AWS regions, this script is a life-saver: https://github.com/pedropregueiro/migrate-ec2-secgroups

Quickstart

To make sure your ssh and hosts setup is correct and you can login to all required servers:

ansible all -m ping -i hosts

To install basic Linux tools (curl, vim etc.) on all servers:

ansible-playbook basics.yml -i hosts

To install consul server and clients:

ansible-playbook bootstrap.yml -i hosts

To install everything, including the sample "hello world" microservice in Node.js:

ansible-playbook webheads.yml -i hosts

Consul User Interface

http://<ip-of-a-consul-server>:8500/

Your microservices will be available at: http://microservice-hello.service.consul on any host that points to Consul DNS servers as the DNS.

Debugging

Consul logs are under: /var/log/upstart/consul.log

To see current members of Consul cluster:

consul members

To make sure that consul leadership election succeeded (bootstrapping), you can run the following on a consul server:

consul info

and analyze the raft: section of the response.

Troubleshooting

If you are on a network that doesn't allow access to custom port you can create an SSH proxy:

ssh -D 12345 myuser@remote_ssh_server

and then in your browser proxu settings indicate SOCKS5 proxy with hostname: localhost, port: 12345.

ansible-consul-demo's People

Contributors

inadarei avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.