sintonia/Vagrantfile

80 lines
2.9 KiB
Ruby
Raw Normal View History

2017-03-03 15:45:04 +01:00
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# libretime web interface
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
config.vm.network "forwarded_port", guest: 8080, host:8080
# icecast2
config.vm.network "forwarded_port", guest: 8000, host:8000
# liquidsoap input harbors for instreaming (ie. /master)
config.vm.network "forwarded_port", guest: 8001, host:8001
config.vm.network "forwarded_port", guest: 8002, host:8002
# mkdocs documentation
2017-03-03 15:45:04 +01:00
config.vm.network "forwarded_port", guest: 8888, host:8888
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
# make sure we are using nfs (doesn't work out of the box with debian)
config.vm.synced_folder ".", "/vagrant", type: "nfs"
# private network for nfs
config.vm.network "private_network", ip: "192.168.10.100"
2017-03-07 12:18:34 +01:00
config.vm.provider "virtualbox" do |v|
# to run without OOMing we need at least 1GB of RAM
v.memory = 1024
# enable audio drivers on VM settings
# pinched from https://github.com/GeoffreyPlitt/vagrant-audio
config.vm.provider :virtualbox do |vb|
if RUBY_PLATFORM =~ /darwin/
vb.customize ["modifyvm", :id, '--audio', 'coreaudio', '--audiocontroller', 'hda'] # choices: hda sb16 ac97
elsif RUBY_PLATFORM =~ /mingw|mswin|bccwin|cygwin|emx/
vb.customize ["modifyvm", :id, '--audio', 'dsound', '--audiocontroller', 'ac97']
end
end
2017-03-07 12:18:34 +01:00
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
# default installer args used for all distros
installer_args="--force --in-place --verbose --postgres --apache --icecast "
# define all the OS boxes we support
config.vm.define "ubuntu-bionic" do |os|
os.vm.box = "bento/ubuntu-18.04"
provision_libretime(os, "ubuntu.sh", installer_args)
end
config.vm.define "ubuntu-xenial" do |os|
os.vm.box = "bento/ubuntu-16.04"
Installer auto-detects distro, portable system init The theme of this commit is to make the install process more resiliant to differences in distros by testing for specific features or versions of executables rather than making as many assumptions just on the distro and release. * Distro and Release detection (install, Vagrantfile) - Added detection logic for distro and release based on /etc/os-release which is available on all potential supported distros. The --distribution and --release options can be used to override detection. - Added distro and release checks to ensure values specified are for a supported release. - Changed some distro checks to use booleans, e.g. if $is_centos_7; then ... - Added a simple check so if --distribution is specified, it will ensure it's at least sane, e.g. centos on debian or debian on centos will be caught. - In Vagrantfile, removed --distribution and --release options for all distro and release combinations. * Portable Init System Detection and Management (install, centos.sh) - Added detection logic for init system type - systemd, Upstart or System V in the function systemInitDetect(). - Added portable init system install in the function systemInitInstall() which depends on systemInitDetect(). After installing files, enables and starts service. - Added portable init system commands in the function systemInitCommand() for start, stop, reload, restart and status. - Python services don't support systemd but unconditionally install scripts for both Upstart and System V. Disabled by passing --no-init-script to setup.py for each service. - When upgrading, remove all old system init files in /etc/init, /etc/init.d, /etc/default and /etc/systemd/system. - In centos.sh, removed install of airtime systemd service files as it's now handled by install. - Created an Upstart .conf for airtime-celery - In systemd file for airtime-celery, changed absolute path to /usr/local/bin/celery and for centos, the install symlinks celery to /usr/local/bin. * External Dependencies Install (install) - For external dependencies, only attempt to install for Debian- based distros with apt-get. For centos, a warning is displayed. - For systems with apt-get, detect version and if 1.1 or greater, use new force options, otherwise use --force-yes option. * Configuring Apache (install) - For Apache, check for centos and use httpd for binary and service, otherwise use apache2ctl and apache2. - Detect Apache version 2 or better in a more reliable manner. - Detect Apache root folder and conf file name by running apache2ctl -V or httpd -V as appropriate. - Various checks for centos as it doesn't support the Debian Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc. * Installing Airtime Services (install) - Detect Python version. If less than 2.7.9, install OpenSSL support. - Prevent installing init files by passing --no-init-script to setup.py for each service. - Use systemInitInstall to install, enable and start each service after setup.py has run. - Removed filtering for WEB_USER for files in /etc/init/airtime*.template as that is handled in the systemInitInstall() function. * Configuring PHP in Apache (install) - Detect PHP conf folder by checking a list of locations rather than making assumptions based on the distro and release. * Configuring PostgreSQL (install) - Detects if the airtime user has already been created. If not, then creates the user. * Installing Locales (install) - Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
provision_libretime(os, "ubuntu.sh", installer_args)
end
config.vm.define "ubuntu-trusty" do |os|
STDERR.puts 'WARNING: The "ubuntu-trusty" option is deprecated. Please migrate to "ubuntu-bionic".'
STDERR.puts
os.vm.box = "bento/ubuntu-14.04"
Installer auto-detects distro, portable system init The theme of this commit is to make the install process more resiliant to differences in distros by testing for specific features or versions of executables rather than making as many assumptions just on the distro and release. * Distro and Release detection (install, Vagrantfile) - Added detection logic for distro and release based on /etc/os-release which is available on all potential supported distros. The --distribution and --release options can be used to override detection. - Added distro and release checks to ensure values specified are for a supported release. - Changed some distro checks to use booleans, e.g. if $is_centos_7; then ... - Added a simple check so if --distribution is specified, it will ensure it's at least sane, e.g. centos on debian or debian on centos will be caught. - In Vagrantfile, removed --distribution and --release options for all distro and release combinations. * Portable Init System Detection and Management (install, centos.sh) - Added detection logic for init system type - systemd, Upstart or System V in the function systemInitDetect(). - Added portable init system install in the function systemInitInstall() which depends on systemInitDetect(). After installing files, enables and starts service. - Added portable init system commands in the function systemInitCommand() for start, stop, reload, restart and status. - Python services don't support systemd but unconditionally install scripts for both Upstart and System V. Disabled by passing --no-init-script to setup.py for each service. - When upgrading, remove all old system init files in /etc/init, /etc/init.d, /etc/default and /etc/systemd/system. - In centos.sh, removed install of airtime systemd service files as it's now handled by install. - Created an Upstart .conf for airtime-celery - In systemd file for airtime-celery, changed absolute path to /usr/local/bin/celery and for centos, the install symlinks celery to /usr/local/bin. * External Dependencies Install (install) - For external dependencies, only attempt to install for Debian- based distros with apt-get. For centos, a warning is displayed. - For systems with apt-get, detect version and if 1.1 or greater, use new force options, otherwise use --force-yes option. * Configuring Apache (install) - For Apache, check for centos and use httpd for binary and service, otherwise use apache2ctl and apache2. - Detect Apache version 2 or better in a more reliable manner. - Detect Apache root folder and conf file name by running apache2ctl -V or httpd -V as appropriate. - Various checks for centos as it doesn't support the Debian Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc. * Installing Airtime Services (install) - Detect Python version. If less than 2.7.9, install OpenSSL support. - Prevent installing init files by passing --no-init-script to setup.py for each service. - Use systemInitInstall to install, enable and start each service after setup.py has run. - Removed filtering for WEB_USER for files in /etc/init/airtime*.template as that is handled in the systemInitInstall() function. * Configuring PHP in Apache (install) - Detect PHP conf folder by checking a list of locations rather than making assumptions based on the distro and release. * Configuring PostgreSQL (install) - Detects if the airtime user has already been created. If not, then creates the user. * Installing Locales (install) - Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
provision_libretime(os, "ubuntu.sh", installer_args)
end
config.vm.define "debian-jessie" do |os|
os.vm.box = "bento/debian-8.7"
Installer auto-detects distro, portable system init The theme of this commit is to make the install process more resiliant to differences in distros by testing for specific features or versions of executables rather than making as many assumptions just on the distro and release. * Distro and Release detection (install, Vagrantfile) - Added detection logic for distro and release based on /etc/os-release which is available on all potential supported distros. The --distribution and --release options can be used to override detection. - Added distro and release checks to ensure values specified are for a supported release. - Changed some distro checks to use booleans, e.g. if $is_centos_7; then ... - Added a simple check so if --distribution is specified, it will ensure it's at least sane, e.g. centos on debian or debian on centos will be caught. - In Vagrantfile, removed --distribution and --release options for all distro and release combinations. * Portable Init System Detection and Management (install, centos.sh) - Added detection logic for init system type - systemd, Upstart or System V in the function systemInitDetect(). - Added portable init system install in the function systemInitInstall() which depends on systemInitDetect(). After installing files, enables and starts service. - Added portable init system commands in the function systemInitCommand() for start, stop, reload, restart and status. - Python services don't support systemd but unconditionally install scripts for both Upstart and System V. Disabled by passing --no-init-script to setup.py for each service. - When upgrading, remove all old system init files in /etc/init, /etc/init.d, /etc/default and /etc/systemd/system. - In centos.sh, removed install of airtime systemd service files as it's now handled by install. - Created an Upstart .conf for airtime-celery - In systemd file for airtime-celery, changed absolute path to /usr/local/bin/celery and for centos, the install symlinks celery to /usr/local/bin. * External Dependencies Install (install) - For external dependencies, only attempt to install for Debian- based distros with apt-get. For centos, a warning is displayed. - For systems with apt-get, detect version and if 1.1 or greater, use new force options, otherwise use --force-yes option. * Configuring Apache (install) - For Apache, check for centos and use httpd for binary and service, otherwise use apache2ctl and apache2. - Detect Apache version 2 or better in a more reliable manner. - Detect Apache root folder and conf file name by running apache2ctl -V or httpd -V as appropriate. - Various checks for centos as it doesn't support the Debian Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc. * Installing Airtime Services (install) - Detect Python version. If less than 2.7.9, install OpenSSL support. - Prevent installing init files by passing --no-init-script to setup.py for each service. - Use systemInitInstall to install, enable and start each service after setup.py has run. - Removed filtering for WEB_USER for files in /etc/init/airtime*.template as that is handled in the systemInitInstall() function. * Configuring PHP in Apache (install) - Detect PHP conf folder by checking a list of locations rather than making assumptions based on the distro and release. * Configuring PostgreSQL (install) - Detects if the airtime user has already been created. If not, then creates the user. * Installing Locales (install) - Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
provision_libretime(os, "debian.sh", installer_args)
end
2017-11-13 16:42:11 +01:00
config.vm.define "debian-stretch" do |os|
os.vm.box = "bento/debian-9.6"
2017-11-13 16:42:11 +01:00
provision_libretime(os, "debian.sh", installer_args)
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
config.vm.define "centos" do |os|
os.vm.box = 'centos/7'
Installer auto-detects distro, portable system init The theme of this commit is to make the install process more resiliant to differences in distros by testing for specific features or versions of executables rather than making as many assumptions just on the distro and release. * Distro and Release detection (install, Vagrantfile) - Added detection logic for distro and release based on /etc/os-release which is available on all potential supported distros. The --distribution and --release options can be used to override detection. - Added distro and release checks to ensure values specified are for a supported release. - Changed some distro checks to use booleans, e.g. if $is_centos_7; then ... - Added a simple check so if --distribution is specified, it will ensure it's at least sane, e.g. centos on debian or debian on centos will be caught. - In Vagrantfile, removed --distribution and --release options for all distro and release combinations. * Portable Init System Detection and Management (install, centos.sh) - Added detection logic for init system type - systemd, Upstart or System V in the function systemInitDetect(). - Added portable init system install in the function systemInitInstall() which depends on systemInitDetect(). After installing files, enables and starts service. - Added portable init system commands in the function systemInitCommand() for start, stop, reload, restart and status. - Python services don't support systemd but unconditionally install scripts for both Upstart and System V. Disabled by passing --no-init-script to setup.py for each service. - When upgrading, remove all old system init files in /etc/init, /etc/init.d, /etc/default and /etc/systemd/system. - In centos.sh, removed install of airtime systemd service files as it's now handled by install. - Created an Upstart .conf for airtime-celery - In systemd file for airtime-celery, changed absolute path to /usr/local/bin/celery and for centos, the install symlinks celery to /usr/local/bin. * External Dependencies Install (install) - For external dependencies, only attempt to install for Debian- based distros with apt-get. For centos, a warning is displayed. - For systems with apt-get, detect version and if 1.1 or greater, use new force options, otherwise use --force-yes option. * Configuring Apache (install) - For Apache, check for centos and use httpd for binary and service, otherwise use apache2ctl and apache2. - Detect Apache version 2 or better in a more reliable manner. - Detect Apache root folder and conf file name by running apache2ctl -V or httpd -V as appropriate. - Various checks for centos as it doesn't support the Debian Apache utilities a2ensite/a2dissite, a2enmod/a2dismod, etc. * Installing Airtime Services (install) - Detect Python version. If less than 2.7.9, install OpenSSL support. - Prevent installing init files by passing --no-init-script to setup.py for each service. - Use systemInitInstall to install, enable and start each service after setup.py has run. - Removed filtering for WEB_USER for files in /etc/init/airtime*.template as that is handled in the systemInitInstall() function. * Configuring PHP in Apache (install) - Detect PHP conf folder by checking a list of locations rather than making assumptions based on the distro and release. * Configuring PostgreSQL (install) - Detects if the airtime user has already been created. If not, then creates the user. * Installing Locales (install) - Minor changes to check for centos and prevent from running.
2017-04-28 17:00:50 +02:00
provision_libretime(os, "centos.sh", installer_args + "--selinux")
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
def provision_libretime(config, prepare_script, installer_args)
# Prepare OS
config.vm.provision "prepare", type: "shell", path: "installer/vagrant/%s" % prepare_script
# Provision LibreTime
config.vm.provision "install", type: "shell", inline: "cd /vagrant; ./install %s --web-port=8080" % installer_args
# Provision docs
config.vm.provision "install-mkdocs", type: "shell", path: "docs/scripts/install.sh"
config.vm.provision "start-mkdocs", type: "shell", path: "docs/scripts/serve.sh"
end
2017-03-03 15:45:04 +01:00
end