Update how AzuraCast handles "release mode".

All core AzuraCast Docker images are now tagged with "latest" for rolling-release updates and "stable" for the latest stable version. Switching to release builds switches the images used for all AzuraCast components, yielding a much more stable interaction between components. As new releases are made, the "stable" versions of each image are updated in unison with each other.
This commit is contained in:
Buster "Silver Eagle" Neece 2020-05-21 20:27:26 -05:00
parent ddb8c43c53
commit 90fbf58f85
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
8 changed files with 37 additions and 95 deletions

View File

@ -3,7 +3,6 @@
#
APPLICATION_ENV=development
PREFER_RELEASE_BUILDS=false
COMPOSER_PLUGIN_MODE=false
# Developer options.

View File

@ -6,10 +6,6 @@
# Valid options: production, development, testing
APPLICATION_ENV=production
# Prefer release versions over always-updating "rolling" releases.
# Valid options: true, false
PREFER_RELEASE_BUILDS=false
# Enable the composer "merge" functionality to combine the main application's
# composer.json file with any plugins' composer files.
# This can have performance implications, so you should only use it if

View File

@ -13,7 +13,7 @@ version: '2.2'
services:
nginx_proxy:
image: azuracast/azuracast_nginx_proxy:latest
image: "azuracast/azuracast_nginx_proxy:${AZURACAST_VERSION:-latest}"
ports:
- '${AZURACAST_HTTP_PORT:-80}:80'
- '${AZURACAST_HTTPS_PORT:-443}:443'
@ -40,7 +40,7 @@ services:
web:
container_name: azuracast_web
image: azuracast/azuracast_web_v2:latest
image: "azuracast/azuracast_web_v2:${AZURACAST_VERSION:-latest}"
# Want to customize the HTTP/S ports? Follow the instructions here:
# https://www.azuracast.com/help/docker/#use-non-standard-ports
ports:
@ -53,7 +53,8 @@ services:
env_file: azuracast.env
environment:
LANG: ${LANG:-en_US.UTF-8}
AZURACAST_DC_REVISION: 8
AZURACAST_DC_REVISION: 9
AZURACAST_VERSION: ${AZURACAST_VERSION:-latest}
AZURACAST_SFTP_PORT: ${AZURACAST_SFTP_PORT:-2022}
VIRTUAL_HOST: ${LETSENCRYPT_HOST:-azuracast.local}
LETSENCRYPT_HOST: ${LETSENCRYPT_HOST}
@ -78,7 +79,7 @@ services:
max-file: "5"
mariadb:
image: azuracast/azuracast_db:latest
image: "azuracast/azuracast_db:${AZURACAST_VERSION:-latest}"
volumes:
- db_data:/var/lib/mysql
env_file: azuracast.env
@ -86,14 +87,14 @@ services:
logging: *default-logging
influxdb:
image: azuracast/azuracast_influxdb:latest
image: "azuracast/azuracast_influxdb:${AZURACAST_VERSION:-latest}"
volumes:
- influx_data:/var/lib/influxdb
restart: always
logging: *default-logging
redis:
image: azuracast/azuracast_redis:latest
image: "azuracast/azuracast_redis:${AZURACAST_VERSION:-latest}"
restart: always
logging: *default-logging
sysctls:
@ -103,7 +104,7 @@ services:
stations:
container_name: azuracast_stations
image: azuracast/azuracast_radio:latest
image: "azuracast/azuracast_radio:${AZURACAST_VERSION:-latest}"
ports:
# This default mapping is the outgoing and incoming ports for the first 50 stations.
# You can override this port mapping in your own docker-compose.override.yml file.

View File

@ -215,6 +215,18 @@ setup-letsencrypt() {
envfile-set "LETSENCRYPT_EMAIL" "" "Optional e-mail address for expiration updates"
}
#
# Configure release mode settings.
#
setup-release() {
AZURACAST_VERSION="latest"
if ask "Prefer stable release versions of AzuraCast?" N; then
AZURACAST_VERSION="stable"
fi
.env --file .env set AZURACAST_VERSION=${AZURACAST_VERSION}
}
#
# Run the initial installer of Docker and AzuraCast.
# Usage: ./docker.sh install
@ -292,6 +304,8 @@ install() {
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/docker-compose.sample.yml -o docker-compose.yml
fi
setup-release
if ask "Customize AzuraCast ports?" N; then
setup-ports
fi

View File

@ -9,64 +9,21 @@ bool() {
if [ $(whoami) != 'azuracast' ]; then
echo 'This script must be run as the "azuracast" user. Rerunning...'
sudo -E -u azuracast azuracast_install $@
sudo -E -u azuracast azuracast_install "$@"
exit 1
fi
update_mode=0
release_update=0
original_args=$*
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do
case $1 in
--update)
update_mode=1
;;
-r | --release)
release_update=1
;;
esac
shift
done
if [[ "$1" == '--' ]]; then shift; fi
if bool "$PREFER_RELEASE_BUILDS"; then
release_update=1
fi
if [ $update_mode = 1 ]; then
echo "Updating AzuraCast..."
else
echo "Installing AzuraCast..."
fi
echo "AzuraCast Setup"
APPLICATION_ENV="${APPLICATION_ENV:-production}"
echo "(Environment: $APPLICATION_ENV)"
if [ $APPLICATION_ENV = "production" ]; then
if [ $release_update = 1 ]; then
COMPOSER_VERSION=${1:-"^0.10"}
composer create-project azuracast/azuracast /var/azuracast/new $COMPOSER_VERSION --prefer-dist --no-install
rm -rf /var/azuracast/www/.git
find /var/azuracast/www -maxdepth 1 -type d ! -name 'plugins' -name '.' -exec rm -rf {} +
rsync -a -v -q /var/azuracast/new/ /var/azuracast/www
rm -rf /var/azuracast/new
if bool "$COMPOSER_PLUGIN_MODE"; then
composer update --lock --no-dev --optimize-autoloader
else
composer install --no-dev --optimize-autoloader
fi
else
if bool "$COMPOSER_PLUGIN_MODE"; then
composer update --lock --no-dev --optimize-autoloader
fi
if [ "$APPLICATION_ENV" = "production" ]; then
if bool "$COMPOSER_PLUGIN_MODE"; then
composer update --lock --no-dev --optimize-autoloader
fi
else
if [ $APPLICATION_ENV = "testing" ]; then
if [ "$APPLICATION_ENV" = "testing" ]; then
sudo mkdir -p vendor
sudo chmod -R 0744 vendor
sudo chown -R azuracast:azuracast vendor
@ -75,4 +32,4 @@ else
composer install
fi
azuracast_cli azuracast:setup ${original_args}
azuracast_cli azuracast:setup "$@"

View File

@ -2,53 +2,28 @@
bool() {
case "$1" in
Y*|y*|true|TRUE|1) return 0 ;;
Y* | y* | true | TRUE | 1) return 0 ;;
esac
return 1
}
if [ `whoami` != 'azuracast' ]; then
if [ $(whoami) != 'azuracast' ]; then
echo 'This script must be run as the "azuracast" user. Rerunning...'
sudo -E -u azuracast azuracast_restore $@
sudo -E -u azuracast azuracast_install "$@"
exit 1
fi
release_update=0
original_args=$*
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
-r | --release )
release_update=1
;;
esac; shift; done
if [[ "$1" == '--' ]]; then shift; fi
if bool "$PREFER_RELEASE_BUILDS"; then
release_update=1
fi
echo "Restoring AzuraCast..."
echo "AzuraCast Setup"
APPLICATION_ENV="${APPLICATION_ENV:-production}"
echo "(Environment: $APPLICATION_ENV)"
if [ $APPLICATION_ENV = "production" ]; then
if [ $release_update = 1 ]; then
composer create-project azuracast/azuracast /var/azuracast/new ^0.9.5 --prefer-dist --no-install
else
composer create-project azuracast/azuracast /var/azuracast/new dev-master --prefer-source --keep-vcs --no-install
fi
rsync -a -v -q /var/azuracast/new/ /var/azuracast/www
rm -rf /var/azuracast/new
if [ "$APPLICATION_ENV" = "production" ]; then
if bool "$COMPOSER_PLUGIN_MODE"; then
composer update --lock --no-dev --optimize-autoloader
else
composer install --no-dev --optimize-autoloader
fi
else
composer install
fi
azuracast_cli azuracast:restore ${original_args}
azuracast_cli azuracast:restore "$@"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
azuracast_install --update $*
azuracast_install --update "$@"

View File

@ -2,4 +2,4 @@
source /etc/container_environment.sh
sudo -E -u azuracast $@ > /proc/1/fd/1 2> /proc/1/fd/2
sudo -E -u azuracast "$@" >/proc/1/fd/1 2>/proc/1/fd/2