forked from magfest/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
78 lines (61 loc) · 2.76 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
# -*- mode: ruby -*-
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.hostname = "mcp.magfest.info"
config.vm.network :forwarded_port, guest: 80, host: 8000 # traefik http proxy
config.vm.network :forwarded_port, guest: 443, host: 4443 # traefik https proxy
config.vm.synced_folder ".", "/srv/infrastructure", create: true
config.vm.synced_folder "secret", "/srv/data/secret", create: true
# No good can come from updating plugins.
# Plus, this makes creating Vagrant instances MUCH faster.
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
# This is the most amazing module ever, it caches anything you download with apt-get!
# To install it: vagrant plugin install vagrant-cachier
if Vagrant.has_plugin?("vagrant-cachier")
# Configure cached packages to be shared between instances of the same base box.
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
config.cache.scope = :box
end
config.vm.provider :virtualbox do |vb|
vb.memory = 1536
vb.cpus = 2
vb.name = 'infrastructure %s' % [Time.now.strftime('%Y-%m-%d %H:%M:%S.%L')]
# Allow symlinks to be created in /srv/infrastructure.
# Modify "srv_infrastructure" to be different if you change the path.
# NOTE: requires Vagrant to be run as administrator for this to work.
vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/srv_infrastructure", "1"]
end
config.vm.provision :shell, inline: <<-SHELL
set -e
# export DEBIAN_FRONTEND=noninteractive
# export DEBIAN_PRIORITY=critical
# sudo -E apt-get -qy update
# # Upgrade all packages to the latest version, very slow
# sudo -E apt-get -qy -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" upgrade
# sudo -E apt-get -qy autoclean
# sudo -E apt-get -qy -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install libssh-dev python-git swapspace
cat >> /etc/hosts << EOF
127.0.0.1 magfest.info
EOF
mkdir -p /etc/salt
cat >> /etc/salt/grains << EOF
env: dev
is_vagrant: True
private_interface: eth0
EOF
mkdir -p ~/.ssh
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts 2>&1
SHELL
config.vm.post_up_message = <<-MESSAGE
All done!
To login to your new development machine, run:
vagrant ssh
To bootstrap the machine, run the following command as root and follow the instructions:
SALT_ENV=dev /srv/infrastructure/bootstrap-mcp.sh
MESSAGE
end