Giter Site home page Giter Site logo

vagrant-ubuntu-swarm's Introduction

vagrant-ubuntu-swarm

Vagrant setup for 2-node Docker Swarm cluster on Ubuntu.

This Vagrant setup creates two Ubuntu VMs and then uses Ansible to install an NFS server and Docker Swarm manager on VM #1. It sets up NFS clients on the other VMs, Docker and uses "docker swarm join" to add the other VMs the the Docker Swarm managed by VM #1.

Prerequisites

You'll need Git, Vagrant and a machine with a fair amount of memory. If you're reading this you probably have Git installed. You can get Vagrant here: https://www.vagrantup.com/downloads.html

Getting the code

Use Git to clone this repo:

$ git clone https://github.com/snoopdave/vagrant-ubuntu-swarm.git

Starting the cluster

Change directory in to the repo directory:

$ cd vagrant-ubuntu-swarm

Use Vagrant to create the cluster:

$ vagrant up

Vagrant will create two VMs running Ubuntu and will then use Ansible to install Docker on each. Ansible will init a Docker Swarm cluster on vm1, making it the Swarm master, and save the join-token to NFS drive. The other VMs will use that join-token to join the cluster.

Accessing the cluster

You can use Vagrant to ssh into the two VMs of the cluster: vm1, vm2 and vm3. vm1 is the Docker Swarm master. For example, you can login to vm1 and list the Docker networks:

$ docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
4e6647e451f5        bridge              bridge              local
5417aa6b23a9        docker_gwbridge     bridge              local
98592e66496b        host                host                local
2db972t4ugnd        ingress             overlay             swarm
4838d2ef79d3        none                null                local

Via port 80

You can also access the cluster via IP addresses:

  • vm1 is 10.1.1.161
  • vm2 is 10.1.1.162

The cluster also exposes 8080 on each VM as port 80. So, for example if you run Tomcat on vm1 on port 8080, you'll be able to access Tomcat at http://10.1.1.161:8080 on your host computer.

You can change or add additional port mappings by changing the Vagrantfile.

NFS drive

vm1 runs an NFS server and shares /var/nfs with the other instances, which mount the drive at the same path.

vagrant-ubuntu-swarm's People

Contributors

snoopdave avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

sssd-dev hotval

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.