blob: 0407a57b5d85ebab8b8f9adaed26ef24cab4c8a2 [file] [log] [blame]
Pawel Wieczorek09a63572019-12-17 15:33:06 +01001# -*- mode: ruby -*-
2# -*- coding: utf-8 -*-
3
4host_ip = "192.168.121.1"
Pawel Wieczorek9ee12582020-01-07 15:26:52 +01005synced_folder = "/vagrant"
Pawel Wieczorek049202b2020-01-07 15:28:54 +01006houndd_bin = "${HOME}/go/bin/houndd"
7houndd_config = "${HOME}/config.json"
Pawel Wieczorek09a63572019-12-17 15:33:06 +01008
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
13SCRIPT
14
15Vagrant.configure("2") do |config|
16 config.vm.box = "generic/ubuntu1804"
Pawel Wieczorek9ee12582020-01-07 15:26:52 +010017 config.vm.synced_folder ".", synced_folder, type: "rsync", rsync__exclude: "Vagrantfile"
Pawel Wieczorek049202b2020-01-07 15:28:54 +010018 config.vm.network "forwarded_port", guest: 6080, host: 6080
Pawel Wieczorek09a63572019-12-17 15:33:06 +010019 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 Wieczorek049202b2020-01-07 15:28:54 +010023 apt-get install --assume-yes --quiet golang tmux
Pawel Wieczorek09a63572019-12-17 15:33:06 +010024 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 Wieczorek9ee12582020-01-07 15:26:52 +010029 config.vm.provision "generate_config", type: :shell, privileged: false, inline: <<-SHELL
Pawel Wieczorek049202b2020-01-07 15:28:54 +010030 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 Wieczorek9ee12582020-01-07 15:26:52 +010034 SHELL
Pawel Wieczorek09a63572019-12-17 15:33:06 +010035end