Skip to content

Instantly share code, notes, and snippets.

@bish0polis
Created December 15, 2022 19:21
Show Gist options
  • Save bish0polis/312f9deaa56cba77109b51eb1e23822d to your computer and use it in GitHub Desktop.
Save bish0polis/312f9deaa56cba77109b51eb1e23822d to your computer and use it in GitHub Desktop.
vagrantfile for building snipe-it and installing locally
# -*- mode: ruby -*-
# vi: set ft=ruby :
$repos = <<-REPOS
yum-config-manager --add-repo=https://rpms.remirepo.net/enterprise/7/remi/x86_64/ # no typo
yum-config-manager --save --setopt=rpms.remirepo.net_enterprise_7_remi_x86_64_.installpkgs=composer
yum upgrade -y --skip-broken
REPOS
$prep = <<-PREP
yum install -y rpm-build rpmdevtools
# chicken-egg with remi-release - what's our EL8 emulant?
yum install -y composer --nogpgcheck
yum install -y php-pdo php-gd # fix those missing deps in the next package
wget -cP /vagrant/ https://download.copr.fedorainfracloud.org/results/bishopolis/misc/epel-8-x86_64/05145995-snipe-it/snipe-it-5.3.10-2.el8.src.rpm
PREP
$build = <<-BUILD
sudo -iu vagrant rpm -i /vagrant/snipe-it-*.src.rpm
yum builddep -y `sudo -iu vagrant rpm --eval '%_specdir'`/snipe-it.spec #yarly
sudo -iu vagrant sh -c 'rpmbuild -bb $(rpm --eval "%_specdir")/snipe-it.spec'
BUILD
$install = <<-INST
yum install -y $(sudo -iu vagrant rpm --eval '%_rpmdir')/noarch/snipe-it*rpm
chkconfig httpd on
service httpd start
INST
Vagrant.configure("2") do |config|
config.vm.box = "generic/rocky8"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 443, host: 8443
config.vm.provider "virtualbox" do |vb|
vb.linked_clone = true
vb.memory = "1024"
vb.cpus = 2
end
config.vm.provision "shell", inline: $repos
config.vm.provision "shell", inline: $prep
config.vm.provision "shell", inline: $build
config.vm.provision "shell", inline: $install
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment