forked from fedora-infra/bodhi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
123 lines (101 loc) · 4.51 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# -*- mode: ruby -*-
# vi: set ft=ruby :
# On your host:
# git clone https://github.com/fedora-infra/bodhi.git
# cd bodhi
# cp devel/Vagrantfile.example Vagrantfile
# vagrant up
# There is also an option when provisioning to setup bodhi
# to use the fedora stg infratucture for koji and src.stg (for package acls)
# To use this, use the command:
#
# vagrant --use-staging up
#
# vagrant will prompt you for for fas username for auth to koji. Additionally
# after the box is finished, you will need to aquire a kerberos ticket periodically
# with `kinit <fasusername>@STG.FEDORAPROJECT.ORG` for bodhi to be able to auth with
# the stg koji.
require 'etc'
require 'getoptlong'
opts = GetoptLong.new(
[ '--use-staging', GetoptLong::OPTIONAL_ARGUMENT ]
)
use_staging_infra = false
opts.each do |opt, arg|
case opt
when '--use-staging'
use_staging_infra=true
end
end
if use_staging_infra
print "Enter your FAS username for krb auth to staging: "
fasusername = STDIN.gets.chomp
print "\n"
end
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/29/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-29-1.2.x86_64.vagrant-libvirt.box"
config.vm.box = "f29-cloud-libvirt"
config.vm.box_download_checksum = "30a58db024a5203fea0fee8fffcbc1998b3e6de787dbc504dc5c511b97c84777"
config.vm.box_download_checksum_type = "sha256"
# Forward traffic on the host to the development server on the guest.
# You can change the host port that is forwarded to 5000 on the guest
# if you have other services listening on your host's port 80.
config.vm.network "forwarded_port", guest: 6543, host: 6543
# Forward traffic on the host to the development waiverDB on the guest.
config.vm.network "forwarded_port", guest: 6544, host: 6544
# Forward traffic on the host to the development greenwave on the guest.
config.vm.network "forwarded_port", guest: 6545, host: 6545
# Forward traffic on the host to the RabbitMQ management UI on the guest.
# This allows developers to view message queues at http://localhost:15672/
config.vm.network "forwarded_port", guest: 15672, host: 15672
# This is an optional plugin that, if installed, updates the host's /etc/hosts
# file with the hostname of the guest VM. In Fedora it is packaged as
# ``vagrant-hostmanager``
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
end
# Vagrant can share the source directory using rsync, NFS, or SSHFS (with the vagrant-sshfs
# plugin). Consult the Vagrant documentation if you do not want to use SSHFS.
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/home/vagrant/bodhi", type: "sshfs"
# To cache update packages (which is helpful if frequently doing `vagrant destroy && vagrant up`)
# you can create a local directory and share it to the guest's DNF cache. Uncomment the lines below
# to create and use a dnf cache directory
#
# Dir.mkdir('.dnf-cache') unless File.exists?('.dnf-cache')
# config.vm.synced_folder ".dnf-cache", "/var/cache/dnf", type: "sshfs", sshfs_opts_append: "-o nonempty"
# Comment this line if you would like to disable the automatic update during provisioning
config.vm.provision "shell", inline: "sudo dnf upgrade -y"
# bootstrap and run with ansible
config.vm.provision "ansible" do |ansible|
ansible.playbook = "devel/ansible/playbook.yml"
# if vagrant is given a fas username, assume the user is using the stg infrastructure
if fasusername
ansible.extra_vars = {
staging_fas: fasusername,
use_staging_infra: true
}
end
end
# Create the bodhi dev box
config.vm.define "bodhi" do |bodhi|
bodhi.vm.host_name = "bodhi-dev.example.com"
bodhi.vm.provider :libvirt do |domain|
# Season to taste
domain.cpus = Etc.nprocessors
domain.cpu_mode = "host-passthrough"
domain.graphics_type = "spice"
# The unit tests use a lot of RAM.
domain.memory = 4096
domain.video_type = "qxl"
# Enable libvirt's unsafe cache
# mode. It is called unsafe for a reason, as it causes the virtual host to ignore all
# fsync() calls from the guest. Only do this if you are comfortable with the possibility of
# your development guest becoming corrupted (in which case you should only need to do a
# vagrant destroy and vagrant up to get a new one).
domain.volume_cache = "unsafe"
end
end
end