Git Product home page Git Product logo

consul-getting-started's Introduction

Errata

Setup

Mac

See SETUP_MAC.sh

Windows Users

See SETUP_WINDOWS.ps1

  • This repo forces LF line endings on checkout, see .gitattributes
  • If you want to edit files, install an http://editorconfig.org/#download plugin for whatever IDE you use to edit code.
    • This will ensure that files you create/modify have *nix LF endings and not CRLF.
    • Otherwise, you'll have random trouble with scripts you create and try to run on *nix VMs.
    • I have already added a .editorconfig file to this project

Usage

There's a Vagrantfile in this repository that spins up the simulated environment.

If you want to run everything, there's 14 VMs in total, you need:

  • 10 GB of free memory
  • 4+ core CPU
  • 20 GB of free disk space

If you have less than this, scale back the number of VMs you spin up, in the Vagrantfile, change the range (1..3) to (1..2) or (1..1). If you update the consul-server count, update provision/cs-consul.d/server.json and set bootstrap_expect accordingly.

Commands to use to launch services before we switch to upstart jobs:

consul-server node

# vagrant ssh consul-server

consul agent -dev -advertise 172.20.20.31 -client 0.0.0.0 &

web nodes

# vagrant ssh webX

ip=$(ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2,6) }')
consul agent -advertise $ip -config-file /vagrant/common.json -config-file /vagrant/web.service.json &
/vagrant/provision/setup.web.sh

lb node

# vagrant ssh lb 

/vagrant/provision/setup.lb.sh
/vagrant/provision/install.consul-template.sh

ip=$(ifconfig eth1 | grep 'inet addr' | awk '{ print substr($2,6) }')
consul agent -advertise $ip -config-file /vagrant/common.json -config-file /vagrant/lb.service.json &

consul-template -config /vagrant/provision/lb.consul-template.hcl &

# Install config into KV store for lb
curl -X PUT -d '4096' http://localhost:8500/v1/kv/prod/portal/haproxy/maxconn
curl -X PUT -d '5s' http://localhost:8500/v1/kv/prod/portal/haproxy/timeout-connect
curl -X PUT -d '50s' http://localhost:8500/v1/kv/prod/portal/haproxy/timeout-server
curl -X PUT -d '50s' http://localhost:8500/v1/kv/prod/portal/haproxy/timeout-client
curl -X PUT -d 'enable' http://localhost:8500/v1/kv/prod/portal/haproxy/stats

Run consul on desktop, joins NYC datacenter

consul agent \
   -config-file desky.consul.json \
   -config-file provision/common-consul.d/join.json

Provisioning with events

# Manual watch, this is what's configured in (provision/web-consul.d/provision.watches.json), this command is just for reference if you want to use consul watch directly
consul watch -type event -name web-provisn /vagrant/provision/ansible/provision-self.sh

# Fire event at all nodes
consul event -name web-provision

# Fire event at specific node(s)
consul event -name web-provision -node web1

consul-getting-started's People

Contributors

g0t4 avatar

Watchers

 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.