1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #2946 from jvonau/test-azuracast

Get Azuracast baseline - Fix port reassignment - WIP - needs testing
This commit is contained in:
A Holt 2022-08-31 09:47:50 -04:00 committed by GitHub
commit 17fdfc9942
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1643 additions and 20 deletions

54
prod.env.j2 Normal file
View file

@ -0,0 +1,54 @@
# This file was automatically generated by AzuraCast and modified for IIAB
# You can modify it as necessary. To apply changes, restart the Docker containers.
# Remove the leading "#" symbol from lines to uncomment them.
# (Docker Compose) All Docker containers are prefixed by this name. Do not change this after installation.
# Default: azuracast
COMPOSE_PROJECT_NAME=azuracast
# (Docker Compose) The amount of time to wait before a Docker Compose operation fails. Increase this on lower performance computers.
# Default: 300
COMPOSE_HTTP_TIMEOUT=300
# Release Channel
# Valid options: latest, stable
# Default: latest
AZURACAST_VERSION=stable
NGINX_TIMEOUT=1800
# HTTP Port
# The main port AzuraCast listens to for insecure HTTP connections.
# Default: 80
AZURACAST_HTTP_PORT={{ azuracast_http_port }}
# HTTPS Port
# The main port AzuraCast listens to for secure HTTPS connections.
# Default: 443
AZURACAST_HTTPS_PORT={{ azuracast_https_port }}
# SFTP Port
# The port AzuraCast listens to for SFTP file management connections.
# Default: 2022
AZURACAST_SFTP_PORT=2022
# Station Ports
# The ports AzuraCast should listen to for station broadcasts and incoming DJ
# connections.
# Default: 8000,8005,8006,8010,8015,8016,8020,8025,8026,8030,8035,8036,8040,8045,8046,8050,8055,8056,8060,8065,8066,8070,8075,8076,8090,8095,8096,8100,8105,8106,8110,8115,8116,8120,8125,8126,8130,8135,8136,8140,8145,8146,8150,8155,8156,8160,8165,8166,8170,8175,8176,8180,8185,8186,8190,8195,8196,8200,8205,8206,8210,8215,8216,8220,8225,8226,8230,8235,8236,8240,8245,8246,8250,8255,8256,8260,8265,8266,8270,8275,8276,8280,8285,8286,8290,8295,8296,8300,8305,8306,8310,8315,8316,8320,8325,8326,8330,8335,8336,8340,8345,8346,8350,8355,8356,8360,8365,8366,8370,8375,8376,8380,8385,8386,8390,8395,8396,8400,8405,8406,8410,8415,8416,8420,8425,8426,8430,8435,8436,8440,8445,8446,8450,8455,8456,8460,8465,8466,8470,8475,8476,8480,8485,8486,8490,8495,8496
AZURACAST_STATION_PORTS=10000,10005,10006,10010,10015,10016,10020,10025,10026,10030,10035,10036,10040,10045,10046,10050,10055,10056,10060,10065,10066,10070,10075,10076,10080,10085,10086,10090,10095,10096,10100,10105,10106,10110,10115,10116,10120,10125,10126,10130,10135,10136,10140,10145,10146,10150,10155,10156,10160,10165,10166,10170,10175,10176,10180,10185,10186,10190,10195,10196,10200,10205,10206,10210,10215,10216,10220,10225,10226,10230,10235,10236,10240,10245,10246,10250,10255,10256,10260,10265,10266,10270,10275,10276,10280,10285,10286,10290,10295,10296,10300,10305,10306,10310,10315,10316,10320,10325,10326,10330,10335,10336,10340,10345,10346,10350,10355,10356,10360,10365,10366,10370,10375,10376,10380,10385,10386,10390,10395,10396,10400,10405,10406,10410,10415,10416,10420,10425,10426,10430,10435,10436,10440,10445,10446,10450,10455,10456,10460,10465,10466,10470,10475,10476,10480,10485,10486,10490,10495,10496
# Docker User UID
# Set the UID of the user running inside the Docker containers. Matching this
# with your host UID can fix permission issues.
# Default: 1000
AZURACAST_PUID=1000
# Docker User GID
# Set the GID of the user running inside the Docker containers. Matching this
# with your host GID can fix permission issues.
# Default: 1000
AZURACAST_PGID=1000
# Advanced: Use Privileged Docker Settings
# Default: true
AZURACAST_COMPOSE_PRIVILEGED=true

View file

@ -12,7 +12,7 @@ Using It
--------
* Do a normal IIAB install (https://download.iiab.io), making sure to set both variables ``azuracast_install`` and ``azuracast_enabled`` to ``True`` when it prompts you to edit `/etc/iiab/local_vars.yml <http://FAQ.IIAB.IO#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_, as you begin the installation.
* When the IIAB software install completes, it will ask you to reboot, and AzuraCast's console will then be available at http://box.lan:10080
* When the IIAB software install completes, it will ask you to reboot, and AzuraCast's console will then be available at http://box.lan:12080
* This console site will prompt you to complete AzuraCast's initial setup: user accounts, managing stations, radio streams, etc.
* Finally, check out some `how-to videos <https://www.youtube.com/watch?v=b1Rxlu5P804>`_ to learn to manage your own radio station!

View file

@ -1,23 +1,23 @@
- name: AzuraCast - Make config directory {{ azuracast_host_dir }}
file:
file:
path: "{{ azuracast_host_dir }}"
state: directory
- name: AzuraCast - Install {{ azuracast_host_dir }}/.env from template
template:
src: env.j2
src: prod.env.j2
dest: "{{ azuracast_host_dir }}/.env"
#owner: root
#group: root
mode: 0644
- name: AzuraCast - Install {{ azuracast_host_dir }}/docker-compose.override.yml from template
template:
src: docker-compose.override.yml.j2
dest: "{{ azuracast_host_dir }}/docker-compose.override.yml"
#- name: AzuraCast - Install {{ azuracast_host_dir }}/docker-compose.override.yml from template
# template:
# src: docker-compose.override.yml.j2
# dest: "{{ azuracast_host_dir }}/docker-compose.override.yml"
#owner: root
#group: root
mode: 0644
# mode: 0644
- name: AzuraCast - Download {{ docker_sh_url }} to {{ azuracast_host_dir }}
get_url:
@ -27,7 +27,7 @@
timeout: "{{ download_timeout }}"
- name: AzuraCast - Download AzuraCast's docker-compose.yml sample from GitHub to {{ azuracast_host_dir }}
get_url:
get_url:
url: "{{ docker_compose_url }}"
dest: "{{ azuracast_host_dir }}/docker-compose.yml"
mode: 0755
@ -40,22 +40,30 @@
# line: "\\1reply='Y'"
# backrefs: yes
#- name: Change default port number range 8xxx:8xxx to {{ azuracast_port_range_prefix }}xxx:{{ azuracast_port_range_prefix }}xxx icecast-stations in docker-compose.yml
# replace:
# path: "{{ azuracast_host_dir }}/docker-compose.yml"
# regexp: "^( *- \\')8([0-9]{3})\\:8([0-9]{3}\\'.*)$"
# replace: "\\g<1>{{ azuracast_port_range_prefix }}\\g<2>:{{ azuracast_port_range_prefix }}\\g<3>"
- name: AzuraCast - Install {{ azuracast_host_dir }}/azuracast.env for altered ports
template:
src: azuracast.env
dest: "{{ azuracast_host_dir }}/"
#owner: root
#group: root
mode: 0644
- name: AzuraCast - Make directory {{ docker_container_dir }}
file:
file:
path: "{{ docker_container_dir }}"
state: directory
- name: AzuraCast - Symlink /var/lib/docker -> {{ docker_container_dir }}
file:
src: "{{ docker_container_dir }}"
path: /var/lib/docker
state: link
- name: Change default port number range 8xxx:8xxx to {{ azuracast_port_range_prefix }}xxx:{{ azuracast_port_range_prefix }}xxx icecast-stations in docker-compose.yml
replace:
path: "{{ azuracast_host_dir }}/docker-compose.yml"
regexp: "^( *- \\')8([0-9]{3})\\:8([0-9]{3}\\'.*)$"
replace: "\\g<1>{{ azuracast_port_range_prefix }}\\g<2>:{{ azuracast_port_range_prefix }}\\g<3>"
state: link
- name: AzuraCast - Setup for stable channel install
shell: "yes 'Y' | /bin/bash docker.sh setup-release"

View file

@ -0,0 +1,24 @@
location /azuracast/
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /azureacast;
proxy_pass http://127.0.0.1:{{ azuracast_http_port }};
}
location /radio/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name /radio;
proxy_pass http://127.0.0.1:{{ azuracast_http_port }};
}
# http://box/livres
location {{ calibreweb_url3 }}/ {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name {{ calibreweb_url3 }};
proxy_pass http://127.0.0.1:8083;
}

View file

@ -0,0 +1,155 @@
# IIAB version for altered ports
#
# AzuraCast Customization
#
# The application environment.
# Valid options: production, development, testing
APPLICATION_ENV=production
# Manually modify the logging level.
# This allows you to log debug-level errors temporarily (for problem-solving) or reduce
# the volume of logs that are produced by your installation, without needing to modify
# whether your installation is a production or development instance.
# Valid options: debug, info, notice, warning, error, critical, alert, emergency
# LOG_LEVEL=notice
# 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
# you use one or more plugins with their own Composer dependencies.
# Valid options: true, false
COMPOSER_PLUGIN_MODE=false
# The minimum port number to use when automatically assigning ports to a station.
# By default, this matches the first forwarded port on the "stations" container.
# You can modify this variable if your station port range is different.
# Be sure to also forward the necessary ports via `docker-compose.yml`
# (and nginx, if you want to use the built-in port-80/443 proxy)!
AUTO_ASSIGN_PORT_MIN="{{ azuracast_port_range_prefix }}000"
# The maximum port number to use when automatically assigning ports to a station.
# See AUTO_ASSIGN_PORT_MIN.
AUTO_ASSIGN_PORT_MAX="{{ azuracast_port_range_prefix }}499"
#
# Database Configuration
# --
# Once the database has been installed, DO NOT CHANGE these values!
#
# The host to connect to. Leave this as the default value unless you're connecting
# to an external database server.
# Default: mariadb
MYSQL_HOST=mariadb
# The port to connect to. Leave this as the default value unless you're connecting
# to an external database server.
# Default: 3306
MYSQL_PORT=3306
# The username AzuraCast will use to connect to the database.
# Default: azuracast
MYSQL_USER=azuracast
# The password AzuraCast will use to connect to the database.
# By default, the database is not exposed to the Internet at all and this is only
# an internal password used by the service itself.
# Default: azur4c457
MYSQL_PASSWORD=azur4c457
# The name of the AzuraCast database.
# Default: azuracast
MYSQL_DATABASE=azuracast
# Automatically generate a random root password upon the first database spin-up.
# This password will be visible in the mariadb container's logs.
# Default: yes
MYSQL_RANDOM_ROOT_PASSWORD=yes
# Log slower queries for the purpose of diagnosing issues. Only turn this on when
# you need to, by uncommenting this and switching it to 1.
# To read the slow query log once enabled, run:
# docker-compose exec mariadb slow_queries
# Default: 0
MYSQL_SLOW_QUERY_LOG=0
# Set the amount of allowed connections to the database. This value should be increased
# if you are seeing the `Too many connections` error in the logs.
# Default: 100
MYSQL_MAX_CONNECTIONS=100
#
# Redis Configuration
#
# Uncomment these fields if you are using a third-party Redis host instead of the one provided with AzuraCast.
# Do not modify these fields if you are using the standard AzuraCast Redis host.
#
# Whether to use the Redis cache; if set to false, will disable Redis and use flatfile cache instead.
# Default: true
# ENABLE_REDIS=true
# Name of the Redis host.
# Default: redis
# REDIS_HOST=redis
# Port to connect to on the Redis host.
# Default: 6379
# REDIS_PORT=6379
# Database index to use on the Redis host.
# Default: 1
# REDIS_DB=1
#
# Advanced Configuration
#
# PHP's maximum POST body size and max upload filesize.
# PHP_MAX_FILE_SIZE=25M
# PHP's maximum memory limit.
# PHP_MEMORY_LIMIT=128M
# PHP's maximum script execution time (in seconds).
# PHP_MAX_EXECUTION_TIME=30
# The maximum execution time (and lock timeout) for the 15-second, 1-minute and 5-minute synchronization tasks.
# SYNC_SHORT_EXECUTION_TIME=600
# The maximum execution time (and lock timeout) for the 1-hour synchronization task.
# SYNC_LONG_EXECUTION_TIME=1800
# Maximum number of PHP-FPM worker processes to spawn.
# PHP_FPM_MAX_CHILDREN=5
#
# PHP-SPX profiling extension Configuration
#
# These environment variables allow you to enable and configure the PHP-SPX profiling extension
# which can be helpful when debugging resource issues in AzuraCast.
#
# The profiling dashboard can be accessed by visting https://yourdomain.com/?SPX_KEY=dev&SPX_UI_URI=/
# If you change the PROFILING_EXTENSION_HTTP_KEY variable change the value for SPX_KEY accordingly.
#
# Enable the profiling extension.
# Profiling data can be viewed by visiting http://your-azuracast-site/?SPX_KEY=dev&SPX_UI_URI=/
# Default: 0
# PROFILING_EXTENSION_ENABLED=0
# Profile ALL requests made to this account.
# This will have significant performance impact on your installation and should only be used in test circumstances.
# Default: 0
# PROFILING_EXTENSION_ALWAYS_ON=0
# Configure the value for the SPX_KEY parameter needed to access the profiling dashboard
# Default: dev
# PROFILING_EXTENSION_HTTP_KEY=dev
# Configure the IP whitelist for the profiling dashboard
# By default only localhost is allowed to access this page.
# Uncomment this line to enable access for you.
# Default: 127.0.0.1
# PROFILING_EXTENSION_HTTP_IP_WHITELIST=*

View file

@ -0,0 +1,155 @@
# https://github.com/AzuraCast/AzuraCast/blob/main/azuracast.sample.env
#
# AzuraCast Customization
#
# The application environment.
# Valid options: production, development, testing
APPLICATION_ENV=production
# Manually modify the logging level.
# This allows you to log debug-level errors temporarily (for problem-solving) or reduce
# the volume of logs that are produced by your installation, without needing to modify
# whether your installation is a production or development instance.
# Valid options: debug, info, notice, warning, error, critical, alert, emergency
# LOG_LEVEL=notice
# 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
# you use one or more plugins with their own Composer dependencies.
# Valid options: true, false
COMPOSER_PLUGIN_MODE=false
# The minimum port number to use when automatically assigning ports to a station.
# By default, this matches the first forwarded port on the "stations" container.
# You can modify this variable if your station port range is different.
# Be sure to also forward the necessary ports via `docker-compose.yml`
# (and nginx, if you want to use the built-in port-80/443 proxy)!
AUTO_ASSIGN_PORT_MIN=8000
# The maximum port number to use when automatically assigning ports to a station.
# See AUTO_ASSIGN_PORT_MIN.
AUTO_ASSIGN_PORT_MAX=8499
#
# Database Configuration
# --
# Once the database has been installed, DO NOT CHANGE these values!
#
# The host to connect to. Leave this as the default value unless you're connecting
# to an external database server.
# Default: mariadb
MYSQL_HOST=mariadb
# The port to connect to. Leave this as the default value unless you're connecting
# to an external database server.
# Default: 3306
MYSQL_PORT=3306
# The username AzuraCast will use to connect to the database.
# Default: azuracast
MYSQL_USER=azuracast
# The password AzuraCast will use to connect to the database.
# By default, the database is not exposed to the Internet at all and this is only
# an internal password used by the service itself.
# Default: azur4c457
MYSQL_PASSWORD=azur4c457
# The name of the AzuraCast database.
# Default: azuracast
MYSQL_DATABASE=azuracast
# Automatically generate a random root password upon the first database spin-up.
# This password will be visible in the mariadb container's logs.
# Default: yes
MYSQL_RANDOM_ROOT_PASSWORD=yes
# Log slower queries for the purpose of diagnosing issues. Only turn this on when
# you need to, by uncommenting this and switching it to 1.
# To read the slow query log once enabled, run:
# docker-compose exec mariadb slow_queries
# Default: 0
MYSQL_SLOW_QUERY_LOG=0
# Set the amount of allowed connections to the database. This value should be increased
# if you are seeing the `Too many connections` error in the logs.
# Default: 100
MYSQL_MAX_CONNECTIONS=100
#
# Redis Configuration
#
# Uncomment these fields if you are using a third-party Redis host instead of the one provided with AzuraCast.
# Do not modify these fields if you are using the standard AzuraCast Redis host.
#
# Whether to use the Redis cache; if set to false, will disable Redis and use flatfile cache instead.
# Default: true
# ENABLE_REDIS=true
# Name of the Redis host.
# Default: redis
# REDIS_HOST=redis
# Port to connect to on the Redis host.
# Default: 6379
# REDIS_PORT=6379
# Database index to use on the Redis host.
# Default: 1
# REDIS_DB=1
#
# Advanced Configuration
#
# PHP's maximum POST body size and max upload filesize.
# PHP_MAX_FILE_SIZE=25M
# PHP's maximum memory limit.
# PHP_MEMORY_LIMIT=128M
# PHP's maximum script execution time (in seconds).
# PHP_MAX_EXECUTION_TIME=30
# The maximum execution time (and lock timeout) for the 15-second, 1-minute and 5-minute synchronization tasks.
# SYNC_SHORT_EXECUTION_TIME=600
# The maximum execution time (and lock timeout) for the 1-hour synchronization task.
# SYNC_LONG_EXECUTION_TIME=1800
# Maximum number of PHP-FPM worker processes to spawn.
# PHP_FPM_MAX_CHILDREN=5
#
# PHP-SPX profiling extension Configuration
#
# These environment variables allow you to enable and configure the PHP-SPX profiling extension
# which can be helpful when debugging resource issues in AzuraCast.
#
# The profiling dashboard can be accessed by visting https://yourdomain.com/?SPX_KEY=dev&SPX_UI_URI=/
# If you change the PROFILING_EXTENSION_HTTP_KEY variable change the value for SPX_KEY accordingly.
#
# Enable the profiling extension.
# Profiling data can be viewed by visiting http://your-azuracast-site/?SPX_KEY=dev&SPX_UI_URI=/
# Default: 0
# PROFILING_EXTENSION_ENABLED=0
# Profile ALL requests made to this account.
# This will have significant performance impact on your installation and should only be used in test circumstances.
# Default: 0
# PROFILING_EXTENSION_ALWAYS_ON=0
# Configure the value for the SPX_KEY parameter needed to access the profiling dashboard
# Default: dev
# PROFILING_EXTENSION_HTTP_KEY=dev
# Configure the IP whitelist for the profiling dashboard
# By default only localhost is allowed to access this page.
# Uncomment this line to enable access for you.
# Default: 127.0.0.1
# PROFILING_EXTENSION_HTTP_IP_WHITELIST=*

View file

@ -0,0 +1,161 @@
#
# AzuraCast Customization
#
# The application environment.
# Valid options: production, development, testing
APPLICATION_ENV=production
# Manually modify the logging level.
# This allows you to log debug-level errors temporarily (for problem-solving) or reduce
# the volume of logs that are produced by your installation, without needing to modify
# whether your installation is a production or development instance.
# Valid options: debug, info, notice, warning, error, critical, alert, emergency
# LOG_LEVEL=notice
# 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
# you use one or more plugins with their own Composer dependencies.
# Valid options: true, false
COMPOSER_PLUGIN_MODE=false
# The minimum port number to use when automatically assigning ports to a station.
# By default, this matches the first forwarded port on the "stations" container.
# You can modify this variable if your station port range is different.
# Be sure to also forward the necessary ports via `docker-compose.yml`
# (and nginx, if you want to use the built-in port-80/443 proxy)!
AUTO_ASSIGN_PORT_MIN=8000
# The maximum port number to use when automatically assigning ports to a station.
# See AUTO_ASSIGN_PORT_MIN.
AUTO_ASSIGN_PORT_MAX=8499
# This allows you to debug Slim Application Errors you may encounter
# By default, this is disabled to prevent users from seeing privileged information
# Please report any Slim Application Error logs to the development team on GitHub
# Valid options: true, false
SHOW_DETAILED_ERRORS=false
#
# Database Configuration
# --
# Once the database has been installed, DO NOT CHANGE these values!
#
# The host to connect to. Leave this as the default value unless you're connecting
# to an external database server.
# Default: localhost
# MYSQL_HOST=localhost
# The port to connect to. Leave this as the default value unless you're connecting
# to an external database server.
# Default: 3306
# MYSQL_PORT=3306
# The username AzuraCast will use to connect to the database.
# Default: azuracast
# MYSQL_USER=azuracast
# The password AzuraCast will use to connect to the database.
# By default, the database is not exposed to the Internet at all and this is only
# an internal password used by the service itself.
# Default: azur4c457
MYSQL_PASSWORD=azur4c457
# The name of the AzuraCast database.
# Default: azuracast
# MYSQL_DATABASE=azuracast
# Automatically generate a random root password upon the first database spin-up.
# This password will be visible in the mariadb container's logs.
# Default: yes
MYSQL_RANDOM_ROOT_PASSWORD=yes
# Log slower queries for the purpose of diagnosing issues. Only turn this on when
# you need to, by uncommenting this and switching it to 1.
# To read the slow query log once enabled, run:
# docker-compose exec mariadb slow_queries
# Default: 0
# MYSQL_SLOW_QUERY_LOG=0
# Set the amount of allowed connections to the database. This value should be increased
# if you are seeing the `Too many connections` error in the logs.
# Default: 100
# MYSQL_MAX_CONNECTIONS=100
#
# Redis Configuration
#
# Uncomment these fields if you are using a third-party Redis host instead of the one provided with AzuraCast.
# Do not modify these fields if you are using the standard AzuraCast Redis host.
#
# Whether to use the Redis cache; if set to false, will disable Redis and use flatfile cache instead.
# Default: true
# ENABLE_REDIS=true
# Name of the Redis host.
# Default: localhost
# REDIS_HOST=localhost
# Port to connect to on the Redis host.
# Default: 6379
# REDIS_PORT=6379
# Database index to use on the Redis host.
# Default: 1
# REDIS_DB=1
#
# Advanced Configuration
#
# PHP's maximum POST body size and max upload filesize.
# PHP_MAX_FILE_SIZE=25M
# PHP's maximum memory limit.
# PHP_MEMORY_LIMIT=128M
# PHP's maximum script execution time (in seconds).
# PHP_MAX_EXECUTION_TIME=30
# The maximum execution time (and lock timeout) for the 15-second, 1-minute and 5-minute synchronization tasks.
# SYNC_SHORT_EXECUTION_TIME=600
# The maximum execution time (and lock timeout) for the 1-hour synchronization task.
# SYNC_LONG_EXECUTION_TIME=1800
# Maximum number of PHP-FPM worker processes to spawn.
# PHP_FPM_MAX_CHILDREN=5
#
# PHP-SPX profiling extension Configuration
#
# These environment variables allow you to enable and configure the PHP-SPX profiling extension
# which can be helpful when debugging resource issues in AzuraCast.
#
# The profiling dashboard can be accessed by visting https://yourdomain.com/?SPX_KEY=dev&SPX_UI_URI=/
# If you change the PROFILING_EXTENSION_HTTP_KEY variable change the value for SPX_KEY accordingly.
#
# Enable the profiling extension.
# Profiling data can be viewed by visiting http://your-azuracast-site/?SPX_KEY=dev&SPX_UI_URI=/
# Default: 0
# PROFILING_EXTENSION_ENABLED=0
# Profile ALL requests made to this account.
# This will have significant performance impact on your installation and should only be used in test circumstances.
# Default: 0
# PROFILING_EXTENSION_ALWAYS_ON=0
# Configure the value for the SPX_KEY parameter needed to access the profiling dashboard
# Default: dev
# PROFILING_EXTENSION_HTTP_KEY=dev
# Configure the IP whitelist for the profiling dashboard
# By default only localhost is allowed to access this page.
# Uncomment this line to enable access for you.
# Default: 127.0.0.1
# PROFILING_EXTENSION_HTTP_IP_WHITELIST=*

View file

@ -0,0 +1,214 @@
#
# AzuraCast Docker Compose Configuration File
#
# When updating, you will be prompted to replace this file with a new
# version; you should do this whenever possible to take advantage of
# new updates.
#
# If you need to customize this file, you can create a new file named:
# docker-compose.override.yml
# with any changes you need to make.
#
services:
web:
container_name: azuracast
image: "ghcr.io/azuracast/azuracast:${AZURACAST_VERSION:-latest}"
# Want to customize the HTTP/S ports? Follow the instructions here:
# https://docs.azuracast.com/en/administration/docker#using-non-standard-ports
ports:
- '${AZURACAST_HTTP_PORT:-80}:80'
- '${AZURACAST_HTTPS_PORT:-443}:443'
- '${AZURACAST_SFTP_PORT:-2022}:2022'
# 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.
# For instructions, see:
# https://docs.azuracast.com/en/administration/docker#expanding-the-station-port-range
- '8000:8000'
- '8005:8005'
- '8006:8006'
- '8010:8010'
- '8015:8015'
- '8016:8016'
- '8020:8020'
- '8025:8025'
- '8026:8026'
- '8030:8030'
- '8035:8035'
- '8036:8036'
- '8040:8040'
- '8045:8045'
- '8046:8046'
- '8050:8050'
- '8055:8055'
- '8056:8056'
- '8060:8060'
- '8065:8065'
- '8066:8066'
- '8070:8070'
- '8075:8075'
- '8076:8076'
- '8090:8090'
- '8095:8095'
- '8096:8096'
- '8100:8100'
- '8105:8105'
- '8106:8106'
- '8110:8110'
- '8115:8115'
- '8116:8116'
- '8120:8120'
- '8125:8125'
- '8126:8126'
- '8130:8130'
- '8135:8135'
- '8136:8136'
- '8140:8140'
- '8145:8145'
- '8146:8146'
- '8150:8150'
- '8155:8155'
- '8156:8156'
- '8160:8160'
- '8165:8165'
- '8166:8166'
- '8170:8170'
- '8175:8175'
- '8176:8176'
- '8180:8180'
- '8185:8185'
- '8186:8186'
- '8190:8190'
- '8195:8195'
- '8196:8196'
- '8200:8200'
- '8205:8205'
- '8206:8206'
- '8210:8210'
- '8215:8215'
- '8216:8216'
- '8220:8220'
- '8225:8225'
- '8226:8226'
- '8230:8230'
- '8235:8235'
- '8236:8236'
- '8240:8240'
- '8245:8245'
- '8246:8246'
- '8250:8250'
- '8255:8255'
- '8256:8256'
- '8260:8260'
- '8265:8265'
- '8266:8266'
- '8270:8270'
- '8275:8275'
- '8276:8276'
- '8280:8280'
- '8285:8285'
- '8286:8286'
- '8290:8290'
- '8295:8295'
- '8296:8296'
- '8300:8300'
- '8305:8305'
- '8306:8306'
- '8310:8310'
- '8315:8315'
- '8316:8316'
- '8320:8320'
- '8325:8325'
- '8326:8326'
- '8330:8330'
- '8335:8335'
- '8336:8336'
- '8340:8340'
- '8345:8345'
- '8346:8346'
- '8350:8350'
- '8355:8355'
- '8356:8356'
- '8360:8360'
- '8365:8365'
- '8366:8366'
- '8370:8370'
- '8375:8375'
- '8376:8376'
- '8380:8380'
- '8385:8385'
- '8386:8386'
- '8390:8390'
- '8395:8395'
- '8396:8396'
- '8400:8400'
- '8405:8405'
- '8406:8406'
- '8410:8410'
- '8415:8415'
- '8416:8416'
- '8420:8420'
- '8425:8425'
- '8426:8426'
- '8430:8430'
- '8435:8435'
- '8436:8436'
- '8440:8440'
- '8445:8445'
- '8446:8446'
- '8450:8450'
- '8455:8455'
- '8456:8456'
- '8460:8460'
- '8465:8465'
- '8466:8466'
- '8470:8470'
- '8475:8475'
- '8476:8476'
- '8480:8480'
- '8485:8485'
- '8486:8486'
- '8490:8490'
- '8495:8495'
- '8496:8496'
env_file: azuracast.env
environment:
LANG: ${LANG:-en_US.UTF-8}
AZURACAST_DC_REVISION: 14
AZURACAST_VERSION: ${AZURACAST_VERSION:-latest}
AZURACAST_SFTP_PORT: ${AZURACAST_SFTP_PORT:-2022}
NGINX_TIMEOUT: ${NGINX_TIMEOUT:-1800}
LETSENCRYPT_HOST: ${LETSENCRYPT_HOST:-}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-}
PUID: ${AZURACAST_PUID:-1000}
PGID: ${AZURACAST_PGID:-1000}
volumes:
- www_uploads:/var/azuracast/uploads
- station_data:/var/azuracast/stations
- shoutcast2_install:/var/azuracast/servers/shoutcast2
- stereo_tool_install:/var/azuracast/servers/stereo_tool
- geolite_install:/var/azuracast/geoip
- sftpgo_data:/var/azuracast/sftpgo/persist
- backups:/var/azuracast/backups
- acme:/var/azuracast/acme
- db_data:/var/lib/mysql
restart: unless-stopped
ulimits: &default-ulimits
nofile:
soft: 65536
hard: 65536
logging: &default-logging
options:
max-size: "1m"
max-file: "5"
volumes:
db_data: { }
acme: { }
shoutcast2_install: { }
stereo_tool_install: { }
geolite_install: { }
sftpgo_data: { }
station_data: { }
www_uploads: { }
backups: { }

View file

@ -0,0 +1,840 @@
#!/usr/bin/env bash
# shellcheck disable=SC2145,SC2178,SC2120,SC2162
# Functions to manage .env files
__dotenv=
__dotenv_file=
__dotenv_cmd=.env
.env() {
REPLY=()
[[ $__dotenv_file || ${1-} == -* ]] || .env.--file .env || return
if declare -F -- ".env.${1-}" >/dev/null; then
.env."$@"
return
fi
return 64
}
.env.-f() { .env.--file "$@"; }
.env.get() {
.env::arg "get requires a key" "$@" &&
[[ "$__dotenv" =~ ^(.*(^|$'\n'))([ ]*)"$1="(.*)$ ]] &&
REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"}
}
.env.parse() {
local line key
while IFS= read -r line; do
line=${line#"${line%%[![:space:]]*}"} # trim leading whitespace
line=${line%"${line##*[![:space:]]}"} # trim trailing whitespace
if [[ ! "$line" || "$line" == '#'* ]]; then continue; fi
if (($#)); then
for key; do
if [[ $key == "${line%%=*}" ]]; then
REPLY+=("$line")
break
fi
done
else
REPLY+=("$line")
fi
done <<<"$__dotenv"
((${#REPLY[@]}))
}
.env.export() { ! .env.parse "$@" || export "${REPLY[@]}"; }
.env.set() {
.env::file load || return
local key saved=$__dotenv
while (($#)); do
key=${1#+}
key=${key%%=*}
if .env.get "$key"; then
REPLY=()
if [[ $1 == +* ]]; then
shift
continue # skip if already found
elif [[ $1 == *=* ]]; then
__dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[3]}$1$'\n'${BASH_REMATCH[4]#*$'\n'}
else
__dotenv=${BASH_REMATCH[1]}${BASH_REMATCH[4]#*$'\n'}
continue # delete all occurrences
fi
elif [[ $1 == *=* ]]; then
__dotenv+="${1#+}"$'\n'
fi
shift
done
[[ $__dotenv == "$saved" ]] || .env::file save
}
.env.puts() { echo "${1-}" >>"$__dotenv_file" && __dotenv+="$1"$'\n'; }
.env.generate() {
.env::arg "key required for generate" "$@" || return
.env.get "$1" && return || REPLY=$("${@:2}") || return
.env::one "generate: ouptut of '${*:2}' has more than one line" "$REPLY" || return
.env.puts "$1=$REPLY"
}
.env.--file() {
.env::arg "filename required for --file" "$@" || return
__dotenv_file=$1
.env::file load || return
(($# < 2)) || .env "${@:2}"
}
.env::arg() { [[ "${2-}" ]] || {
echo "$__dotenv_cmd: $1" >&2
return 64
}; }
.env::one() { [[ "$2" != *$'\n'* ]] || .env::arg "$1"; }
.env::file() {
local REPLY=$__dotenv_file
case "$1" in
load)
__dotenv=
! [[ -f "$REPLY" ]] || __dotenv="$(<"$REPLY")"$'\n' || return
;;
save)
if [[ -L "$REPLY" ]] && declare -F -- realpath.resolved >/dev/null; then
realpath.resolved "$REPLY"
fi
{ [[ ! -f "$REPLY" ]] || cp -p "$REPLY" "$REPLY.bak"; } &&
printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY"
;;
esac
}
# Shortcut to convert semver version (x.yyy.zzz) into a comparable number.
version-number() {
echo "$@" | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'
}
# Get the current release channel for AzuraCast
get-release-channel() {
local AZURACAST_VERSION="latest"
if [[ -f .env ]]; then
.env --file .env get AZURACAST_VERSION
AZURACAST_VERSION="${REPLY:-latest}"
fi
echo "$AZURACAST_VERSION"
}
get-release-branch-name() {
if [[ $(get-release-channel) == "stable" ]]; then
echo "stable"
else
echo "main"
fi
}
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# https://djm.me/ask
local prompt default reply
while true; do
if [[ "${2:-}" == "Y" ]]; then
prompt="Y/n"
default=Y
elif [[ "${2:-}" == "N" ]]; then
prompt="y/N"
default=N
else
prompt="y/n"
default=
fi
# Ask the question (not using "read -p" as it uses stderr not stdout)
echo -n "$1 [$prompt] "
read reply
# Default?
if [[ -z "$reply" ]]; then
reply=${default}
fi
# Check if the reply is valid
case "$reply" in
Y* | y*) return 0 ;;
N* | n*) return 1 ;;
esac
done
}
# Generate a prompt to set an environment file value.
envfile-set() {
local VALUE INPUT
.env --file .env
.env get "$1"
VALUE=${REPLY:-$2}
echo -n "$3 [$VALUE]: "
read INPUT
VALUE=${INPUT:-$VALUE}
.env set "${1}=${VALUE}"
}
#
# Configure the ports used by AzuraCast.
#
setup-ports() {
envfile-set "AZURACAST_HTTP_PORT" "80" "Port to use for HTTP connections"
envfile-set "AZURACAST_HTTPS_PORT" "443" "Port to use for HTTPS connections"
envfile-set "AZURACAST_SFTP_PORT" "2022" "Port to use for SFTP connections"
}
#
# Configure release mode settings.
#
setup-release() {
if [[ ! -f .env ]]; then
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/main/sample.env -o .env
fi
local OLD_RELEASE_CHANNEL
.env --file .env get AZURACAST_VERSION
OLD_RELEASE_CHANNEL="${REPLY:-latest}"
local AZURACAST_VERSION="${OLD_RELEASE_CHANNEL}"
if [[ $AZURACAST_VERSION == "latest" ]]; then
if ask "Your current release channel is 'Rolling Release'. Switch to 'Stable' release channel?" N; then
AZURACAST_VERSION="stable"
fi
elif [[ $AZURACAST_VERSION == "stable" ]]; then
if ask "Your current release channel is 'Stable'. Switch to 'Rolling Release' release channel?" N; then
AZURACAST_VERSION="latest"
fi
fi
.env --file .env set AZURACAST_VERSION=${AZURACAST_VERSION}
if [[ $AZURACAST_VERSION != $OLD_RELEASE_CHANNEL ]]; then
if ask "You should update the Docker Utility Script after changing release channels. Automatically update it now?" Y; then
update-self
fi
fi
}
check-install-requirements() {
local CURRENT_OS CURRENT_ARCH REQUIRED_COMMANDS SCRIPT_DIR
set -e
echo "Checking installation requirements for AzuraCast..."
CURRENT_OS=$(uname -s)
if [[ $CURRENT_OS == "Linux" ]]; then
echo -en "\e[32m[PASS]\e[0m Operating System: ${CURRENT_OS}\n"
else
echo -en "\e[41m[FAIL]\e[0m Operating System: ${CURRENT_OS}\n"
echo " You are running an unsupported operating system."
echo " Automated AzuraCast installation is not currently supported on this"
echo " operating system."
exit 1
fi
CURRENT_ARCH=$(uname -m)
if [[ $CURRENT_ARCH == "x86_64" ]]; then
echo -en "\e[32m[PASS]\e[0m Architecture: ${CURRENT_ARCH}\n"
elif [[ $CURRENT_ARCH == "aarch64" ]]; then
echo -en "\e[32m[PASS]\e[0m Architecture: ${CURRENT_ARCH}\n"
else
echo -en "\e[41m[FAIL]\e[0m Architecture: ${CURRENT_ARCH}\n"
echo " You are running an unsupported processor architecture."
echo " Automated AzuraCast installation is not currently supported on this "
echo " operating system."
exit 1
fi
REQUIRED_COMMANDS=(curl awk)
for COMMAND in "${REQUIRED_COMMANDS[@]}" ; do
if [[ $(command -v "$COMMAND") ]]; then
echo -en "\e[32m[PASS]\e[0m Command Present: ${COMMAND}\n"
else
echo -en "\e[41m[FAIL]\e[0m Command Present: ${COMMAND}\n"
echo " ${COMMAND} does not appear to be installed."
echo " Install ${COMMAND} using your host's package manager,"
echo " then continue installing using this script."
exit 1
fi
done
if [[ $EUID -ne 0 ]]; then
if [[ $(command -v sudo) ]]; then
echo -en "\e[32m[PASS]\e[0m User Permissions\n"
else
echo -en "\e[41m[FAIL]\e[0m User Permissions\n"
echo " You are not currently the root user, and "
echo " 'sudo' does not appear to be installed."
echo " Install sudo using your host's package manager,"
echo " then continue installing using this script."
exit 1
fi
else
echo -en "\e[32m[PASS]\e[0m User Permissions\n"
fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
if [[ $SCRIPT_DIR == "/var/azuracast" ]]; then
echo -en "\e[32m[PASS]\e[0m Installation Directory\n"
else
echo -en "\e[93m[WARN]\e[0m Installation Directory\n"
echo " AzuraCast is not installed in /var/azuracast, as is recommended"
echo " for most installations. This will not prevent AzuraCast from"
echo " working, but you will need to update any instructions in our"
echo " documentation to reflect your current directory:"
echo " $SCRIPT_DIR"
fi
echo -en "\e[32m[PASS]\e[0m All requirements met!\n"
set +e
}
install-docker() {
set -e
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
rm get-docker.sh
if [[ $EUID -ne 0 ]]; then
sudo usermod -aG docker "$(whoami)"
echo "You must log out or restart to apply necessary Docker permissions changes."
echo "Restart, then continue installing using this script."
exit 1
fi
set +e
}
install-docker-compose() {
set -e
echo "Installing Docker Compose..."
curl -fsSL -o docker-compose https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-linux-$(uname -m)
ARCHITECTURE=amd64
if [ "$(uname -m)" = "aarch64" ]; then
ARCHITECTURE=arm64
fi
curl -fsSL -o docker-compose-switch https://github.com/docker/compose-switch/releases/download/v1.0.4/docker-compose-linux-${ARCHITECTURE}
if [[ $EUID -ne 0 ]]; then
sudo chmod a+x ./docker-compose
sudo chmod a+x ./docker-compose-switch
sudo mv ./docker-compose /usr/libexec/docker/cli-plugins/docker-compose
sudo mv ./docker-compose-switch /usr/local/bin/docker-compose
else
chmod a+x ./docker-compose
chmod a+x ./docker-compose-switch
mv ./docker-compose /usr/libexec/docker/cli-plugins/docker-compose
mv ./docker-compose-switch /usr/local/bin/docker-compose
fi
echo "Docker Compose updated!"
set +e
}
run-installer() {
local AZURACAST_RELEASE_BRANCH
AZURACAST_RELEASE_BRANCH=$(get-release-branch-name)
if [[ ! -f .env ]]; then
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/sample.env -o .env
fi
if [[ ! -f azuracast.env ]]; then
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/azuracast.sample.env -o azuracast.env
fi
if [[ ! -f docker-compose.yml ]]; then
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/docker-compose.sample.yml -o docker-compose.yml
fi
touch docker-compose.new.yml
local dc_config_test=$(docker-compose -f docker-compose.new.yml config 2>/dev/null)
if [ $? -ne 0 ]; then
if ask "Docker Compose needs to be updated to continue. Update to latest version?" Y; then
install-docker-compose
fi
fi
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/docker-compose.installer.yml -o docker-compose.installer.yml
docker-compose -p azuracast_installer -f docker-compose.installer.yml pull
docker-compose -p azuracast_installer -f docker-compose.installer.yml run --rm installer install "$@"
rm docker-compose.installer.yml
}
#
# Run the initial installer of Docker and AzuraCast.
# Usage: ./docker.sh install
#
install() {
check-install-requirements
if [[ $(command -v docker) && $(docker --version) ]]; then
echo "Docker is already installed! Continuing..."
else
if ask "Docker does not appear to be installed. Install Docker now?" Y; then
install-docker
fi
fi
if [[ $(command -v docker-compose) ]]; then
echo "Docker Compose is already installed. Continuing..."
else
if ask "Docker Compose does not appear to be installed. Install Docker Compose now?" Y; then
install-docker-compose
fi
fi
setup-release
run-installer "$@"
# Installer creates a file at docker-compose.new.yml; copy it to the main spot.
if [[ -s docker-compose.new.yml ]]; then
if [[ -f docker-compose.yml ]]; then
rm docker-compose.yml
fi
mv docker-compose.new.yml docker-compose.yml
fi
# If this script is running as a non-root user, set the PUID/PGID in the environment vars appropriately.
if [[ $EUID -ne 0 ]]; then
.env --file .env set AZURACAST_PUID="$(id -u)"
.env --file .env set AZURACAST_PGID="$(id -g)"
fi
docker-compose pull
docker-compose run --rm web -- azuracast_install "$@"
docker-compose up -d
exit
}
install-dev() {
if [[ $(command -v docker) && $(docker --version) ]]; then
echo "Docker is already installed! Continuing..."
else
if ask "Docker does not appear to be installed. Install Docker now?" Y; then
install-docker
fi
fi
if [[ $(command -v docker-compose) ]]; then
echo "Docker Compose is already installed. Continuing..."
else
if ask "Docker Compose does not appear to be installed. Install Docker Compose now?" Y; then
install-docker-compose
fi
fi
if [[ ! -f docker-compose.yml ]]; then
cp docker-compose.sample.yml docker-compose.yml
fi
if [[ ! -f docker-compose.override.yml ]]; then
cp docker-compose.dev.yml docker-compose.override.yml
fi
if [[ ! -f .env ]]; then
cp dev.env .env
fi
if [[ ! -f azuracast.env ]]; then
cp azuracast.dev.env azuracast.env
echo "Customize azuracast.env file now before continuing. Re-run this command to continue installation."
exit
fi
# If this script is running as a non-root user, set the PUID/PGID in the environment vars appropriately.
if [[ $EUID -ne 0 ]]; then
.env --file .env set AZURACAST_PUID="$(id -u)"
.env --file .env set AZURACAST_PGID="$(id -g)"
fi
chmod 777 ./frontend/ ./web/ ./vendor/ \
./web/static/ ./web/static/api/ \
./web/static/dist/ ./web/static/img/
docker-compose build
docker-compose run --rm web -- azuracast_install "$@"
docker-compose -p azuracast_frontend -f docker-compose.frontend.yml build
docker-compose -p azuracast_frontend -f docker-compose.frontend.yml run --rm frontend npm run build
docker-compose up -d
exit
}
#
# Update the Docker images and codebase.
# Usage: ./docker.sh update
#
update() {
echo "[NOTICE] Before you continue, please make sure you have a recent snapshot of your system and or backed it up."
if ask "Are you ready to continue with the update?" Y; then
# Check for a new Docker Utility Script.
local AZURACAST_RELEASE_BRANCH
AZURACAST_RELEASE_BRANCH=$(get-release-branch-name)
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/docker.sh -o docker.new.sh
local UTILITY_FILES_MATCH
UTILITY_FILES_MATCH="$(
cmp --silent docker.sh docker.new.sh
echo $?
)"
local UPDATE_UTILITY=0
if [[ ${UTILITY_FILES_MATCH} -ne 0 ]]; then
if ask "The Docker Utility Script has changed since your version. Update to latest version?" Y; then
UPDATE_UTILITY=1
fi
fi
if [[ ${UPDATE_UTILITY} -ne 0 ]]; then
mv docker.new.sh docker.sh
chmod a+x docker.sh
echo "A new Docker Utility Script has been downloaded."
echo "Please re-run the update process to continue."
exit
else
rm docker.new.sh
fi
run-installer --update "$@"
# Check for updated Docker Compose config.
local COMPOSE_FILES_MATCH
if [[ ! -s docker-compose.new.yml ]]; then
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/docker-compose.sample.yml -o docker-compose.new.yml
fi
COMPOSE_FILES_MATCH="$(
cmp --silent docker-compose.yml docker-compose.new.yml
echo $?
)"
if [[ ${COMPOSE_FILES_MATCH} -ne 0 ]]; then
docker-compose -f docker-compose.new.yml pull
docker-compose down
cp docker-compose.yml docker-compose.backup.yml
mv docker-compose.new.yml docker-compose.yml
else
rm docker-compose.new.yml
docker-compose pull
docker-compose down
fi
docker-compose run --rm web -- azuracast_update "$@"
docker-compose up -d
if ask "Clean up all stopped Docker containers and images to save space?" Y; then
docker system prune -f
fi
echo "Update complete!"
fi
exit
}
#
# Update this Docker utility script.
# Usage: ./docker.sh update-self
#
update-self() {
local AZURACAST_RELEASE_BRANCH
AZURACAST_RELEASE_BRANCH=$(get-release-branch-name)
curl -fsSL https://raw.githubusercontent.com/AzuraCast/AzuraCast/$AZURACAST_RELEASE_BRANCH/docker.sh -o docker.sh
chmod a+x docker.sh
echo "New Docker utility script downloaded."
exit
}
#
# Run a CLI command inside the Docker container.
# Usage: ./docker.sh cli [command]
#
cli() {
docker-compose exec --user="azuracast" web azuracast_cli "$@"
exit
}
#
# Enter the bash terminal of the running web container.
# Usage: ./docker.sh bash
#
bash() {
docker-compose exec --user="azuracast" web bash
exit
}
#
# Enter the MariaDB database management terminal with the correct credentials.
#
db() {
local MYSQL_HOST MYSQL_PORT MYSQL_USER MYSQL_PASSWORD MYSQL_DATABASE
.env --file azuracast.env get MYSQL_HOST
MYSQL_HOST="${REPLY:-localhost}"
.env --file azuracast.env get MYSQL_PORT
MYSQL_PORT="${REPLY:-3306}"
.env --file azuracast.env get MYSQL_USER
MYSQL_USER="${REPLY:-azuracast}"
.env --file azuracast.env get MYSQL_PASSWORD
MYSQL_PASSWORD="${REPLY:-azur4c457}"
.env --file azuracast.env get MYSQL_DATABASE
MYSQL_DATABASE="${REPLY:-azuracast}"
docker-compose exec --user="mysql" web mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} \
--host=${MYSQL_HOST} --port=${MYSQL_PORT} --database=${MYSQL_DATABASE}
exit
}
#
# Back up the Docker volumes to a .tar.gz file.
# Usage:
# ./docker.sh backup [/custom/backup/dir/custombackupname.zip]
#
backup() {
local BACKUP_PATH BACKUP_DIR BACKUP_FILENAME BACKUP_EXT
BACKUP_PATH=$(readlink -f ${1:-"./backup.tar.gz"})
BACKUP_DIR=$(dirname -- "$BACKUP_PATH")
BACKUP_FILENAME=$(basename -- "$BACKUP_PATH")
BACKUP_EXT="${BACKUP_FILENAME##*.}"
shift
# Prepare permissions
if [[ $EUID -ne 0 ]]; then
.env --file .env set AZURACAST_PUID="$(id -u)"
.env --file .env set AZURACAST_PGID="$(id -g)"
fi
docker-compose exec --user="azuracast" web azuracast_cli azuracast:backup "/var/azuracast/backups/${BACKUP_FILENAME}" "$@"
# Move from Docker volume to local filesystem
docker run --rm -v "azuracast_backups:/backup_src" \
-v "$BACKUP_DIR:/backup_dest" \
busybox mv "/backup_src/${BACKUP_FILENAME}" "/backup_dest/${BACKUP_FILENAME}"
}
#
# Restore an AzuraCast backup into Docker.
# Usage:
# ./docker.sh restore [/custom/backup/dir/custombackupname.zip]
#
restore() {
if [[ ! -f .env ]] || [[ ! -f azuracast.env ]]; then
echo "AzuraCast hasn't been installed yet on this server."
echo "You should run './docker.sh install' first before restoring."
exit 1
fi
if ask "Restoring will remove any existing AzuraCast installation data, replacing it with your backup. Continue?" Y; then
if [[ $1 != "" ]]; then
local BACKUP_PATH BACKUP_DIR BACKUP_FILENAME BACKUP_EXT
BACKUP_PATH=$(readlink -f ${1:-"./backup.tar.gz"})
BACKUP_DIR=$(dirname -- "$BACKUP_PATH")
BACKUP_FILENAME=$(basename -- "$BACKUP_PATH")
BACKUP_EXT="${BACKUP_FILENAME##*.}"
shift
if [[ ! -f ${BACKUP_PATH} ]]; then
echo "File '${BACKUP_PATH}' does not exist. Nothing to restore."
exit 1
fi
docker-compose down -v
docker volume create azuracast_backups
# Move from local filesystem to Docker volume
docker run --rm -v "$BACKUP_DIR:/backup_src" \
-v "azuracast_backups:/backup_dest" \
busybox mv "/backup_src/${BACKUP_FILENAME}" "/backup_dest/${BACKUP_FILENAME}"
# Prepare permissions
if [[ $EUID -ne 0 ]]; then
.env --file .env set AZURACAST_PUID="$(id -u)"
.env --file .env set AZURACAST_PGID="$(id -g)"
fi
docker-compose run --rm web -- azuracast_restore "/var/azuracast/backups/${BACKUP_FILENAME}" "$@"
# Move file back from volume to local filesystem
docker run --rm -v "azuracast_backups:/backup_src" \
-v "$BACKUP_DIR:/backup_dest" \
busybox mv "/backup_src/${BACKUP_FILENAME}" "/backup_dest/${BACKUP_FILENAME}"
docker-compose down
docker-compose up -d
else
docker-compose down
# Remove all volumes except the backup volume.
docker volume rm -f $(docker volume ls | grep -v "azuracast_backups" | awk 'NR>1 {print $2}')
docker-compose run --rm web -- azuracast_restore "$@"
docker-compose down
docker-compose up -d
fi
fi
exit
}
#
# Restore the Docker volumes from a legacy backup format .tar.gz file.
# Usage:
# ./docker.sh restore [/custom/backup/dir/custombackupname.tar.gz]
#
restore-legacy() {
local APP_BASE_DIR BACKUP_PATH BACKUP_DIR BACKUP_FILENAME
APP_BASE_DIR=$(pwd)
BACKUP_PATH=${1:-"./backup.tar.gz"}
BACKUP_DIR=$(cd "$(dirname "$BACKUP_PATH")" && pwd)
BACKUP_FILENAME=$(basename "$BACKUP_PATH")
cd "$APP_BASE_DIR" || exit
if [ -f "$BACKUP_PATH" ]; then
docker-compose down
docker volume rm azuracast_db_data azuracast_station_data
docker volume create azuracast_db_data
docker volume create azuracast_station_data
docker run --rm -v "$BACKUP_DIR:/backup" \
-v azuracast_db_data:/azuracast/db \
-v azuracast_station_data:/azuracast/stations \
busybox tar zxvf "/backup/$BACKUP_FILENAME"
docker-compose up -d
else
echo "File $BACKUP_PATH does not exist in this directory. Nothing to restore."
exit 1
fi
exit
}
#
# DEVELOPER TOOL:
# Access the static console as a developer.
# Usage: ./docker.sh static [static_container_command]
#
static() {
docker-compose -f docker-compose.frontend.yml down -v
docker-compose -f docker-compose.frontend.yml build
docker-compose --env-file=.env -f docker-compose.frontend.yml run --rm frontend "$@"
exit
}
#
# Stop all Docker containers and remove related volumes.
# Usage: ./docker.sh uninstall
#
uninstall() {
if ask "This operation is destructive and will wipe your existing Docker containers. Continue?" N; then
docker-compose down -v
docker-compose rm -f
docker volume prune -f
echo "All AzuraCast Docker containers and volumes were removed."
echo "To remove *all* Docker containers and volumes, run:"
echo " docker stop \$(docker ps -a -q)"
echo " docker rm \$(docker ps -a -q)"
echo " docker volume prune -f"
echo ""
fi
exit
}
#
# LetsEncrypt: Now managed via the Web UI.
#
setup-letsencrypt() {
echo "LetsEncrypt is now managed from within the web interface."
}
letsencrypt-create() {
setup-letsencrypt
exit
}
#
# Utility script to facilitate switching ports.
# Usage: ./docker.sh change-ports
#
change-ports() {
setup-ports
docker-compose down
docker-compose up -d
}
#
# Helper scripts for basic Docker Compose functions
#
up() {
echo "Starting up AzuraCast services..."
docker-compose up -d
}
down() {
echo "Shutting down AzuraCast services..."
docker-compose down
}
restart() {
down
up
}
# Ensure we're in the same directory as this script.
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
"$@"

View file

@ -0,0 +1 @@
The three file found here are mentioned in docker.sh's run-installer() with 'sample.' added to the filename

View file

@ -0,0 +1,11 @@
COMPOSE_PROJECT_NAME=azuracast
AZURACAST_HTTP_PORT=80
AZURACAST_HTTPS_PORT=443
AZURACAST_SFTP_PORT=2022
AZURACAST_PUID=1000
AZURACAST_PGID=1000
NGINX_TIMEOUT=1800

View file

@ -378,8 +378,8 @@ nodocs: False
# Simple, Self-Hosted Web Radio - from AzuraCast.com
azuracast_install: False
azuracast_enabled: False # This var is currently IGNORED
azuracast_http_port: 10080
azuracast_https_port: 10443
azuracast_http_port: 12080
azuracast_https_port: 12443
#
# AzuraCast needs many ports in the 8000:8100 range by default, but IIAB
# services conflict with those ports so this variable below sets a sane prefix.