mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-06-28 16:47:46 +02:00
f2e1b4ac80
- Change consists of two deployment models: - Using Vagrant(single node, with/without docker) - Using Ansible(single node, with/without docker) - Updated quickstart documentation. - Some WIP comments, which will be addressed later. Depending on the requirements.
56 lines
1.9 KiB
Ruby
56 lines
1.9 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
# Required modules
|
|
require 'yaml'
|
|
|
|
# Minimum Requirements
|
|
Vagrant.require_version '>= 1.6.0'
|
|
VAGRANTFILE_API_VERSION = '2'
|
|
|
|
# Configuration files
|
|
CONFIGURATION_FILE = 'config/bdb-config.yaml'
|
|
|
|
# Validate if all the required plugins are present
|
|
required_plugins = ["vagrant-cachier"]
|
|
required_plugins.each do |plugin|
|
|
if not Vagrant.has_plugin?(plugin)
|
|
raise "Required vagrant plugin #{plugin} not found. Please run `vagrant plugin install #{plugin}`"
|
|
end
|
|
end
|
|
|
|
# Read configuration file(s)
|
|
instances_config = YAML.load_file(File.join(File.dirname(__FILE__), CONFIGURATION_FILE))
|
|
|
|
#TODO: (muawiakh) Add support for Docker, AWS, Azure
|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
instances_config.each do |instance|
|
|
config.vm.define instance['name'] do |bdb|
|
|
# Workaround until vagrant cachier plugin supports dnf
|
|
if !(instance["box"]["name"].include? "fedora")
|
|
if Vagrant.has_plugin?("vagrant-cachier")
|
|
config.cache.scope = :box
|
|
end
|
|
end
|
|
bdb.vm.hostname = instance["name"]
|
|
bdb.vm.network instance["network"]["type"], ip: instance["network"]["ip"]
|
|
bdb.vm.box = instance["box"]["name"]
|
|
bdb.vm.synced_folder ".", "/bigchaindb"
|
|
bdb.vm.provision :shell, inline: "cd /bigchaindb/scripts;/bin/bash #{instance["upstart"]}"
|
|
if instance["setup_type"] == "quickstart"
|
|
bdb.vm.provision :shell, inline: "PYTHONBUFFERED=1 ansible-playbook \
|
|
/bigchaindb/ansible/quickstart.yml --extra-vars \"with_docker=#{instance["deploy_docker"]}\" -c local"
|
|
end
|
|
|
|
bdb.vm.provider 'vmware_fusion' do |vmwf, override|
|
|
vmwf.vmx['memsize'] = instance["ram"]
|
|
vmwf.vmx['numvcpus'] = instance['vcpus']
|
|
end
|
|
|
|
bdb.vm.provider 'virtualbox' do |vb, override|
|
|
vb.memory = instance["ram"]
|
|
vb.cpus = instance['vcpus']
|
|
end
|
|
end
|
|
end
|
|
end |