aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/codesearch/Vagrantfile
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/codesearch/Vagrantfile')
-rw-r--r--bootstrap/codesearch/Vagrantfile40
1 files changed, 40 insertions, 0 deletions
diff --git a/bootstrap/codesearch/Vagrantfile b/bootstrap/codesearch/Vagrantfile
new file mode 100644
index 000000000..ba2339d0c
--- /dev/null
+++ b/bootstrap/codesearch/Vagrantfile
@@ -0,0 +1,40 @@
+# -*- mode: ruby -*-
+# -*- coding: utf-8 -*-
+
+nameserver = "8.8.8.8"
+synced_folder = "/vagrant"
+houndd_bin = "${HOME}/go/bin/houndd"
+houndd_config = "${HOME}/config.json"
+onap_git = "git.onap.org"
+
+$replace_dns = <<-SCRIPT
+ ns="$1"
+ # persist resolver settings
+ sed -i "s/addresses:.*/addresses: [${ns}]/" /etc/netplan/01-netcfg.yaml
+ # setup resolver for current boot session
+ resolvectl dns eth0 ${ns}
+SCRIPT
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "generic/ubuntu2004"
+ config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile"
+ config.vm.network "forwarded_port", guest: 6080, host: 6080
+ config.vm.provision "replace_dns", type: :shell, inline: $replace_dns, args: nameserver
+ config.vm.provision "dependencies", type: :shell, inline: <<-SHELL
+ export DEBIAN_FRONTEND=noninteractive
+ apt-get update
+ apt-get install --assume-yes --quiet golang tmux
+ SHELL
+ config.vm.provision "binaries", type: :shell, privileged: false, inline: <<-SHELL
+ export GOPATH="${HOME}/go"
+ go get -u github.com/hound-search/hound/cmds/...
+ SHELL
+ config.vm.provision "generate_config", type: :shell do |s|
+ s.privileged = false
+ s.inline = "python3 #{synced_folder}/create_config.py --git ${1} > #{houndd_config}"
+ s.args = [onap_git]
+ end
+ config.vm.provision "run_codesearch", type: :shell, run: "always", privileged: false, inline: <<-SHELL
+ tmux new -d -s codesearch #{houndd_bin} -conf #{houndd_config}
+ SHELL
+end