Skip to content
Snippets Groups Projects
Commit 2d2dd3c0 authored by Adam Mulvany's avatar Adam Mulvany
Browse files

Added yaml support with profiles

parent 8f392284
Branches
No related tags found
No related merge requests found
......@@ -5,27 +5,61 @@
[Vagrant 1.9+](https://www.vagrantup.com/downloads.html)
#### Usage
#### Configure
`VERSION=x.x.x EDITION="ee|ce" vagrant up`
i.e.
Data file gitlab-vagrant.yml contains profiles for each of your vagrant machines.
Name can be any parseable format, such as:
`VERSION=9.1.1 EDITION="ee" vagrant up`
gitlab-edition-version
gitlab-ticket-number
gitlab-date
Example:
The application will be available on http://localhost:version}. If the port is 3 digits add another 0, i.e. Version 9.1.1 will accessible from https://localhost:9110 on the host. This is to avoid running on a privileged port.
```
---
- name: gitlab-ee-latest
version: 9.1.1
edition: ee
host_port: 9110
- name: gitlab-ce-12345
version: 8.17.3
edition: ce
host_port: 8173
```
Make changes to this file and save.
For the following steps change name to the name of the machine in your profile, i.e. gitlab-ee-12345.
#### Provision
`vagrant up name`
#### Status
Show all running machines:
`vagrant global-status`
Show status of specific machine:
`vagrant status name`
#### Connect via SSH
If you need to SSH onto the guest VM then:
`VERSION=9.1.1 EDITION="ee" vagrant ssh`
`vagrant ssh name`
#### Cleanup
Once you are finished testing etc you can remove the VM with:
`VERSION=9.1.1 EDITION="ee" vagrant destroy`
`vagrant destroy name`
#### Reprovision
and recreate new VMs as you please using the above steps.
To reprovision an existing machine:
`vagrant up name --provision`
# -*- mode: ruby -*-
# vi: set ft=ruby :
ver = ENV['VERSION']
lic = ENV['EDITION']
lic = lic.downcase
# Specify minimum Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
#VAGRANTFILE_API_VERSION = "2"
get_package = "curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-#{lic}/script.deb.sh | sudo bash"
host_port = ver.gsub(/[\.]/,"") + "0"
# Require YAML module
require 'yaml'
gitlab_vagrant = YAML.load_file('gitlab-vagrant.yml')
Vagrant.configure("2") do |config|
gitlab_vagrant.each do |gitlab_vagrant|
name = gitlab_vagrant["name"]
version = gitlab_vagrant["version"]
edition = gitlab_vagrant["edition"]
host_port = gitlab_vagrant["host_port"]
config.vm.define name do |provision|
config.vm.box = "ubuntu/xenial64"
config.vm.network "forwarded_port", guest: 80, host: host_port[0..4],
config.vm.network "forwarded_port", guest: 80, host: host_port,
auto_correct: true
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end
config.vm.provision "shell", inline: <<-SHELL
sudo DEBIAN_FRONTEND=noninteractive apt-get install curl openssh-server ca-certificates postfix
#{get_package}
sudo apt-get install gitlab-#{lic}=#{ver}-#{lic}.0
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-#{edition}/script.deb.sh | sudo bash
sudo apt-get install gitlab-#{edition}=#{version}-#{edition}.0
sudo gitlab-ctl reconfigure
SHELL
end
end
end
---
- name: gitlab-ee-latest
version: 9.1.1
edition: ee
host_port: 9110
- name: gitlab-ce-12345
version: 8.17.3
edition: ce
host_port: 8173
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment