Update the Docker Compose file to use an external .env file for settings.

This commit is contained in:
Buster "Silver Eagle" Neece 2018-10-18 23:27:30 -05:00
parent 2995a2214e
commit 5ee858f615
6 changed files with 119 additions and 28 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ tmp/cache/*---*
/app/env.ini
/app/.env
/env.ini
/azuracast.env
/util/fixtures/*
/util/fixtures/**/*
!/util/fixtures/.gitkeep

51
azuracast.dev.env Normal file
View File

@ -0,0 +1,51 @@
#
# AzuraCast Customization
#
# The application environment.
# Valid options: production or development
APPLICATION_ENV=development
# Developer options.
# Populate these!
INIT_BASE_URL=docker.local
INIT_INSTANCE_NAME=local development
INIT_ADMIN_USERNAME=
INIT_ADMIN_PASSWORD=
INIT_MUSIC_PATH=/var/azuracast/www/util/fixtures/init_music
#
# 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

43
azuracast.sample.env Normal file
View File

@ -0,0 +1,43 @@
#
# AzuraCast Customization
#
# The application environment.
# Valid options: production or development
APPLICATION_ENV=production
#
# 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

View File

@ -10,15 +10,9 @@ services:
- influxdb
- stations
- redis
env_file: azuracast.env
environment: &default-environment
APPLICATION_ENV: "development" # "production" or "development"
MYSQL_HOST: "mariadb" # You can change this if you plan to connect to an external DB host.
MYSQL_PORT: 3306 # ^
MYSQL_USER: "azuracast" # Once the database has been installed, don't change this.
MYSQL_PASSWORD: "azur4c457" # ^
MYSQL_DATABASE: "azuracast" # ^
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
AZURACAST_DC_REVISION: 3 # Only modified when this Docker Compose file has changed.
AZURACAST_DC_REVISION: 4
volumes:
- .:/var/azuracast/www
- tmp_data:/var/azuracast/www_tmp
@ -60,6 +54,7 @@ services:
- "127.0.0.1:3306:3306"
volumes:
- db_data:/var/lib/mysql
env_file: azuracast.env
environment:
<< : *default-environment
restart: always
@ -90,8 +85,9 @@ services:
- influxdb
- stations
- redis
env_file: azuracast.env
environment:
<< : *default-environment
<<: *default-environment
command: 'cron'
init: true
restart: always
@ -106,14 +102,9 @@ services:
- influxdb
- stations
- redis
env_file: azuracast.env
environment:
<< : *default-environment
INIT_BASE_URL: "docker.local"
INIT_GMAPS_API_KEY: "" # Populate this!
INIT_INSTANCE_NAME: "local development"
INIT_ADMIN_USERNAME: "" # Populate this!
INIT_ADMIN_PASSWORD: "" # Populate this!
INIT_MUSIC_PATH: "/var/azuracast/www/util/fixtures/init_music"
<<: *default-environment
user: 'azuracast'
working_dir: '/var/azuracast/www'
command: '/bin/true'

View File

@ -8,15 +8,9 @@ services:
- influxdb
- stations
- redis
env_file: azuracast.env
environment: &default-environment
APPLICATION_ENV: "production" # "production" or "development"
MYSQL_HOST: "mariadb" # You can change this if you plan to connect to an external DB host.
MYSQL_PORT: 3306 # ^
MYSQL_USER: "azuracast" # Once the database has been installed, don't change this.
MYSQL_PASSWORD: "azur4c457" # ^
MYSQL_DATABASE: "azuracast" # ^
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
AZURACAST_DC_REVISION: 3 # Only modified when this Docker Compose file has changed.
AZURACAST_DC_REVISION: 4
volumes:
- www_data:/var/azuracast/www
- tmp_data:/var/azuracast/www_tmp
@ -52,8 +46,9 @@ services:
image: azuracast/azuracast_db:latest
volumes:
- db_data:/var/lib/mysql
env_file: azuracast.env
environment:
<< : *default-environment
<<: *default-environment
restart: always
influxdb:
@ -76,8 +71,9 @@ services:
- influxdb
- stations
- redis
env_file: azuracast.env
environment:
<< : *default-environment
<<: *default-environment
command: 'cron'
init: true
restart: always
@ -91,8 +87,9 @@ services:
- influxdb
- stations
- redis
env_file: azuracast.env
environment:
<< : *default-environment
<<: *default-environment
user: 'azuracast'
working_dir: '/var/azuracast/www'
command: '/bin/true'

View File

@ -79,6 +79,11 @@ install() {
curl -L https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/.env > .env
fi
if [ ! -f azuracast.env ]; then
echo "Creating default AzuraCast settings file..."
curl -L https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/azuracast.sample.env > azuracast.env
fi
if [ ! -f docker-compose.yml ]; then
echo "Retrieving default docker-compose.yml file..."
curl -L https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/docker-compose.sample.yml > docker-compose.yml
@ -105,6 +110,9 @@ update() {
curl -L https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/docker-compose.sample.yml > docker-compose.yml
echo "New docker-compose.yml file loaded."
curl -L https://raw.githubusercontent.com/AzuraCast/AzuraCast/master/azuracast.sample.env > azuracast.env
echo "Default environment file loaded."
fi
docker-compose pull
@ -245,4 +253,4 @@ letsencrypt-renew() {
docker-compose run --rm letsencrypt renew --webroot -w /var/www/letsencrypt $*
}
$*
$*