Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5: Support for docker compose v2 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# It wraps docker-compose to download a sample music library before creating instances of these servers,
# allowing the go-subsonic tests to run fully against the sample instances.

COMPOSE_BIN=${COMPOSE_BIN:-"docker-compose"}

err() {
echo "$1" >&2
exit 1
Expand All @@ -15,9 +17,10 @@ log() {
echo "$(date +%Y-%m-%d\ %T) - ${SEV^^} - $*" >&2
}

for dependency in curl docker-compose; do
for dependency in curl docker; do
hash "$dependency" 2>/dev/null || err "$dependency must be installed"
done
$COMPOSE_BIN version 2>/dev/null || err "Docker Compose must be installed"

SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
NAVIDROME_PORT=4533
Expand Down Expand Up @@ -103,24 +106,30 @@ create_navidrome_user() {

clear_data_dir() {
rm -rf ./build/data/*

# Ensure the directory has our user permissions, not root.
if [ ! -d "./build/data" ]
then
mkdir ./build/data
fi
}

main() {
log info "Downloading sample music into ./build/music"
download_sample_audio
# Create or restart the docker containers of Airsonic and Navidrome
if [[ $(docker-compose top) ]]
if [[ $($COMPOSE_BIN top) ]]
then
# If the current composition is running, restart it to pick up possible changes
log warn "Downing currently running docker containers"
docker-compose down
$COMPOSE_BIN down
fi
log info "Removing excess data"
clear_data_dir
log info "Configuring Airsonic"
configure_airsonic # This must occur in the middle so settings aren't overwritten
log info "Bringing up containers"
docker-compose up -d
$COMPOSE_BIN up -d
sleep 10
log info "Creating Navidrome administrator (admin/admin)"
create_navidrome_user
Expand Down