From a01da6d96a5f0c060033c0fb3d2f5997aa0cd94e Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 28 Dec 2016 14:46:35 -0800 Subject: [PATCH] load a local build into vagrant based on env var --- demo/vagrant/Vagrantfile | 27 +++++++++++++++++++++++---- demo/vagrant/cloud-config.yml.in | 12 +++--------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/demo/vagrant/Vagrantfile b/demo/vagrant/Vagrantfile index 2a2b0dc80..378a29960 100644 --- a/demo/vagrant/Vagrantfile +++ b/demo/vagrant/Vagrantfile @@ -26,10 +26,23 @@ require 'open-uri' if File.exists?('.discovery-token') token = IO.readlines(".discovery-token")[0..-1].join else - token = open($new_discovery_url).read + discovery_token = open($new_discovery_url).read File.open(".discovery-token", 'w') { |file| file.write("#{token}") } end +private_build = false +if ENV["START_LOCAL_ROOKD"] == "1" + private_build = true +end + +if private_build + aci_location = "/release/quay.io-rook-rookd-dev.aci" + aci_options = "--insecure-options=image" +else + aci_location = "quay.io/rook/rookd:latest" + aci_options = "" +end + Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| set_coreos_box(config, $channel) @@ -40,11 +53,17 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| attach_volumes(node, $node_disks, $disk_size) - # enable if you want to run for locally build ACI files - #node.vm.synced_folder "../../release", "/release", id: "release", :nfs => true, :mount_options => ['nolock,vers=3,tcp'] + if private_build + # run locally built ACI files + node.vm.synced_folder "../../release", "/release", id: "release", :nfs => true, :mount_options => ['nolock,vers=3,tcp'] + end node.vm.provision :cloud_config, :template => "cloud-config.yml.in", - :subst => { "%%token%%" => "#{token}" } + :subst => { + "%%discovery_token%%" => "#{discovery_token}", + "%%aci_location%%" => "#{aci_location}", + "%%aci_options%%" => "#{aci_options}" + } end end end diff --git a/demo/vagrant/cloud-config.yml.in b/demo/vagrant/cloud-config.yml.in index 900e676d9..064d948df 100644 --- a/demo/vagrant/cloud-config.yml.in +++ b/demo/vagrant/cloud-config.yml.in @@ -7,13 +7,6 @@ coreos: - name: rookd.service enable: true command: start -# enable if you want to run from locally built ACI files -# drop-ins: -# - name: 10-local-aci.conf -# content: | -# [Service] -# Environment=ROOKD_ACI=/release/quay.io-rook-rookd-dev.aci -# Environment=RKT_OPTIONS=--insecure-options=image content: | [Unit] Description=Rook Daemon - software defined storage @@ -25,11 +18,12 @@ coreos: Restart=always KillMode=process - Environment=ROOKD_ACI=quay.io/rook/rookd:latest + Environment=RKT_OPTIONS=%%aci_options%% + Environment=ROOKD_ACI=%%aci_location%% Environment=ROOKD_PUBLIC_IPV4=$public_ipv4 Environment=ROOKD_PRIVATE_IPV4=$private_ipv4 Environment=ROOKD_DATA_DIR=/var/lib/rook - Environment=ROOKD_DISCOVERY_URL=%%token%% + Environment=ROOKD_DISCOVERY_URL=%%discovery_token%% Environment=ROOKD_DATA_DEVICES=sda,sdb,sdc,sdd ExecStartPre=/usr/bin/mkdir -p ${ROOKD_DATA_DIR}