mirror of
https://github.com/bitwarden/server.git
synced 2024-12-22 16:57:36 +01:00
Support docker compose v2 (#1799)
This commit is contained in:
parent
1d5c9a4f9a
commit
4ecfc66877
@ -29,6 +29,12 @@ if [ $# -eq 2 ]
|
||||
then
|
||||
OUTPUT=$2
|
||||
fi
|
||||
if command -v docker-compose &> /dev/null
|
||||
then
|
||||
dccmd='docker-compose'
|
||||
else
|
||||
dccmd='docker compose'
|
||||
fi
|
||||
|
||||
SCRIPTS_DIR="$OUTPUT/scripts"
|
||||
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/server/master"
|
||||
@ -40,7 +46,11 @@ KEYCONNECTORVERSION="1.0.1"
|
||||
|
||||
echo "bitwarden.sh version $COREVERSION"
|
||||
docker --version
|
||||
docker-compose --version
|
||||
if [[ "$dccmd" == "docker compose" ]]; then
|
||||
$dccmd version
|
||||
else
|
||||
$dccmd --version
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
|
@ -2,6 +2,12 @@
|
||||
set -e
|
||||
|
||||
# Setup
|
||||
if command -v docker-compose &> /dev/null
|
||||
then
|
||||
dccmd='docker-compose'
|
||||
else
|
||||
dccmd='docker compose'
|
||||
fi
|
||||
|
||||
CYAN='\033[0;36m'
|
||||
RED='\033[1;31m'
|
||||
@ -102,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() {
|
||||
@ -181,7 +187,7 @@ function forceUpdateLetsEncrypt() {
|
||||
function updateDatabase() {
|
||||
pullSetup
|
||||
dockerComposeFiles
|
||||
MSSQL_ID=$(docker-compose ps -q mssql)
|
||||
MSSQL_ID=$($dccmd ps -q mssql)
|
||||
docker run -i --rm --name setup --network container:$MSSQL_ID \
|
||||
-v $OUTPUT_DIR:/bitwarden --env-file $ENV_DIR/uid.env bitwarden/setup:$COREVERSION \
|
||||
dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION -keyconnectorv $KEYCONNECTORVERSION
|
||||
@ -190,11 +196,11 @@ function updateDatabase() {
|
||||
|
||||
function updatebw() {
|
||||
KEY_CONNECTOR_ENABLED=$(grep -A3 'enable_key_connector:' $OUTPUT_DIR/config.yml | tail -n1 | 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 ] &&
|
||||
|
Loading…
Reference in New Issue
Block a user