Git Product home page Git Product logo

nomad-fun's Introduction

Fun with Packer, Vagrant, and Nomad

Packer

# setup plugins
packer init .

# make HCL files look pretty
packer fmt .

# ensure HCL files are legit
packer validate .

# build nomad server and box add
packer build -force nomad_server.pkr.hcl
vagrant box add --force nomad-server-base output-rockylinux-8-nomad-server/package.box

# build ws node and box add
packer build -force ws.pkr.hcl
vagrant box add --force ws-base output-rockylinux-8-ws/package.box

# build wh node and box add
packer build -force wh.pkr.hcl
vagrant box add --force wh-base output-rockylinux-8-wh/package.box

# build app node and box add
packer build -force app.pkr.hcl
vagrant box add --force app-base output-rockylinux-8-app/package.box

# build nweb node and box add
packer build -force nweb.pkr.hcl
vagrant box add --force nweb-base output-rockylinux-8-nweb/package.box

Vagrant

# stand up nomad server
vagrant up server1

# stand up ws node
vagrant up ws-client1

# stand up wh node
vagrant up wh-client1

# stand up app node
vagrant up app-client1

Nomad

Deploying Config Mgmt

# plan and run ws bootstrap and cron job
nomad job plan bootstrap-ws-dev.hcl
nomad job plan cron-ws-dev.hcl

nomad job run bootstrap-ws-dev.hcl
nomad job run cron-ws-dev.hcl

...

nomad job run bootstrap-wh-dev.hcl
nomad job run cron-wh-dev.hcl
nomad job run bootstrap-app-dev.hcl
nomad job run cron-app-dev.hcl
nomad job run bootstrap-nweb-dev.hcl
nomad job run cron-nweb-dev.hcl

Deploying and Scaling an App

# run ptyhon app
nomad job plan app.hcl

nomad job scale hello world 5
nomad job scale hello world 1

What to See

  • see packer

  • see vagrant using packer images

  • see nomad node raw

  • see nomad in bootstrap mode

  • see nomad in cron mode

  • see nomad service discovery in ansible (ws)

  • see nomad service discovery via ansible/golang template mix (wh)

  • see nomad service discovery as it should be (nweb, hweb)

Cons

  • nomad not secure by default (mTLS, ACLs)
  • only recent idea of deploying job with secrets
  • golang templates hurt a little
  • overkill for config mgmt ?? but what if ..

nomad-fun's People

Contributors

gkspranger avatar

Watchers

James Cloos 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.