{"id":13785311,"url":"https://github.com/pete0emerson/hashipoc","last_synced_at":"2026-02-25T04:09:42.684Z","repository":{"id":50208038,"uuid":"103163993","full_name":"pete0emerson/hashipoc","owner":"pete0emerson","description":"A sample application using Vagrant, Consul, Vault, and Nomad","archived":false,"fork":false,"pushed_at":"2022-12-08T00:43:20.000Z","size":20,"stargazers_count":51,"open_issues_count":5,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T19:09:21.946Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pete0emerson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-11T17:03:57.000Z","updated_at":"2023-12-21T11:21:57.000Z","dependencies_parsed_at":"2023-01-24T07:30:57.247Z","dependency_job_id":null,"html_url":"https://github.com/pete0emerson/hashipoc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pete0emerson%2Fhashipoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pete0emerson%2Fhashipoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pete0emerson%2Fhashipoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pete0emerson%2Fhashipoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pete0emerson","download_url":"https://codeload.github.com/pete0emerson/hashipoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225094403,"owners_count":17419986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T19:00:59.071Z","updated_at":"2026-02-25T04:09:42.651Z","avatar_url":"https://github.com/pete0emerson.png","language":"Shell","funding_links":[],"categories":["Tutorials / Examples / Demos","Examples / Demos"],"sub_categories":[],"readme":"# Overview\n\nHashiPOC stands for [Hashicorp](https://www.hashicorp.com/) Proof Of Concept. This example uses [Consul](https://www.consul.io/), [consul-template](https://github.com/hashicorp/consul-template),\n[Vault](https://www.vaultproject.io/), and [Nomad](https://www.nomadproject.io/) to deploy a sample python application, load balanced with haproxy.\n\n# Prerequisites\n\n* A working [Vagrant](https://www.vagrantup.com/) installation\n\n# Quickstart\n\nBring the vagrant instance up.\n\n```\nvagrant up\n```\n\nAt the end of the provisioning two instances of the python application will be running via nomad behind haproxy. Since port 80 is mapped locally\nat port 8080, you can curl the application locally:\n\n```\nwhile [ 1 ] ; do curl http://localhost:8080 ; sleep 1 ; done\n```\n\nAlternatively, you can  SSH into the vagrant instance and run the while loop there:\n\n```\nvagrant ssh -c 'while [ 1 ] ; do curl http://localhost ; sleep 1 ; done'\n```\n\nAlso installed is a [UI](https://github.com/jippi/hashi-ui) for viewing and manipulating consul and nomad. Point your browser at http://localhost:3000\n\n# Under the hood\n\nAfter bringing the Ubuntu Xenial instance up, shell-based provisioning happens.\n\n`base.sh` installs some basic tools: unzip, supervisor, virtualenv, pip, and\ninstalls a pip requirements file.\n\n`haproxy.sh` installs haproxy.\n\n`consul.sh`, `haproxy.sh`, `vault.sh`, `nomad.sh`, and `hashi-ui.sh` install those five packages with supervisor config files to manage their processes. Some vault token generation, policy generation, and secret creation also happens in `vault.sh`.\n\n`consul-template.sh` installs consul-template, which monitors service changes in consul and reconfigures and reloads haproxy accordingly.\n\n`dnsmasq.sh` exposes consul's DNS so that you can do `dig helloworld.service.consul +short SRV` instead of having to point at consul's\nDNS to do service discovery.\n\n`application.sh` initiates the nomad command to run the Hello World python code.\n\n# Doing a rolling upgrade\n\nThe nomad deployment (`files/helloworld.nomad` locally, `/vagrant/helloworld.nomad` on the vagrant instance) is configured to do a\nblue/green style release. Inside this file, change `\"v1\"` to `\"v2\"` on line 19. Keep a while loop curling localhost going in another window. Then execute `nomad run /vagrant/helloworld.nomad` on the vagrant instance. You'll see four instances of the application running instead of two (two of which will print out `v2`). If you execute a `nomad deployment list` and grab the deployment id, you can promote it with `nomad deployment promote \u003cID\u003e`. The old instances will go away, leaving the `v2` instances in place.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpete0emerson%2Fhashipoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpete0emerson%2Fhashipoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpete0emerson%2Fhashipoc/lists"}