From 65968ee0faa6f0d7bab507cc1acc61908a26a983 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 16 Sep 2018 21:55:27 +1000 Subject: [PATCH 1/4] add DS_Stores to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e9c9e2ff7..7e6412ac8 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ composer.phar VERSION airtime_mvc/tests/log/*.log .vagrant/ +.DS_Store From 9f15b2d3dff844841f16af832d5b6c020e0ec048 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 16 Sep 2018 21:55:55 +1000 Subject: [PATCH 2/4] begin docker xenial support --- install | 117 ++++++++++-------- ...uirements-ubuntu-xenial_docker_minimal.apt | 80 ++++++++++++ 2 files changed, 147 insertions(+), 50 deletions(-) create mode 100644 installer/lib/requirements-ubuntu-xenial_docker_minimal.apt diff --git a/install b/install index 15a1f61f5..d918a1420 100755 --- a/install +++ b/install @@ -52,7 +52,13 @@ showhelp () { Install Icecast 2 and deploy a basic configuration for Airtime --selinux Run restorecon on directories and files that need tagging to - allow the WEB_USER access." + allow the WEB_USER access + --no-postgres + Skips all postgres related install tasks (Useful if you configure + postgresql as part of another script / docker builds) + --no-rabbitmq + Skips all rabbitmq related install tasks. + " exit 0 } @@ -449,6 +455,12 @@ while :; do --selinux) selinux="t" ;; + --skip-postgres) + skip_postgres=1 + ;; + --skip-rabbitmq) + skip_rabbitmq=1 + ;; --) shift break @@ -986,70 +998,75 @@ else loudCmd "a2enmod rewrite php5" fi -loud "\n-----------------------------------------------------" -loud " * Configuring PostgreSQL * " -loud "-----------------------------------------------------" +if [ $skip_postgres -ne 1 ]; then + loud "\n-----------------------------------------------------" + loud " * Configuring PostgreSQL * " + loud "-----------------------------------------------------" -# Ensure postgres is running - It isn't after you install the postgres package on Ubuntu 15.04 -systemInitCommand start postgresql + # Ensure postgres is running - It isn't after you install the postgres package on Ubuntu 15.04 + systemInitCommand start postgresql -setupAirtimePostgresUser() { - # here-doc to execute this block as postgres user - su postgres <<'EOF' - set +e - count=$(psql -d postgres -tAc "SELECT count(*) FROM pg_roles WHERE rolname='airtime';") - if [[ $count -eq 0 ]]; then - psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;" - [[ $? -eq 0 ]] && - echo "Created airtime user in PostgreSQL" || - echo "$0:${FUNCNAME}(): ERROR: Can't create airtime user in PostgreSQL!" - else - echo "airtime user already exists in PostgreSQL" - fi - set -e + setupAirtimePostgresUser() { + # here-doc to execute this block as postgres user + su postgres <<'EOF' + set +e + count=$(psql -d postgres -tAc "SELECT count(*) FROM pg_roles WHERE rolname='airtime';") + if [[ $count -eq 0 ]]; then + psql -d postgres -tAc "CREATE USER airtime WITH ENCRYPTED PASSWORD 'airtime'; ALTER USER airtime CREATEDB;" + [[ $? -eq 0 ]] && + echo "Created airtime user in PostgreSQL" || + echo "$0:${FUNCNAME}(): ERROR: Can't create airtime user in PostgreSQL!" + else + echo "airtime user already exists in PostgreSQL" + fi + set -e # don't indent this! EOF -} + } -if [ "$postgres" = "t" ]; then - setupAirtimePostgresUser -elif [ ${_i} -eq 1 ]; then - echo -e "Create default airtime postgres user? (Y/n): \c" - read IN - if [ "$IN" = "y" -o "$IN" = "Y" ]; then + if [ "$postgres" = "t" ]; then setupAirtimePostgresUser + elif [ ${_i} -eq 1 ]; then + echo -e "Create default airtime postgres user? (Y/n): \c" + read IN + if [ "$IN" = "y" -o "$IN" = "Y" ]; then + setupAirtimePostgresUser + fi fi fi -loud "\n-----------------------------------------------------" -loud " * Configuring RabbitMQ * " -loud "-----------------------------------------------------" +if [ $skip_rabbitmq -ne 1 ]; then -RABBITMQ_VHOST=/airtime -RABBITMQ_USER=airtime -RABBITMQ_PASSWORD=airtime -EXCHANGES="airtime-pypo|pypo-fetch|airtime-analyzer|media-monitor" + loud "\n-----------------------------------------------------" + loud " * Configuring RabbitMQ * " + loud "-----------------------------------------------------" -# Ignore errors in this check to avoid dying when vhost isn't found -set +e -rabbitmqctl list_vhosts | grep -w "^${RABBITMQ_VHOST}$" > /dev/null -RESULT="$?" -set -e + RABBITMQ_VHOST=/airtime + RABBITMQ_USER=airtime + RABBITMQ_PASSWORD=airtime + EXCHANGES="airtime-pypo|pypo-fetch|airtime-analyzer|media-monitor" -# Only run these if the vhost doesn't exist -if [ "$RESULT" != "0" ]; then - verbose "\n * Creating RabbitMQ user ${RABBITMQ_USER}..." + # Ignore errors in this check to avoid dying when vhost isn't found + set +e + rabbitmqctl list_vhosts | grep -w "^${RABBITMQ_VHOST}$" > /dev/null + RESULT="$?" + set -e - rabbitmqctl add_vhost ${RABBITMQ_VHOST} - rabbitmqctl add_user ${RABBITMQ_USER} ${RABBITMQ_PASSWORD} -else - verbose "\nRabbitMQ user already exists, skipping creation" + # Only run these if the vhost doesn't exist + if [ "$RESULT" != "0" ]; then + verbose "\n * Creating RabbitMQ user ${RABBITMQ_USER}..." + + rabbitmqctl add_vhost ${RABBITMQ_VHOST} + rabbitmqctl add_user ${RABBITMQ_USER} ${RABBITMQ_PASSWORD} + else + verbose "\nRabbitMQ user already exists, skipping creation" + fi + + verbose "\n * Setting RabbitMQ user permissions..." + #loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} \"$EXCHANGES\" \"$EXCHANGES\" \"$EXCHANGES\"" + loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} .\* .\* .\*" fi -verbose "\n * Setting RabbitMQ user permissions..." -#loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} \"$EXCHANGES\" \"$EXCHANGES\" \"$EXCHANGES\"" -loudCmd "rabbitmqctl set_permissions -p ${RABBITMQ_VHOST} ${RABBITMQ_USER} .\* .\* .\*" - if [ ! -d "/etc/airtime" ]; then loud "\n-----------------------------------------------------" loud " * Installing Airtime * " diff --git a/installer/lib/requirements-ubuntu-xenial_docker_minimal.apt b/installer/lib/requirements-ubuntu-xenial_docker_minimal.apt new file mode 100644 index 000000000..0238132ba --- /dev/null +++ b/installer/lib/requirements-ubuntu-xenial_docker_minimal.apt @@ -0,0 +1,80 @@ +apache2 +libapache2-mod-php7.0 +php7.0 +php-pear +php7.0-gd +php-bcmath +php-mbstring + +lsb-release + +zip +unzip + +postgresql-client +php7.0-pgsql + +python +python-virtualenv +python-pip + +libsoundtouch-ocaml +libtaglib-ocaml +libao-ocaml +libmad-ocaml +ecasound +libportaudio2 +libsamplerate0 + +python-rgain +python-gst-1.0 +gstreamer1.0-plugins-ugly +python-pika + +patch + +php7.0-curl +mpg123 +curl + +libcamomile-ocaml-data +libpulse0 +vorbis-tools +lsof +# mp3gain need to be installed over an external ppa or the use of easymp3gain +easymp3gain-gtk +vorbisgain +flac +vorbis-tools +pwgen +libfaad2 +php-apcu + +lame + +coreutils + +liquidsoap +liquidsoap-plugin-alsa +liquidsoap-plugin-ao +liquidsoap-plugin-faad +liquidsoap-plugin-flac +liquidsoap-plugin-icecast +liquidsoap-plugin-lame +liquidsoap-plugin-mad +liquidsoap-plugin-ogg +liquidsoap-plugin-portaudio +liquidsoap-plugin-pulseaudio +liquidsoap-plugin-taglib +liquidsoap-plugin-voaacenc +liquidsoap-plugin-vorbis + +silan +libopus0 + +sysvinit-utils + +build-essential +libssl-dev +libffi-dev +python-dev From 6222e56ee4b9a92e3f0abeaf4177c684ce0fccef Mon Sep 17 00:00:00 2001 From: David Date: Sun, 16 Sep 2018 22:13:30 +1000 Subject: [PATCH 3/4] add defaults for no-postgres and no-rabbitmq options --- install | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/install b/install index d918a1420..8cab1edaa 100755 --- a/install +++ b/install @@ -91,6 +91,8 @@ upgrade="f" dist="" code="" apache_bin="" +skip_postgres=0 +skip_rabbitmq=0 function verbose() { @@ -455,10 +457,10 @@ while :; do --selinux) selinux="t" ;; - --skip-postgres) + --no-postgres) skip_postgres=1 ;; - --skip-rabbitmq) + --no-rabbitmq) skip_rabbitmq=1 ;; --) @@ -998,7 +1000,7 @@ else loudCmd "a2enmod rewrite php5" fi -if [ $skip_postgres -ne 1 ]; then +if [ $skip_postgres -eq 0 ]; then loud "\n-----------------------------------------------------" loud " * Configuring PostgreSQL * " loud "-----------------------------------------------------" @@ -1035,7 +1037,7 @@ EOF fi fi -if [ $skip_rabbitmq -ne 1 ]; then +if [ $skip_rabbitmq -eq 0 ]; then loud "\n-----------------------------------------------------" loud " * Configuring RabbitMQ * " From 7ad096bd5bdf11fc6c05c75a743e29ee736ebc6b Mon Sep 17 00:00:00 2001 From: David Date: Sun, 16 Sep 2018 22:19:10 +1000 Subject: [PATCH 4/4] add xenial minimal flags --- install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install b/install index 8cab1edaa..f46ac0d70 100755 --- a/install +++ b/install @@ -598,7 +598,7 @@ code="${code:-$VERSION_ID}" code="${code,,}" verbose "Validating dist-code: ${dist}-${code}" case "${dist}-${code}" in - ubuntu-16.04|ubuntu-xenial) + ubuntu-16.04|ubuntu-xenial|ubuntu-xenial_docker_minimal) code="xenial" is_ubuntu_dist=true is_ubuntu_xenial=true