This repository has been archived by the owner on Jul 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Vagrantfile
109 lines (93 loc) · 2.61 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.4.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if ENV["KONG_PATH"]
source = ENV["KONG_PATH"]
elsif File.directory?("./kong")
source = "./kong"
elsif File.directory?("../kong")
source = "../kong"
else
source = ""
end
if ENV["KONG_PLUGIN_PATH"]
plugin_source = ENV["KONG_PLUGIN_PATH"]
elsif File.directory?("./kong-plugin")
plugin_source = "./kong-plugin"
elsif File.directory?("../kong-plugin")
plugin_source = "../kong-plugin"
else
plugin_source = ""
end
if ENV['KONG_VB_MEM']
memory = ENV["KONG_VB_MEM"]
else
memory = 4096
end
if ENV["KONG_NGINX_WORKER_PROCESSES"]
cpus = ENV["KONG_NGINX_WORKER_PROCESSES"]
else
cpus = 2
end
if ENV["KONG_VERSION"]
version = ENV["KONG_VERSION"]
else
version = "3.3.1"
end
if ENV["KONG_CASSANDRA"]
cversion = ENV["KONG_CASSANDRA"]
if not cversion == "2"
if not cversion == "3"
raise "KONG_CASSANDRA must be either 2 or 3"
end
end
else
# set a default, 3.x, or for Kong < 0.10 then 2.x
cversion = "3"
v = version.split('.')
if v[0].strip.to_i == 0
if v[1].strip.to_i < 10
cversion = "2"
end
end
end
if ENV["KONG_UTILITIES"]
utils = "1"
else
utils = ""
end
if ENV["KONG_ANONYMOUS_REPORTS"]
anreports = ENV["KONG_ANONYMOUS_REPORTS"]
else
anreports = ""
end
if ENV["KONG_LOG_LEVEL"]
loglevel = ENV["KONG_LOG_LEVEL"]
else
loglevel = ""
end
config.vm.provider :virtualbox do |vb|
vb.name = "vagrant_kong"
vb.memory = memory
vb.cpus = cpus
vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/ — timesync-set-threshold", 10000]
end
config.vm.box = "generic/ubuntu2004"
if not source == ""
config.vm.synced_folder source, "/kong"
end
if not plugin_source == ""
config.vm.synced_folder plugin_source, "/kong-plugin"
end
config.vm.network :forwarded_port, guest: 8000, host: 8000
config.vm.network :forwarded_port, guest: 8001, host: 8001
config.vm.network :forwarded_port, guest: 8443, host: 8443
config.vm.network :forwarded_port, guest: 8444, host: 8444
config.vm.network :forwarded_port, guest: 9000, host: 9000 # only used with TCP stream proxy with Kong >= 0.15.0
config.vm.network :forwarded_port, guest: 5432, host: 65432
config.vm.provision "shell", path: "provision.sh",
env: { "HTTP_PROXY": ENV["HTTP_PROXY"], "HTTPS_PROXY": ENV["HTTPS_PROXY"]},
:args => [version, cversion, utils, anreports, loglevel]
end