forked from Lexxie9952/fcw.org-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
81 lines (64 loc) · 3.21 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
# coding: iso-8859-1
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Freeciv-web Vagrant Vagrantfile - play.freeciv.org
# 2014-02-17 - Andreas Røsdal
#
# Run 'vagrant up' in this directory, which will create a VirtualBox image
# and install Freeciv-web for you.
# Then point your browser to http://localhost/ on your host OS.
#
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu-bionic-64"
config.vm.provider "virtualbox"
config.vm.box_url = "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-vagrant.box"
if Vagrant::Util::Platform.windows?
config.vm.network :forwarded_port, guest: 80, host: 80, host_ip: "127.0.0.1"
config.vm.network :forwarded_port, guest: 443, host: 443, host_ip: "127.0.0.1"
else
config.vm.network :private_network, ip: "10.11.12.13"
config.vm.network :forwarded_port, guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.network :forwarded_port, guest: 443, host: 8443, host_ip: "127.0.0.1"
end
config.vm.provider "virtualbox" do |v|
v.cpus = "1"
host = RbConfig::CONFIG['host_os']
# Give VM 50% of system memory
if host =~ /darwin/
# sysctl returns Bytes and we need to convert to MB
mem = `sysctl -n hw.memsize`.to_i / 1024
elsif host =~ /linux/
# meminfo shows KB and we need to convert to MB
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i
elsif host =~ /mswin|mingw|cygwin/
# Windows code via https://github.com/rdsubhas/vagrant-faster
mem = `wmic computersystem Get TotalPhysicalMemory`.split[1].to_i / 1024
end
mem = mem / 1024 / 2
v.customize ["modifyvm", :id, "--memory", mem.floor]
# Disable serial port. It is unnecessary, and may cause error on Win10
# https://github.com/joelhandwell/ubuntu_vagrant_boxes/issues/1#issuecomment-292370353
v.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
if Vagrant::Util::Platform.windows?
config.vm.synced_folder "./", "/vagrant"
else
config.vm.synced_folder "./", "/vagrant", type: "nfs",
mount_options: ['rw', 'vers=3', 'tcp', 'nolock'],
linux__nfs_options: ['rw','no_subtree_check','all_squash','async']
end
config.vm.boot_timeout = 100000
# There are problems with the default configuration of a DNS stub in some
# versions of systemd-resolved
config.vm.provision "systemd-resolved workaround", type: "shell", inline: "ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf"
# run the Freeciv bootstrap script on machine creation
config.vm.provision "bootstrap", type: "shell", inline: "/vagrant/scripts/install/install.sh --mode=TEST", privileged: false
# run the Freeciv start script on startup
config.vm.provision "startup", type: "shell", inline: "/vagrant/scripts/start-freeciv-web.sh", run: "always", privileged: false
end