Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kelseyhightower/hashiconf-eu-2016
HashiConf EU 2016
https://github.com/kelseyhightower/hashiconf-eu-2016
Last synced: 3 months ago
JSON representation
HashiConf EU 2016
- Host: GitHub
- URL: https://github.com/kelseyhightower/hashiconf-eu-2016
- Owner: kelseyhightower
- Created: 2016-06-12T06:36:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-08T14:53:59.000Z (about 8 years ago)
- Last Synced: 2024-04-26T06:32:32.733Z (7 months ago)
- Language: Shell
- Size: 236 KB
- Stars: 106
- Watchers: 7
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-nomad - kelseyhightower/hashiconf-eu-2016 - Repo from a talk on building out a deployment with GCE/Consul/Nomad/Fabio loadbalancer. Check out the talk on youtube: https://www.youtube.com/watch?v=Nosa5-xcATw (Tutorials)
README
# HashiConf EU 2016
## Prerequisites
[Bootstrap the HashiStack on Google Compute Engine](hashistack.md)
Login into the controller node and checkout this repository.
```
gcloud compute ssh ns-1
``````
git clone https://github.com/kelseyhightower/hashiconf-eu-2016.git
``````
cd hashiconf-eu-2016
```### Create the Hashiapp Policy and Token
```
vault policy-write hashiapp vault/hashiapp-policy.hcl
``````
vault token-create \
-policy="hashiapp" \
-display-name="hashiapp"
```Edit `jobs/hashiapp.nomad` job
```
env {
VAULT_TOKEN = "HASHIAPP_TOKEN"
VAULT_ADDR = "http://vault.service.consul:8200"
HASHIAPP_DB_HOST = "CLOUD_SQL:3306"
}
```### Create the Hashiapp Secret
```
vault read mysql/creds/hashiapp
``````
vault write secret/hashiapp jwtsecret=secret
```## Service Discovery with Consul
```
nomad plan jobs/consul.nomad
``````
nomad run jobs/consul.nomad
``````
nomad status consul
``````
consul join nc-1 nc-2 nc-3 nc-4 nc-5
``````
consul members
```## Hashiapp Job
Submit the hashiapp service job.
```
nomad run jobs/hashiapp.nomad
``````
nomad status hashiapp
```#### Viewing Logs
```
nomad fs -job hashiapp alloc/logs/hashiapp.stderr.0
nomad fs -job hashiapp alloc/logs/hashiapp.stdout.0
```## Load Balancing with Fabio
run curl on a private intance
```
nomad run jobs/fabio.nomad
``````
nomad status fabio
```#### Send Traffic
```
curl -H "Host: hashiapp.com" http://:9999/version
``````
while true; do curl -H "Host: hashiapp.com" http://:9999/version; sleep 1; done
```### Scaling Up
Edit `jobs/hashiapp.nomad`
```
count = 5
``````
nomad plan jobs/hashiapp.nomad
``````
nomad run jobs/hashiapp.nomad
```### Rolling Upgrades
Edit `jobs/hashiapp.nomad`
```
source = "https://storage.googleapis.com/hashistack/hashiapp/v2.0.0/hashiapp"
checksum = "sha256:372ddaeb9ac97a2eecd7dd3307bd32f8b0c188d47239f7ef6790609f9a157ca4"
``````
nomad plan jobs/hashiapp.nomad
``````
nomad run jobs/hashiapp.nomad
```