From 8ed1dce4b11cdc5e98f34e0e05f9e90e903a5eeb Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Mon, 6 Mar 2017 12:03:11 +0100
Subject: [PATCH 01/13] Install airtime in vagrant env

Uses the old installer to get LibreTime installed quick and dirty on vagrant.

It uses the `install -fIap` command that does a local install and points the apache config
directly to the local working copy mounted in /vagrant.

While we don't have fancy autoloading for libretime like the docs do, this way
it's already easy to work against a local branch.

I'm not sure if the `-I` arg to the installer also covers the python parts of libretime.
---
 Vagrantfile   | 2 ++
 docs/index.md | 2 ++
 install       | 9 +++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 628fe3c35..8f4b84c86 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -5,8 +5,10 @@ Vagrant.configure("2") do |config|
 
   config.vm.box = "ubuntu/trusty64"
 
+  config.vm.network "forwarded_port", guest:   80, host:8080
   config.vm.network "forwarded_port", guest: 8888, host:8888
 
+  config.vm.provision "shell", inline: "cd /vagrant; ./install -fIap"
   config.vm.provision "shell", path: "docs/scripts/install.sh"
   config.vm.provision "shell", path: "docs/scripts/serve.sh"
 
diff --git a/docs/index.md b/docs/index.md
index 6dfb154c2..66bd2740f 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -22,4 +22,6 @@ The easiest way to check out LibreTime for yourself is to run a local instance i
     cd libretime
     vagrant up
 
+If everything works out, you will find LibreTime on [port 8080](http://localhost:8080) and the docs on [port 8888](http://localhost:8888).
+
 Of course, this setup isn't appropriate for production use. For that, check out our [installation instructions](install.md).
diff --git a/install b/install
index ea5b70f75..b668296c4 100755
--- a/install
+++ b/install
@@ -305,11 +305,17 @@ if [ "$ignore_dependencies" = "f" ]; then
     else
         loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install $(grep -vE '^\s*#' ${SCRIPT_DIR}/installer/lib/requirements-ubuntu-trusty.apt | tr '\n' ' ')"
     fi
+    if [ "$in_place" = "t" ]; then
+        loudCmd "DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install git"
+    fi
     set -e
 else
     checkCommandExists "apache2"
     checkCommandExists "rabbitmqctl"
     checkCommandExists "psql"
+    if [ "$in_place" = "t" ]; then
+        checkCommandExists "git"
+    fi
 fi
 
 # Check if composer exists and install if it doesn't
@@ -606,8 +612,7 @@ if [ ! -d "/etc/airtime" ]; then
 
     verbose "\n * Creating /etc/airtime/ directory..."
     mkdir /etc/airtime
-    verbose "\n * Creating /etc/airtime-saas/ directory..."
-    # Default saas directory for the analyzer, cloud storage, and celery
+    # workaround for reintegrated airtime-saas dir, will get removed after we refactored config loading
     ln -s /etc/airtime/ /etc/airtime/production
     # put the default cloud_storage.conf using local file storage into directory
     cp ${AIRTIMEROOT}/airtime_mvc/build/cloud_storage.conf /etc/airtime/cloud_storage.conf

From e394df83a5709459df61163f68b9982f0c2ee80d Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 12:18:34 +0100
Subject: [PATCH 02/13] Grab 1GB of memory on vagrant

---
 Vagrantfile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Vagrantfile b/Vagrantfile
index 8f4b84c86..9ef861488 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -8,6 +8,11 @@ Vagrant.configure("2") do |config|
   config.vm.network "forwarded_port", guest:   80, host:8080
   config.vm.network "forwarded_port", guest: 8888, host:8888
 
+  config.vm.provider "virtualbox" do |v|
+    # to run without OOMing we need at least 1GB of RAM
+    v.memory = 1024
+  end
+
   config.vm.provision "shell", inline: "cd /vagrant; ./install -fIap"
   config.vm.provision "shell", path: "docs/scripts/install.sh"
   config.vm.provision "shell", path: "docs/scripts/serve.sh"

From 354f449b82cdb4767c7ca47a31c55333d77b3ba7 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 12:19:55 +0100
Subject: [PATCH 03/13] Update docs to reflect we need more RAM in 2017

---
 docs/manual/preparing-the-server/index.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/manual/preparing-the-server/index.md b/docs/manual/preparing-the-server/index.md
index 5f6083314..6e7ba5660 100644
--- a/docs/manual/preparing-the-server/index.md
+++ b/docs/manual/preparing-the-server/index.md
@@ -6,7 +6,7 @@ The following instructions assume that you have root access (**sudo** on Ubuntu)
 
 The recommended Airtime server platform is Debian 7.2 'wheezy'. Ubuntu 12.04 LTS 'Precise Pangolin' is also supported. Users of other GNU/Linux distributions may be able to adapt these instructions to suit their needs.
 
-The server should have at least a 1GHz processor and 512MB of RAM, preferably 1GB RAM or more. If you are using a desktop environment and web browser directly on the server you should install at least 2GB RAM, to avoid swapping to disk.
+The server should have at least a 1GHz processor and 1GB of RAM, preferably 2GB RAM or more. If you are using a desktop environment and web browser directly on the server you should install at least 2GB RAM, to avoid swapping to disk.
 
 The Airtime installation does not use much disk space, but you should allow plenty of storage capacity for the Airtime library. A hot-swap RAID array is recommended for media storage, in case of disk failure. You should also consider a UPS or other battery-powered system to offer some protection against short-term power failures.
 

From bd2f96acf2cd76b26b8c47b6fa1408b354e2cf46 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 12:55:06 +0100
Subject: [PATCH 04/13] Switch LibreTime port to 9080 in vagrant

Also expose icecast and make the airtime port generally configurable from the installer.

To aid in debugging and support the -v (verbose) argument was added to the call.
---
 Vagrantfile                        |  8 +++++--
 docs/index.md                      |  2 +-
 install                            | 34 +++++++++++++++++++++++++-----
 installer/apache/airtime-vhost     |  4 +++-
 installer/apache/airtime-vhost-2.4 |  4 +++-
 5 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index 9ef861488..88df66969 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -5,7 +5,11 @@ Vagrant.configure("2") do |config|
 
   config.vm.box = "ubuntu/trusty64"
 
-  config.vm.network "forwarded_port", guest:   80, host:8080
+  # libretime web interface
+  config.vm.network "forwarded_port", guest: 9080, host:9080
+  # icecast2
+  config.vm.network "forwarded_port", guest: 8000, host:8000
+  # mkdics documentation
   config.vm.network "forwarded_port", guest: 8888, host:8888
 
   config.vm.provider "virtualbox" do |v|
@@ -13,7 +17,7 @@ Vagrant.configure("2") do |config|
     v.memory = 1024
   end
 
-  config.vm.provision "shell", inline: "cd /vagrant; ./install -fIap"
+  config.vm.provision "shell", inline: "cd /vagrant; ./install -fIapv --web-port=9080"
   config.vm.provision "shell", path: "docs/scripts/install.sh"
   config.vm.provision "shell", path: "docs/scripts/serve.sh"
 
diff --git a/docs/index.md b/docs/index.md
index 81cf7d0b6..a3768374a 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -22,6 +22,6 @@ The easiest way to check out LibreTime for yourself is to run a local instance i
     cd libretime
     vagrant up
 
-If everything works out, you will find LibreTime on [port 8080](http://localhost:8080) and the docs on [port 8888](http://localhost:8888).
+If everything works out, you will find LibreTime on [port 9080](http://localhost:9080), icecast on [port 8080](http://localhost:8080) and the docs on [port 8888](http://localhost:8888).
 
 Of course, this setup isn't appropriate for production use. For that, check out our [installation instructions](install.md).
diff --git a/install b/install
index b668296c4..386582f9b 100755
--- a/install
+++ b/install
@@ -36,6 +36,8 @@ showhelp () {
                 This will copy the Airtime application files, but you will need
                 to give your web user access to the given directory if it is 
                 not accessible
+    --web-port=WEB_PORT
+                Set what port the LibreTime interface should run on.
     -I, --in-place
                 Set the current Airtime directory as the web root
                 Note that you will need to give your web user permission to 
@@ -58,6 +60,7 @@ showversion () {
 
 web_user="www-data"
 web_root=""
+web_port="80"
 in_place="f"
 postgres="f"
 apache="f"
@@ -206,6 +209,17 @@ while :; do
             echo 'ERROR: Must specify a non-empty "--web-root=WEB_ROOT" argument.' >&2
             exit 1
             ;;
+        --web-port)
+            echo 'ERROR: Pleas specify a port number.' >&2
+            exit 1
+            ;;
+        --web-port=)
+            echo 'ERROR: Pleas specify a port number.' >&2
+            exit 1
+            ;;
+        --web-port=?*)
+            web_port=${1#*=}
+            ;;
         --)
             shift
             break
@@ -420,12 +434,22 @@ if [ "$apache" = "t" ]; then
     # will fail
     if [ "$upgrade" = "t" -o ! -f /etc/apache2/sites-available/${airtimeconfigfile} ]; then
         verbose "\n * Creating Apache config for Airtime..."
-        
-        if [ "$apacheversion" != "1" ]; then
-            sed -e "s@WEB_ROOT@${web_root}@g" ${SCRIPT_DIR}/installer/apache/airtime-vhost-2.4 > /etc/apache2/sites-available/${airtimeconfigfile}
-        else
-            sed -e "s@WEB_ROOT@${web_root}@g" ${SCRIPT_DIR}/installer/apache/airtime-vhost > /etc/apache2/sites-available/${airtimeconfigfile}
+        listen_port=""
+        if [ "$web_port" != "80" ]; then
+            listen_port=${web_port}
         fi
+        
+        apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost-2.4
+        if [ "$apacheversion" = "1" ]; then
+            # fall back to apache 1 config
+            apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost
+        fi
+        sed \
+            -e "s@WEB_PORT_LISTEN@Listen ${listen_port}@g" \
+            -e "s@WEB_PORT@${web_port}@g" \
+            -e "s@WEB_ROOT@${web_root}@g" \
+            ${apache_template_file} > /etc/apache2/sites-available/${airtimeconfigfile}
+
         loudCmd "a2dissite 000-default"
         # If Airtime was previously installed with apt, the vhost file name is different,
         # so we need to specifically disable it.
diff --git a/installer/apache/airtime-vhost b/installer/apache/airtime-vhost
index fa982a97b..6d1ac2773 100644
--- a/installer/apache/airtime-vhost
+++ b/installer/apache/airtime-vhost
@@ -1,4 +1,6 @@
-<VirtualHost *:80>
+WEB_PORT_LISTEN
+
+<VirtualHost *:WEB_PORT>
    ServerAdmin foo@bar.org
    DocumentRoot WEB_ROOT
    php_admin_value upload_tmp_dir /tmp
diff --git a/installer/apache/airtime-vhost-2.4 b/installer/apache/airtime-vhost-2.4
index 954a12910..857269795 100644
--- a/installer/apache/airtime-vhost-2.4
+++ b/installer/apache/airtime-vhost-2.4
@@ -1,4 +1,6 @@
-<VirtualHost *:80>
+WEB_PORT_LISTEN
+
+<VirtualHost *:WEB_PORT>
    ServerAdmin foo@bar.org
    DocumentRoot WEB_ROOT
    php_admin_value upload_tmp_dir /tmp

From 13c676a88649f58d24f8ccd3b97a60ce34bc97a3 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 15:13:26 +0100
Subject: [PATCH 05/13] Set up alsa on vagrant

Should work on linux and macos, I only tested osx and was able to hear sound coming out of it using mpg123 on the command line.

LibreTime probably still needs some fixes to make this work as intended.
---
 Vagrantfile | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/Vagrantfile b/Vagrantfile
index 88df66969..54d478519 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -15,8 +15,29 @@ Vagrant.configure("2") do |config|
   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
   end
 
+  # ubuntu/trusty64 alsa setup
+  # slightly modernized from  https://github.com/naomiaro/vagrant-alsa-audio
+  # https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS
+  config.vm.provision "shell", inline: <<-SHELL
+     alsa_deb="oem-audio-hda-daily-dkms_0.201703070301~ubuntu14.04.1_all.deb"
+     wget -nv https://code.launchpad.net/~ubuntu-audio-dev/+archive/ubuntu/alsa-daily/+files/${alsa_deb}
+     sudo dpkg -i ${alsa_deb}
+     rm ${alsa_deb}
+     sudo DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install  alsa
+     sudo usermod -a -G audio vagrant
+  SHELL
   config.vm.provision "shell", inline: "cd /vagrant; ./install -fIapv --web-port=9080"
   config.vm.provision "shell", path: "docs/scripts/install.sh"
   config.vm.provision "shell", path: "docs/scripts/serve.sh"

From 216a5f98eb4e421656b1459cc7c241fa001ee384 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 15:15:16 +0100
Subject: [PATCH 06/13] Expose liquidsoap instreaming harbor port

---
 Vagrantfile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Vagrantfile b/Vagrantfile
index 54d478519..e9446ea48 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -9,6 +9,8 @@ Vagrant.configure("2") do |config|
   config.vm.network "forwarded_port", guest: 9080, host:9080
   # 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
   # mkdics documentation
   config.vm.network "forwarded_port", guest: 8888, host:8888
 

From 2350650e2624546ea934727b354783d2a2ec86d7 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 15:36:18 +0100
Subject: [PATCH 07/13] Enable icecast autoinstall

And fix docs :)
---
 Vagrantfile   | 2 +-
 docs/index.md | 2 +-
 install       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index e9446ea48..e822f5290 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -40,7 +40,7 @@ Vagrant.configure("2") do |config|
      sudo DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install  alsa
      sudo usermod -a -G audio vagrant
   SHELL
-  config.vm.provision "shell", inline: "cd /vagrant; ./install -fIapv --web-port=9080"
+  config.vm.provision "shell", inline: "cd /vagrant; ./install -fIiapv --web-port=9080"
   config.vm.provision "shell", path: "docs/scripts/install.sh"
   config.vm.provision "shell", path: "docs/scripts/serve.sh"
 
diff --git a/docs/index.md b/docs/index.md
index a3768374a..20c4c639e 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -22,6 +22,6 @@ The easiest way to check out LibreTime for yourself is to run a local instance i
     cd libretime
     vagrant up
 
-If everything works out, you will find LibreTime on [port 9080](http://localhost:9080), icecast on [port 8080](http://localhost:8080) and the docs on [port 8888](http://localhost:8888).
+If everything works out, you will find LibreTime on [port 9080](http://localhost:9080), icecast on [port 8000](http://localhost:8000) and the docs on [port 8888](http://localhost:8888).
 
 Of course, this setup isn't appropriate for production use. For that, check out our [installation instructions](install.md).
diff --git a/install b/install
index 386582f9b..8197041e5 100755
--- a/install
+++ b/install
@@ -210,11 +210,11 @@ while :; do
             exit 1
             ;;
         --web-port)
-            echo 'ERROR: Pleas specify a port number.' >&2
+            echo 'ERROR: Please specify a port number.' >&2
             exit 1
             ;;
         --web-port=)
-            echo 'ERROR: Pleas specify a port number.' >&2
+            echo 'ERROR: Please specify a port number.' >&2
             exit 1
             ;;
         --web-port=?*)

From e2fd3b00f3499b4c8b0865713e3b8acf06acac24 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 16:16:03 +0100
Subject: [PATCH 08/13] Allow apache user alsa access

---
 Vagrantfile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Vagrantfile b/Vagrantfile
index e822f5290..e7558db8d 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -39,6 +39,8 @@ Vagrant.configure("2") do |config|
      rm ${alsa_deb}
      sudo DEBIAN_FRONTEND=noninteractive apt-get -y -m --force-yes install  alsa
      sudo usermod -a -G audio vagrant
+     # liquidsoap runs as apache
+     sudo usermod -a -G audio www-data
   SHELL
   config.vm.provision "shell", inline: "cd /vagrant; ./install -fIiapv --web-port=9080"
   config.vm.provision "shell", path: "docs/scripts/install.sh"

From 30dcf5917d5076dafe3f7622f181568ce622400c Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Tue, 7 Mar 2017 16:28:00 +0100
Subject: [PATCH 09/13] Ignore .vagrant dir

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 3d1206997..e9c9e2ff7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ composer.phar
 /tests/*.jar
 VERSION
 airtime_mvc/tests/log/*.log
+.vagrant/

From f80afc83c14443b2228c83d8c3ed47656a22ca10 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Fri, 10 Mar 2017 12:17:16 +0100
Subject: [PATCH 10/13] Fix default port 80 Listen case

---
 install | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/install b/install
index 8197041e5..2cb36a740 100755
--- a/install
+++ b/install
@@ -436,7 +436,7 @@ if [ "$apache" = "t" ]; then
         verbose "\n * Creating Apache config for Airtime..."
         listen_port=""
         if [ "$web_port" != "80" ]; then
-            listen_port=${web_port}
+            listen_port="Listen ${web_port}"
         fi
         
         apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost-2.4
@@ -445,7 +445,7 @@ if [ "$apache" = "t" ]; then
             apache_template_file=${SCRIPT_DIR}/installer/apache/airtime-vhost
         fi
         sed \
-            -e "s@WEB_PORT_LISTEN@Listen ${listen_port}@g" \
+            -e "s@WEB_PORT_LISTEN@${listen_port}@g" \
             -e "s@WEB_PORT@${web_port}@g" \
             -e "s@WEB_ROOT@${web_root}@g" \
             ${apache_template_file} > /etc/apache2/sites-available/${airtimeconfigfile}

From d852db439ef979767d2c2c9d58fcf177622796eb Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Fri, 10 Mar 2017 12:31:19 +0100
Subject: [PATCH 11/13] Add more vagrant docs

Complete with links to the usual tooling needed, some info on vagrant ssh and a small troubleshooting section.
---
 docs/index.md | 12 +++++++-----
 mkdocs.yml    |  1 +
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/docs/index.md b/docs/index.md
index 20c4c639e..e2b68d733 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -17,11 +17,13 @@ Getting Started
 
 The easiest way to check out LibreTime for yourself is to run a local instance in a virtual machine. Assuming you already have Git, Vagrant and Virtualbox installed, just run:
 
-    :::bash
-    git clone https://github.com/libretime/libretime.git
-    cd libretime
-    vagrant up
+```bash
+git clone https://github.com/libretime/libretime.git
+cd libretime
+vagrant up
+```
 
 If everything works out, you will find LibreTime on [port 9080](http://localhost:9080), icecast on [port 8000](http://localhost:8000) and the docs on [port 8888](http://localhost:8888).
 
-Of course, this setup isn't appropriate for production use. For that, check out our [installation instructions](install.md).
+Of course, this setup isn't appropriate for production use. For that, check out our [installation instructions](install.md). More information on the vagrant setup are in [the docs](vagrant.md).
+
diff --git a/mkdocs.yml b/mkdocs.yml
index 8b7c3f4b3..781f4242f 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -70,6 +70,7 @@ pages:
     - 'Icecast statistics with Piwik': manual/icecast-statistics-with-piwik/index.md
   - 'Development':
     - 'Testing': testing.md
+    - 'Vagrant': vagrant.md
     - 'Documentation': documentation.md
   - 'Appendix':
     - 'Expert install': manual/expert-install/index.md

From 8ddc5867ac4b061c74b5e3f0db83093ba8166b97 Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Fri, 10 Mar 2017 12:32:45 +0100
Subject: [PATCH 12/13] Add missing file

This was missing from d852db439ef979767d2c2c9d58fcf177622796eb.
---
 docs/vagrant.md | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 docs/vagrant.md

diff --git a/docs/vagrant.md b/docs/vagrant.md
new file mode 100644
index 000000000..b004d49d8
--- /dev/null
+++ b/docs/vagrant.md
@@ -0,0 +1,32 @@
+The **LibreTime Vagrant install** is the fastet way to get LibreTime up and running in a way
+to hack on its source code or to test it locally.
+
+## Prerequisites
+
+* [Git](https://git-scm.com/)
+* [VirtualBox](https://www.virtualbox.org)
+* [Vagrant](https://vagrantup.com)
+
+You might also want to install [vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) to update the guest extensions to match your host system on vagrant up.
+
+```bash
+vagrant plugin install vagrant-vbguest
+```
+
+## Starting LibreTime Vagrant
+
+To get started you clone the repo and run `vagrant up`.
+
+```bash
+git clone https://github.com/libretime/libretime.git
+cd libretime
+vagrant up
+```
+
+If everything works out, you will find LibreTime on [port 9080](http://localhost:9080), icecast on [port 8000](http://localhost:8000) and the docs on [port 8888](http://localhost:8888).
+
+Once you reach the web setup GUI you can click through it using the default values. To connect to the vagrant machine you can run `vagrant ssh` in the libretime directory.
+
+## Troubleshooting
+
+If anything fails during the initial provisioning step you can try running `vagrant provision` to rerun the installer.

From 0e8d0868e8eae8e7f245ee82fbae41652853e5bb Mon Sep 17 00:00:00 2001
From: Lucas Bickel <hairmare@rabe.ch>
Date: Fri, 10 Mar 2017 19:10:15 +0100
Subject: [PATCH 13/13] Make pypo media downloader port aware

This is needed if the base port is not 80 like in the vagrant setup.
---
 python_apps/pypo/pypo/pypofile.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/python_apps/pypo/pypo/pypofile.py b/python_apps/pypo/pypo/pypofile.py
index f4288af53..673a4fd72 100644
--- a/python_apps/pypo/pypo/pypofile.py
+++ b/python_apps/pypo/pypo/pypofile.py
@@ -66,7 +66,9 @@ class PypoFile(Thread):
                 CONFIG_SECTION = "general"
                 username = self._config.get(CONFIG_SECTION, 'api_key')
                 host = self._config.get(CONFIG_SECTION, 'base_url')
-                url = "http://%s/rest/media/%s/download" % (host, media_item["id"])
+                port = self._config.get(CONFIG_SECTION, 'base_port', 80)
+                url = "http://%s:%s/rest/media/%s/download" % (host, port, media_item["id"])
+                self.logger.error(url)
                 with open(dst, "wb") as handle:
                     response = requests.get(url, auth=requests.auth.HTTPBasicAuth(username, ''), stream=True, verify=False)