sintonia/Vagrantfile

134 lines
3.9 KiB
Ruby
Raw Normal View History

2017-03-03 15:45:04 +01:00
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Tweak guest CPUS and MEMORY using:
# export VAGRANT_NO_PORT_FORWARDING=true
# export VAGRANT_CPUS=4
# export VAGRANT_MEMORY=4096
2022-03-29 14:25:34 +02:00
# vagrant up buster
#
2017-03-03 15:45:04 +01:00
Vagrant.configure('2') do |config|
if ! ENV.fetch('VAGRANT_NO_PORT_FORWARDING', 'false') == 'true'
config.vm.network 'forwarded_port', guest: 8080, host: 8080 # web
config.vm.network 'forwarded_port', guest: 8081, host: 8081 # api
config.vm.network 'forwarded_port', guest: 8000, host: 8000 # icecast2
config.vm.network 'forwarded_port', guest: 8001, host: 8001 # liquidsoap
config.vm.network 'forwarded_port', guest: 8002, host: 8002 # liquidsoap
config.vm.network 'forwarded_port', guest: 5432, host: 5432 # database
end
2017-03-03 15:45:04 +01:00
config.vm.provider 'virtualbox' do |v|
v.cpus = ENV.fetch('VAGRANT_CPUS', 2)
v.memory = ENV.fetch('VAGRANT_MEMORY', 1024)
# Enable audio drivers on VM settings
# See https://github.com/geoffreyplitt/vagrant-audio
if RUBY_PLATFORM =~ /darwin/
v.customize [
'modifyvm', :id,
'--audio', 'coreaudio',
'--audiocontroller', 'hda' # choices: hda sb16 ac97
]
elsif RUBY_PLATFORM =~ /mingw|mswin|bccwin|cygwin|emx/
v.customize [
'modifyvm', :id,
'--audio', 'dsound',
'--audiocontroller', 'ac97'
]
end
2017-03-07 12:18:34 +01:00
end
config.vm.provider 'libvirt' do |v|
v.cpus = ENV.fetch('VAGRANT_CPUS', 2)
v.memory = ENV.fetch('VAGRANT_MEMORY', 1024)
2021-09-21 10:39:23 +02:00
end
# NFS
def setup_nfs(config, nfs_version = nil)
config.vm.network 'private_network', ip: '192.168.10.100'
nfs_path = '.'
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
# NFS macOS support
if Dir.exist?('/System/Volumes/Data')
nfs_path = '/System/Volumes/Data' + Dir.pwd
end
# See https://www.vagrantup.com/docs/synced-folders/nfs#nfs-synced-folder-options
case
when nfs_version.nil? then config.vm.synced_folder nfs_path, '/vagrant', type: 'nfs'
when nfs_version == 4 then config.vm.synced_folder nfs_path, '/vagrant', type: 'nfs',
nfs_version: 4,
nfs_udp: false
else
raise 'Invalid nfs_version provided'
end
end
def setup_libretime(config, prepare_script, install_args = '')
config.vm.provision 'prepare',
type: 'shell',
path: 'installer/vagrant/%s' % prepare_script
$script = <<-SCRIPT
set -e
cd /vagrant
LIBRETIME_POSTGRESQL_PASSWORD=libretime \
bash install \
--listen-port 8080 \
--allow-restart \
--in-place \
http://192.168.10.100:8080
libretime-api migrate
libretime-api set_icecast_passwords --from-icecast-config
systemctl start libretime.target
SCRIPT
config.vm.provision 'install', type: 'shell', inline: $script
config.vm.provision 'post-install',
type: 'shell',
path: 'installer/vagrant/post-install.sh'
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
end
# Define all the OS boxes we support
2022-03-29 14:25:34 +02:00
config.vm.define "focal" do |os|
os.vm.box = "bento/ubuntu-20.04"
2021-11-08 09:12:00 +01:00
setup_libretime(os, "debian.sh")
end
2022-03-29 14:25:34 +02:00
config.vm.define 'bionic' do |os|
os.vm.box = 'bento/ubuntu-18.04'
setup_nfs(config)
setup_libretime(os, 'debian.sh')
end
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
2022-03-29 14:25:34 +02:00
config.vm.define 'bullseye' do |os|
os.vm.box = 'debian/bullseye64'
config.vm.provider 'virtualbox' do |v, override|
override.vm.box = 'bento/debian-11'
end
setup_nfs(config, 4)
setup_libretime(os, 'debian.sh')
end
2022-03-29 14:25:34 +02:00
config.vm.define 'buster' do |os|
os.vm.box = 'debian/buster64'
config.vm.provider 'virtualbox' do |v, override|
override.vm.box = 'bento/debian-10'
end
setup_nfs(config)
setup_libretime(os, 'debian.sh')
Vagrant Debian support (and experimental CentOS) This changes the Vagrant setup to support multiple installations as multiple boxes. In addition to Ubuntu Vagrant can now be used to install on Debian as well as on CentOS. I took the chance to clean up the .deb install a bit and backported analyzer and celery to SysV proper so it runs there. Some of the distro specfics were moved to the install script from the python setup scripts to acheive this. For the CentOS support I added a rather involved OS prepare script. In the long term this will be added to the preparing-the-server docs we already have. I had to switch the default port to http-alt (8080). On CentOS 9080 is registered for ocsp and getting it to work for apache without hacking SELinux is hard. I think 8080 is the RFC way to go anyhow. If anyone want to override this it should be rather easy using the --web-port arg and by hacking Vagrantfile. The PyOpenSSL code has been refactored for all the distros that the Vagrantfile now supports. As far as my checks go, I tried this code with all the distros, uploaded a track and downloaded a unicode and a ssl podcast and was able to listen to them in each case. In the experimental CentOS case, the UI is not up to spec since services need to get scheduled through systemctl and the status overview (ie. on the /?config page) do not work properly. They need to be as follows: ``` sudo systemctl start airtime-playout sudo systemctl start airtime-liquidsoap sudo systemctl start airtime_analyzer.service sudo systemctl start airtime-celery.service ```
2017-03-08 12:39:59 +01:00
end
2017-03-03 15:45:04 +01:00
config.vm.define 'centos' do |os|
os.vm.box = 'centos/8'
setup_nfs(config)
setup_libretime(os, 'centos.sh', '--selinux')
end
2017-03-03 15:45:04 +01:00
end