Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | host_ip = "192.168.121.1" |
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 | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 8 | |
| 9 | $replace_dns = <<-SCRIPT |
| 10 | HOST_IP="$1" |
| 11 | rm -f /etc/resolv.conf # drop its dynamic management by systemd-resolved |
| 12 | echo nameserver "$HOST_IP" | tee /etc/resolv.conf |
| 13 | SCRIPT |
| 14 | |
| 15 | Vagrant.configure("2") do |config| |
| 16 | config.vm.box = "generic/ubuntu1804" |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 17 | config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile" |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame^] | 18 | config.vm.network "forwarded_port", guest: 6080, host: 6080 |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 19 | config.vm.provision "replace_dns", type: :shell, run: "always", inline: $replace_dns, args: host_ip |
| 20 | config.vm.provision "dependencies", type: :shell, inline: <<-SHELL |
| 21 | export DEBIAN_FRONTEND=noninteractive |
| 22 | apt-get update |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame^] | 23 | apt-get install --assume-yes --quiet golang tmux |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 24 | SHELL |
| 25 | config.vm.provision "binaries", type: :shell, privileged: false, inline: <<-SHELL |
| 26 | export GOPATH="${HOME}/go" |
| 27 | go get -u github.com/hound-search/hound/cmds/... |
| 28 | SHELL |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 29 | config.vm.provision "generate_config", type: :shell, privileged: false, inline: <<-SHELL |
Pawel Wieczorek | 049202b | 2020-01-07 15:28:54 +0100 | [diff] [blame^] | 30 | python3 #{synced_folder}/create_config.py > #{houndd_config} |
| 31 | SHELL |
| 32 | config.vm.provision "run_codesearch", type: :shell, privileged: false, inline: <<-SHELL |
| 33 | tmux new -d -s codesearch #{houndd_bin} -conf #{houndd_config} |
Pawel Wieczorek | 9ee1258 | 2020-01-07 15:26:52 +0100 | [diff] [blame] | 34 | SHELL |
Pawel Wieczorek | 09a6357 | 2019-12-17 15:33:06 +0100 | [diff] [blame] | 35 | end |