forked from maxmind/geolite2-ws-blogpost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
36 lines (29 loc) · 1.18 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
Vagrant.configure(2) do |config|
config.vm.box = 'ubuntu/focal64'
config.trigger.before :up do |t|
t.ruby do
unless ENV.has_key?('MM_ACCOUNT_ID') && ENV['MM_ACCOUNT_ID'] && ENV.has_key?('MM_LICENSE_KEY') && ENV['MM_LICENSE_KEY']
raise 'The MM_ACCOUNT_ID and MM_LICENSE_KEY env vars must be defined. Please define them before running "vagrant up".'
end
end
t.ignore = [:destroy, :halt]
end
config.vm.provision 'shell', inline: <<-SHELL
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php8.0 php8.0-curl unzip
SHELL
config.vm.provision 'shell', privileged: false, inline: <<-SHELL
if ! grep -c MM_ACCOUNT_ID /home/vagrant/.profile; then
echo export MM_ACCOUNT_ID="#{ENV['MM_ACCOUNT_ID']}" >> /home/vagrant/.profile
fi
if ! grep -q MM_LICENSE_KEY /home/vagrant/.profile; then
echo export MM_LICENSE_KEY="#{ENV['MM_LICENSE_KEY']}" >> /home/vagrant/.profile
fi
cd /vagrant
curl -sS https://getcomposer.org/installer | php
php composer.phar require geoip2/geoip2:~2.0
SHELL
config.vm.network "forwarded_port", guest: 9595, host: 9595
end