hashpi

所属分类:聚类算法
开发工具:Shell
文件大小:310KB
下载次数:0
上传日期:2017-07-24 05:27:57
上 传 者sh-1993
说明:  Rasberry Pi集群运行Hashicorp数据中心基础设施(游牧、保险库、领事)
(Rasberry Pi cluster running Hashicorp datacenter infrastructure (nomad, vault, consul))

文件列表:
LICENSE (11357, 2016-12-07)
ansible.cfg (74, 2016-12-07)
bootstrap.yml (597, 2016-12-07)
debug.yml (278, 2016-12-07)
docs (0, 2016-12-07)
docs\img (0, 2016-12-07)
docs\img\build-01.JPG (61371, 2016-12-07)
docs\img\build-02.JPG (89996, 2016-12-07)
docs\img\build-03.JPG (46060, 2016-12-07)
docs\img\build-04.JPG (94874, 2016-12-07)
docs\interfaces.md (1249, 2016-12-07)
group_vars (0, 2016-12-07)
group_vars\all (82, 2016-12-07)
inventory.ini (234, 2016-12-07)
roles (0, 2016-12-07)
roles\consul (0, 2016-12-07)
roles\consul\defaults (0, 2016-12-07)
roles\consul\defaults\main.yml (935, 2016-12-07)
roles\consul\files (0, 2016-12-07)
roles\consul\files\consul-acl-bootstrap.sh (275, 2016-12-07)
roles\consul\files\consul-destroy-install.sh (154, 2016-12-07)
roles\consul\files\consul-wait-for-leader.sh (281, 2016-12-07)
roles\consul\files\consul.service (461, 2016-12-07)
roles\consul\handlers (0, 2016-12-07)
roles\consul\handlers\main.yml (110, 2016-12-07)
roles\consul\tasks (0, 2016-12-07)
roles\consul\tasks\main.yml (3930, 2016-12-07)
roles\consul\templates (0, 2016-12-07)
roles\consul\templates\check-service-active.j2 (332, 2016-12-07)
roles\consul\templates\consul.json.j2 (936, 2016-12-07)
roles\dnsmasq (0, 2016-12-07)
roles\dnsmasq\defaults (0, 2016-12-07)
roles\dnsmasq\defaults\main.yml (97, 2016-12-07)
roles\dnsmasq\handlers (0, 2016-12-07)
roles\dnsmasq\handlers\main.yml (141, 2016-12-07)
roles\dnsmasq\tasks (0, 2016-12-07)
roles\dnsmasq\tasks\main.yml (1739, 2016-12-07)
... ...

# hashpi > Rasberry Pi rack running clustered Hashicorp datacenter infrastructure (nomad, vault, consul) + [Preamble](https://github.com/timperrett/hashpi/blob/master/#preamble) + [Hardware Buildout](https://github.com/timperrett/hashpi/blob/master/#hardware-buildout) + [Software Deployment](https://github.com/timperrett/hashpi/blob/master/#software-deployment) ## Preamble In order to follow along with this build, you would need to have the following components and tools available to you: ### Hardware Shopping List + 1x [GearRobot Case](https://github.com/timperrett/hashpi/blob/master/https://www.amazon.com/gp/product/B00MYFAAPO/) + 1x [DualComm 5-Port Switch (USB Powered)](https://github.com/timperrett/hashpi/blob/master/https://www.amazon.com/gp/product/B002BSA7GG/) + 4x [Raspberry Pi 3 Model B Motherboard](https://github.com/timperrett/hashpi/blob/master/https://www.amazon.com/gp/product/B01CD5VC92/) + 4x [16GB SDHC cards](https://github.com/timperrett/hashpi/blob/master/https://www.amazon.com/gp/product/B004G605OA/) + 1x [Anker 5-Port powered USB hub](https://github.com/timperrett/hashpi/blob/master/https://www.amazon.com/gp/product/B00VH8ZW02/) + 1x [16x2 LCD screen](https://github.com/timperrett/hashpi/blob/master/https://www.adafruit.com/products/181) + 1x [i2c / SPI LCD backpack](https://github.com/timperrett/hashpi/blob/master/https://www.adafruit.com/product/292) + 1x [Male to Female Jumper Wires](https://github.com/timperrett/hashpi/blob/master/https://www.google.com/shopping/product/12597180957004446265) + 4x small Cat5e cable (typically you make these, but you can buy pre-made ones if you want) + 4x [USB-B to USB-micro converter](https://github.com/timperrett/hashpi/blob/master/https://www.google.com/shopping/product/13932993478778087101). These are for AC power to the motherboard from the hub. ### Tools Required + 1x Soldering Iron + 1x pack of solder (leaded or lead-free, either will work) + 1x [Crimping Tool](https://github.com/timperrett/hashpi/blob/master/https://www.amazon.com/gp/product/B002D3B97U/) + 1x pair of thin, long-nose pliers (these are useful for the case build) + 1x case of minature / precision screwdrivers (e.g. [these](https://github.com/timperrett/hashpi/blob/master/http://www.homedepot.com/p/TEKTON-Precision-Screwdriver-Set-6-Piece-2***5/207096248?cm_mmc=Shopping%7cTHD%7cG%7c0%7cG-BASE-PLA-D25T-HandTools%7c&gclid=CjwKEAiA94nCBRDxismumrL83icSJAAeeETQQSkzNXpnq7FmWWAG6wa_VkhktpHDJ_dErC8Cn7cvIBoC7VHw_wcB&gclsrc=aw.ds) or [these](https://github.com/timperrett/hashpi/blob/master/http://www.firemountaingems.com/itemdetails/H201579TL?engine=google&campaign=[ADL]+[Non-Brand]+[PLA]+[Shopping]&adgroup=[PLA]+[Shopping]+Best+Sellers&kwid=productads-adid^113207974204-device^c-plaid^6152***66819-sku^H201579TL-adType^PLA)) ## Hardware Buildout + Assemble the motherboards with the case (instructions from the case). ![stage 1](https://github.com/timperrett/hashpi/blob/master/https://raw.githubusercontent.com/timperrett/hashpi/master/docs/img/build-01.JPG) ![stage 2](https://github.com/timperrett/hashpi/blob/master/https://raw.githubusercontent.com/timperrett/hashpi/master/docs/img/build-02.JPG) + Cut and crimp the nessicary ethernet cables needed to connect the motherboards to the switch. Choose a scheme (A or B, but stick to just one): ![cat5](https://github.com/timperrett/hashpi/blob/master/http://cdn.instructables.com/FDR/2Z0W/FPKFCZ0Q/FDR2Z0WFPKFCZ0Q.MEDIUM.gif) + Connect the USB power cords and the network cables to the motherboards. ![stage 3](https://github.com/timperrett/hashpi/blob/master/https://raw.githubusercontent.com/timperrett/hashpi/master/docs/img/build-03.JPG) + If you're having issues with the motherboard, there are two LEDs indicate status. Explanations for which can be [found here](https://github.com/timperrett/hashpi/blob/master/http://raspberrypi.stackexchange.com/questions/246***/what-do-the-leds-on-the-b-mean). + Now its time to attach the i2pc backpack to the LCD. There's a decent tutorial [over here](https://github.com/timperrett/hashpi/blob/master/https://learn.adafruit.com/i2c-spi-lcd-backpack), but you absolutely need to know how to solder and use the aforementioned tools (never a better time to learn this stuff that the present!). ![stage 4](https://github.com/timperrett/hashpi/blob/master/https://raw.githubusercontent.com/timperrett/hashpi/master/docs/img/build-04.JPG) ## Software Deployment These instructions assume you are running *Raspbian Lite*, Jesse or later (this requires [systemd](https://github.com/timperrett/hashpi/blob/master/https://www.freedesktop.org/wiki/Software/systemd/)). You can download [Raspbian Lite from here](https://github.com/timperrett/hashpi/blob/master/https://www.raspberrypi.org/downloads/raspbian/), and I would strongly recomend checking out resin.io [Ether](https://github.com/timperrett/hashpi/blob/master/https://etcher.io/) for a quick and convenient way to flash your SD cards from OSX, with the vanilla Raspbian image you are downloading. There is a set of initial setup that must be done manually to get the Pi's accessible remotely (and availalbe for automatic provisioning). I used the following steps to get the nodes going: ``` # set a new root password $ sudo passwd root # set your the password for the `pi` user $ sudo passwd pi $ sudo reboot # update the system, disable avahi and bluetooth $ sudo systemctl enable ssh && \ sudo systemctl start ssh # optionally install a few useful utilities $ sudo apt-get install -y htop ``` Now we have our four Pi's running SSH and have disabled the features we wont be using in this cluster build out (e.g. bluetooth). Now we are ready to deploy the bulk of the software! This repo makes use of [Ansible](https://github.com/timperrett/hashpi/blob/master/https://www.ansible.com/) as its provisioning system; in order to automate the vast majority of operations we conduct on the cluster. This makes them repeatable and testable. Please checkout the Ansible documentation if you are not familiar with the tool. #### Bootstrap Playbook The bootstrap playbook setups up core functionality so that we can run more complicated playbooks on the Pis themselves, and also get access to the cluster nodes without having to SSH with an explicit username and password (add your key to the `user` roles `vars` file). After first turning on the cluster and enabling SSH, the following should be executed in the root of the repository: ``` ./bootstrap.yml ``` This mainly kills avahai-daemon and several other processes we will not be needing, going forward. #### Site Playbook Once you've bootstrapped your cluster and you can SSH into the nodes with your key, then we can simply run the ansible site plays, and let it install all the nessicary gubbins. ``` ./site.yml ``` Any other time you update the cluster using the `site.yml` playbook, be sure to run with the following option: ``` ./site.yml --skip-tags=consul-servers,bootstrap ``` This will ensure that the consul servers used to corrdinate everything don't get screwed up during the deployment of new software. This set of playbooks installs the following software (in order). + Debugging Utils (htop, nslookup, telnet etc) + [Consul](https://github.com/timperrett/hashpi/blob/master/https://www.consul.io/) (runs on 3 nodes as a quorum) + [Vault](https://github.com/timperrett/hashpi/blob/master/https://www.vaultproject.io/) (uses Consul as its secure backend; runs on rpi01) + [Nomad](https://github.com/timperrett/hashpi/blob/master/https://www.nomadproject.io/) (only rpi01 has the `server` component of Nomad installed) + [Prometheus](https://github.com/timperrett/hashpi/blob/master/https://prometheus.io) (only runs on rpi01) + [Grafana](https://github.com/timperrett/hashpi/blob/master/http://grafana.org/) + [Docker](https://github.com/timperrett/hashpi/blob/master/https://docker.com/) Whilst the setup is vastly automated, there are a few manual steps. When first installing Vault, there is a set of keys that are generated which cannot be automated away, because they are required for vault initialization. The steps to first setup the vault are [documented in this blog post](https://github.com/timperrett/hashpi/blob/master/https://www.vaultproject.io/intro/getting-started/deploy.html) but the TL;DR is: ``` $ ssh pi@ $ export VAULT_ADDR="http://`ip -4 route get 8.8.8.8 | awk '{print $7}' | xargs echo -n`:8200" $ vault init # be sure to keep the generated keys in a safe place, and absolutely do not check them in anywhere! $ vault -tls-skip-verify unseal ``` Given this is just a local raspberry pi cluster, I'm not fussing around with SSL as its a development cluster for me. I do however really, really recommend that you use SSL on this thing - or anything else for that matter - that is the best practice can self-signed certs can be easily generated and provided to vault. See the documentation for more information on that.

近期下载者

相关文件


收藏者