WIP: Vagrant
This commit is contained in:
parent
184a54ebbd
commit
fc46cd1b25
4 changed files with 161 additions and 2 deletions
|
@ -19,3 +19,20 @@ Also, please verify that you have enough file descriptors available to
|
||||||
your user processes. The output of `ulimit -n` should report at least
|
your user processes. The output of `ulimit -n` should report at least
|
||||||
4,000 file descriptors available. If your limit is lower (a frequent
|
4,000 file descriptors available. If your limit is lower (a frequent
|
||||||
problem for OS X users), please increase it to at least 4,000.
|
problem for OS X users), please increase it to at least 4,000.
|
||||||
|
|
||||||
|
# Using Vagrant to set up a developer environment for Machi
|
||||||
|
|
||||||
|
The Machi source directory contains a `Vagrantfile` for creating an
|
||||||
|
Ubuntu Linux-based virtual machine for compiling and running Machi.
|
||||||
|
This file is in the
|
||||||
|
[$SRC_TOP/priv/humming-consensus-demo.vagrant](../priv/humming-consensus-demo.vagrant)
|
||||||
|
directory.
|
||||||
|
|
||||||
|
If used as-is, the virtual machine specification is modest.
|
||||||
|
|
||||||
|
* 1 virtual CPU
|
||||||
|
* 512MB virtual memory
|
||||||
|
* 768MB swap space
|
||||||
|
* 79GB sparse virtual disk image. After installing prerequisites and
|
||||||
|
compiling Machi, the root file system uses approximately 2.7 GBytes.
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,11 @@ Please refer to the
|
||||||
[Machi development environment prerequisites doc](./dev-prerequisites.md)
|
[Machi development environment prerequisites doc](./dev-prerequisites.md)
|
||||||
for Machi developer environment prerequisites.
|
for Machi developer environment prerequisites.
|
||||||
|
|
||||||
|
If you do not have an Erlang/OTP runtime system available, but you do
|
||||||
|
have [the Vagrant virtual machine](https://www.vagrantup.com/) manager
|
||||||
|
available, then please refer to the instructions in the prerequisites
|
||||||
|
doc for using Vagrant.
|
||||||
|
|
||||||
<a name="clone-compile">
|
<a name="clone-compile">
|
||||||
## Clone and compile the code
|
## Clone and compile the code
|
||||||
|
|
||||||
|
@ -72,8 +77,8 @@ three file servers participating in the chain. Thanks to the
|
||||||
hostnames that we added to `/etc/hosts`, all are using the localhost
|
hostnames that we added to `/etc/hosts`, all are using the localhost
|
||||||
network interface.
|
network interface.
|
||||||
|
|
||||||
| App instance | Hostname | FLU name | TCP port |
|
| App instance | Pseudo | FLU name | TCP port |
|
||||||
| directory | | | number |
|
| directory | Hostname | | number |
|
||||||
|--------------+----------+----------+----------|
|
|--------------+----------+----------+----------|
|
||||||
| dev1 | machi1 | flu1 | 20401 |
|
| dev1 | machi1 | flu1 | 20401 |
|
||||||
| dev2 | machi2 | flu2 | 20402 |
|
| dev2 | machi2 | flu2 | 20402 |
|
||||||
|
|
56
priv/humming-consensus-demo.setup.sh
Executable file
56
priv/humming-consensus-demo.setup.sh
Executable file
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Step: Verify that the required entries in /etc/hosts are present"
|
||||||
|
for i in 1 2 3; do
|
||||||
|
grep machi$i /etc/hosts | egrep -s '^127.0.0.1' > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "'grep -s machi$i' failed. Aborting, sorry."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
ping -c 1 machi$i > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Ping attempt on host machi$i failed. Aborting."
|
||||||
|
echo ""
|
||||||
|
ping -c 1 machi$i
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Step: add a verbose logging option to app.config"
|
||||||
|
for i in 1 2 3; do
|
||||||
|
ed ./dev/dev$i/etc/app.config <<EOF > /dev/null 2>&1
|
||||||
|
/verbose_confirm
|
||||||
|
a
|
||||||
|
{chain_manager_opts, [{private_write_verbose_confirm,true}]},
|
||||||
|
{stability_time, 1},
|
||||||
|
.
|
||||||
|
w
|
||||||
|
q
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Step: start three three Machi application instances"
|
||||||
|
for i in 1 2 3; do
|
||||||
|
./dev/dev$i/bin/machi start
|
||||||
|
./dev/dev$i/bin/machi ping
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Sorry, a 'ping' check for instance dev$i failed. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Step: configure one chain to start a Humming Consensus group with three members"
|
||||||
|
|
||||||
|
# Note: $CWD of each Machi proc is two levels below the source code root dir.
|
||||||
|
LIFECYCLE000=../../priv/quick-admin-examples/demo-000
|
||||||
|
for i in 3 2 1; do
|
||||||
|
./dev/dev$i/bin/machi-admin quick-admin-apply $LIFECYCLE000 machi$i
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Sorry, 'machi-admin quick-admin-apply failed' on machi$i. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
81
priv/humming-consensus-demo.vagrant/Vagrantfile
vendored
Normal file
81
priv/humming-consensus-demo.vagrant/Vagrantfile
vendored
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||||
|
# configures the configuration version (we support older styles for
|
||||||
|
# backwards compatibility). Please don't change it unless you know what
|
||||||
|
# you're doing.
|
||||||
|
Vagrant.configure(2) do |config|
|
||||||
|
# The most common configuration options are documented and commented below.
|
||||||
|
# For a complete reference, please see the online documentation at
|
||||||
|
# https://docs.vagrantup.com.
|
||||||
|
|
||||||
|
# Every Vagrant development environment requires a box. You can search for
|
||||||
|
# boxes at https://atlas.hashicorp.com/search.
|
||||||
|
# If this Vagrant box has not been downloaded before (e.g. using "vagrant box add"),
|
||||||
|
# then Vagrant will automatically download the VM image from HashiCorp.
|
||||||
|
config.vm.box = "hashicorp/precise64"
|
||||||
|
|
||||||
|
# Disable automatic box update checking. If you disable this, then
|
||||||
|
# boxes will only be checked for updates when the user runs
|
||||||
|
# `vagrant box outdated`. This is not recommended.
|
||||||
|
# config.vm.box_check_update = false
|
||||||
|
|
||||||
|
# Create a forwarded port mapping which allows access to a specific port
|
||||||
|
# within the machine from a port on the host machine. In the example below,
|
||||||
|
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||||
|
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||||
|
|
||||||
|
# Create a private network, which allows host-only access to the machine
|
||||||
|
# using a specific IP.
|
||||||
|
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||||
|
|
||||||
|
# Create a public network, which generally matched to bridged network.
|
||||||
|
# Bridged networks make the machine appear as another physical device on
|
||||||
|
# your network.
|
||||||
|
# config.vm.network "public_network"
|
||||||
|
|
||||||
|
# Share an additional folder to the guest VM. The first argument is
|
||||||
|
# the path on the host to the actual folder. The second argument is
|
||||||
|
# the path on the guest to mount the folder. And the optional third
|
||||||
|
# argument is a set of non-required options.
|
||||||
|
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||||
|
|
||||||
|
# Provider-specific configuration so you can fine-tune various
|
||||||
|
# backing providers for Vagrant. These expose provider-specific options.
|
||||||
|
# Example for VirtualBox:
|
||||||
|
#
|
||||||
|
config.vm.provider "virtualbox" do |vb|
|
||||||
|
# Display the VirtualBox GUI when booting the machine
|
||||||
|
# vb.gui = true
|
||||||
|
|
||||||
|
# Customize the amount of memory on the VM:
|
||||||
|
vb.memory = "512"
|
||||||
|
end
|
||||||
|
#
|
||||||
|
# View the documentation for the provider you are using for more
|
||||||
|
# information on available options.
|
||||||
|
|
||||||
|
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
||||||
|
# such as FTP and Heroku are also available. See the documentation at
|
||||||
|
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
||||||
|
# config.push.define "atlas" do |push|
|
||||||
|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Enable provisioning with a shell script. Additional provisioners such as
|
||||||
|
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||||
|
# documentation for more information about their specific syntax and use.
|
||||||
|
config.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo apt-get install -y git
|
||||||
|
git clone https://github.com/slfritchie/slf-configurator.git
|
||||||
|
chown -R vagrant ./slf-configurator
|
||||||
|
(cd slf-configurator ; sudo sh -x ./ALL.sh)
|
||||||
|
echo 'export PATH=${PATH}:/usr/local/erlang/17.5/bin' >> ~vagrant/.bashrc
|
||||||
|
export PATH=${PATH}:/usr/local/erlang/17.5/bin
|
||||||
|
|
||||||
|
git clone https://github.com/basho/machi.git
|
||||||
|
(cd machi ; git checkout master ; make test 2>&1 | tee RUNLOG.0)
|
||||||
|
chown -R vagrant ./machi
|
||||||
|
SHELL
|
||||||
|
end
|
Loading…
Reference in a new issue