Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
Bartek Grzybowski | c017090 | 2021-07-13 13:02:07 +0200 | [diff] [blame^] | 4 | nameserver = "8.8.8.8" |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 5 | synced_folder = "/vagrant" |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame] | 6 | houndd_bin = "${HOME}/go/bin/houndd" |
| 7 | houndd_config = "${HOME}/config.json" |
Pawel Wieczorek | 8c7373d | 2020-01-07 15:28:55 +0100 | [diff] [blame] | 8 | onap_git = "git.onap.org" |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 9 | |
| 10 | $replace_dns = <<-SCRIPT |
Bartek Grzybowski | c017090 | 2021-07-13 13:02:07 +0200 | [diff] [blame^] | 11 | ns="$1" |
| 12 | # persist resolver settings |
| 13 | sed -i "s/addresses:.*/addresses: [${ns}]/" /etc/netplan/01-netcfg.yaml |
| 14 | # setup resolver for current boot session |
| 15 | resolvectl dns eth0 ${ns} |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 16 | SCRIPT |
| 17 | |
| 18 | Vagrant.configure("2") do |config| |
Bartek Grzybowski | 98118d8 | 2021-07-01 13:37:34 +0200 | [diff] [blame] | 19 | config.vm.box = "generic/ubuntu2004" |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 20 | config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile" |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame] | 21 | config.vm.network "forwarded_port", guest: 6080, host: 6080 |
Bartek Grzybowski | c017090 | 2021-07-13 13:02:07 +0200 | [diff] [blame^] | 22 | config.vm.provision "replace_dns", type: :shell, inline: $replace_dns, args: nameserver |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 23 | config.vm.provision "dependencies", type: :shell, inline: <<-SHELL |
| 24 | export DEBIAN_FRONTEND=noninteractive |
| 25 | apt-get update |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame] | 26 | apt-get install --assume-yes --quiet golang tmux |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 27 | SHELL |
| 28 | config.vm.provision "binaries", type: :shell, privileged: false, inline: <<-SHELL |
| 29 | export GOPATH="${HOME}/go" |
| 30 | go get -u github.com/hound-search/hound/cmds/... |
| 31 | SHELL |
Pawel Wieczorek | 8c7373d | 2020-01-07 15:28:55 +0100 | [diff] [blame] | 32 | config.vm.provision "generate_config", type: :shell do |s| |
| 33 | s.privileged = false |
Bartek Grzybowski | 1663d8c | 2021-07-12 13:57:23 +0200 | [diff] [blame] | 34 | s.inline = "python3 #{synced_folder}/create_config.py --git ${1} > #{houndd_config}" |
| 35 | s.args = [onap_git] |
Pawel Wieczorek | 8c7373d | 2020-01-07 15:28:55 +0100 | [diff] [blame] | 36 | end |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame] | 37 | config.vm.provision "run_codesearch", type: :shell, privileged: false, inline: <<-SHELL |
| 38 | tmux new -d -s codesearch #{houndd_bin} -conf #{houndd_config} |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 39 | SHELL |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 40 | end |