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

[PM-15413] fix: Restore docker-compose support and set docker compose as default #309

Merged
merged 6 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
12 changes: 8 additions & 4 deletions bitwarden.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ if [ $# -eq 2 ]
then
OUTPUT=$2
fi
if command -v docker-compose &> /dev/null
if command -v docker compose &> /dev/null
then
dccmd='docker-compose'
else
dccmd='docker compose'
else
dccmd='docker-compose'
fi

SCRIPTS_DIR="$OUTPUT/scripts"
Expand All @@ -68,7 +68,11 @@ KEYCONNECTORVERSION="2024.8.0"

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

echo ""

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 ! docker compose version &> /dev/null
if command -v docker compose &> /dev/null
then
echo "Error: 'docker compose' is not installed. Please install Docker Compose."
exit 1
dccmd='docker compose'
else
dccmd='docker-compose'
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
docker compose up -d
$dccmd up -d
}

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

function dockerComposePull() {
dockerComposeFiles
docker compose pull
$dccmd 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=$(docker compose ps -q mssql)
MSSQL_ID=$($dccmd 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=$(docker compose ps -q admin)
WEB_ID=$(docker compose ps -q web)
CORE_ID=$($dccmd ps -q admin)
WEB_ID=$($dccmd ps -q web)
if [ "$KEY_CONNECTOR_ENABLED" = true ];
then
KEYCONNECTOR_ID=$(docker compose ps -q key-connector)
KEYCONNECTOR_ID=$($dccmd ps -q key-connector)
fi

if [ $KEYCONNECTOR_ID ] &&
Expand Down