Merge pull request #39 from radiorabe/feature/vagrant-install
Install LibreTime in vagrant env
This commit is contained in:
commit
b3b9738846
|
@ -13,3 +13,4 @@ composer.phar
|
|||
/tests/*.jar
|
||||
VERSION
|
||||
airtime_mvc/tests/log/*.log
|
||||
.vagrant/
|
||||
|
|
|
@ -5,8 +5,44 @@ Vagrant.configure("2") do |config|
|
|||
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
|
||||
# libretime web interface
|
||||
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
|
||||
|
||||
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
|
||||
# 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"
|
||||
config.vm.provision "shell", path: "docs/scripts/serve.sh"
|
||||
|
||||
|
|
|
@ -17,9 +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). More information on the vagrant setup are in [the docs](vagrant.md).
|
||||
|
||||
Of course, this setup isn't appropriate for production use. For that, check out our [installation instructions](install.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.
|
||||
|
||||
|
|
|
@ -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.
|
43
install
43
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: Please specify a port number.' >&2
|
||||
exit 1
|
||||
;;
|
||||
--web-port=)
|
||||
echo 'ERROR: Please specify a port number.' >&2
|
||||
exit 1
|
||||
;;
|
||||
--web-port=?*)
|
||||
web_port=${1#*=}
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
|
@ -305,11 +319,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
|
||||
|
@ -414,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="Listen ${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_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.
|
||||
|
@ -606,8 +636,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue