Skip to content

Commit

Permalink
BREAKING CHANGE: remove support for deprecated docker-compose CLI (#…
Browse files Browse the repository at this point in the history
…301)

* fix: db migration connectivity issues when using an external db

* Update run.ps1

Co-authored-by: Justin Baur <[email protected]>

* rm semicolon in case connection this is at the end of the connection string

* fix: 'no such image: mssql' when mssql container is not present

* BREAKING CHANGE: remove compat with deprecated docker-compose CLI

---------

Co-authored-by: Justin Baur <[email protected]>
  • Loading branch information
tangowithfoxtrot and justindbaur authored Nov 13, 2024
1 parent e94853d commit 8465237
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
18 changes: 7 additions & 11 deletions bitwarden.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
set -e

cat << "EOF"
_ _ _ _
| |__ (_) |___ ____ _ _ __ __| | ___ _ __
| '_ \| | __\ \ /\ / / _` | '__/ _` |/ _ \ '_ \
_ _ _ _
| |__ (_) |___ ____ _ _ __ __| | ___ _ __
| '_ \| | __\ \ /\ / / _` | '__/ _` |/ _ \ '_ \
| |_) | | |_ \ V V / (_| | | | (_| | __/ | | |
|_.__/|_|\__| \_/\_/ \__,_|_| \__,_|\___|_| |_|
Expand Down Expand Up @@ -33,7 +33,7 @@ if [ "$EUID" -eq 0 ]; then
echo -e "Continuing...."
;;
*)
exit 1
exit 1
;;
esac
fi
Expand Down Expand Up @@ -68,11 +68,7 @@ KEYCONNECTORVERSION="2024.8.0"

echo "bitwarden.sh version $COREVERSION"
docker --version
if [[ "$dccmd" == "docker compose" ]]; then
$dccmd version
else
$dccmd --version
fi
docker compose version

echo ""

Expand Down Expand Up @@ -155,7 +151,7 @@ function compressLogs() {
exit 1
fi
fi

# Validate end date format and order
if [ -n "$END_DATE" ]; then
validateDateFormat "$END_DATE" "end"
Expand Down Expand Up @@ -261,7 +257,7 @@ case $1 in
$SCRIPTS_DIR/run.sh uninstall $OUTPUT
;;
"compresslogs")
checkOutputDirExists
checkOutputDirExists
compressLogs $OUTPUT $2 $3
;;
"help")
Expand Down
24 changes: 12 additions & 12 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
set -e

# Setup
if command -v docker-compose &> /dev/null
if ! docker compose version &> /dev/null
then
dccmd='docker-compose'
else
dccmd='docker compose'
echo "Error: 'docker compose' is not installed. Please install Docker Compose."
exit 1
fi


CYAN='\033[0;36m'
RED='\033[1;31m'
NC='\033[0m' # No Color
Expand Down Expand Up @@ -108,19 +108,19 @@ function install() {
function dockerComposeUp() {
dockerComposeFiles
dockerComposeVolumes
$dccmd up -d
docker compose up -d
}

function dockerComposeDown() {
dockerComposeFiles
if [ $($dccmd ps | wc -l) -gt 2 ]; then
$dccmd down
if [ $(docker compose ps | wc -l) -gt 2 ]; then
docker compose down
fi
}

function dockerComposePull() {
dockerComposeFiles
$dccmd pull
docker compose pull
}

function dockerComposeFiles() {
Expand Down Expand Up @@ -191,7 +191,7 @@ function updateDatabase() {
# only use container network driver if using the included mssql image
if grep -q 'Data Source=tcp:mssql,1433' "$ENV_DIR/global.override.env"
then
MSSQL_ID=$($dccmd ps -q mssql)
MSSQL_ID=$(docker compose ps -q mssql)
local docker_network_args="--network container:$MSSQL_ID"
fi

Expand All @@ -203,11 +203,11 @@ function updateDatabase() {

function updatebw() {
KEY_CONNECTOR_ENABLED=$(grep 'enable_key_connector:' $OUTPUT_DIR/config.yml | awk '{ print $2}')
CORE_ID=$($dccmd ps -q admin)
WEB_ID=$($dccmd ps -q web)
CORE_ID=$(docker compose ps -q admin)
WEB_ID=$(docker compose ps -q web)
if [ "$KEY_CONNECTOR_ENABLED" = true ];
then
KEYCONNECTOR_ID=$($dccmd ps -q key-connector)
KEYCONNECTOR_ID=$(docker compose ps -q key-connector)
fi

if [ $KEYCONNECTOR_ID ] &&
Expand Down

0 comments on commit 8465237

Please sign in to comment.