This repository was archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathVagrantfile
More file actions
63 lines (53 loc) · 2.52 KB
/
Vagrantfile
File metadata and controls
63 lines (53 loc) · 2.52 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Copyright (c) 2013-2017 Tuomo Tanskanen <tuomo@tanskanen.org>
# read configurable cpu/memory/port/swap/host/edition settings from environment variables
memory = ENV['GITLAB_MEMORY'] || 3072
cpus = ENV['GITLAB_CPUS'] || 2
port = ENV['GITLAB_PORT'] || 8443
swap = ENV['GITLAB_SWAP'] || 0
host = ENV['GITLAB_HOST'] || "gitlab.local"
edition = ENV['GITLAB_EDITION'] || "community"
private_network = ENV['GITLAB_PRIVATE_NETWORK'] || 0
Vagrant.require_version ">= 1.8.0"
Vagrant.configure("2") do |config|
config.vm.define :gitlab do |config|
# Configure some hostname here
config.vm.hostname = host
# bento/ubuntu-18.04 provides boxes for virtualbox. vmware_desktop(fusion, workstation) and parallels
config.vm.box = "bento/ubuntu-18.04"
config.vm.provision :shell, :path => "install-gitlab.sh",
env: { "GITLAB_SWAP" => swap, "GITLAB_HOSTNAME" => host, "GITLAB_PORT" => port, "GITLAB_EDITION" => edition }
# On Linux, we cannot forward ports <1024
# We need to use higher ports, and have port forward or nginx proxy
# or access the site via hostname:<port>, in this case 127.0.0.1:8080
# By default, Gitlab is at https + port 8443
config.vm.network :forwarded_port, guest: 443, host: port
config.vm.network "private_network", type: "dhcp" if private_network == '1'
# use rsync for synced folder to avoid the need for provider tools
# added rsync__auto to enable detect changes on host and sync to guest machine and exclude .git/
config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/", rsync__auto: true
end
# GitLab recommended specs
config.vm.provider "virtualbox" do |v|
v.cpus = cpus
v.memory = memory
end
# vmware Workstation and Fusion Provider this will work for both vmware versions as the virtual machines
# images are identical is a fuzzy term which will allow both to work effecively for ether Fusion for the
# Mac or Workstation for the PC. It only matters which provider is specified on vagrant up command
# (--provider=vmware_fusion or --provider=vmware_workstation)
# vmware provieder requires hashicorp license https://www.vagrantup.com/vmware/index.html
config.vm.provider "vmware_desktop" do |v|
v.vmx["memsize"] = "#{memory}"
v.vmx["numvcpus"] = "#{cpus}"
end
config.vm.provider "parallels" do |v|
v.cpus = cpus
v.memory = memory
end
# TODO: This is outdated 16.04 box
config.vm.provider "lxc" do |v, override|
override.vm.box = "developerinlondon/ubuntu_lxc_xenial_x64"
end
end