mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 13:38:13 -05:00
Support docker compose v2 (#1799)
This commit is contained in:
parent
1d5c9a4f9a
commit
4ecfc66877
@ -29,6 +29,12 @@ if [ $# -eq 2 ]
|
|||||||
then
|
then
|
||||||
OUTPUT=$2
|
OUTPUT=$2
|
||||||
fi
|
fi
|
||||||
|
if command -v docker-compose &> /dev/null
|
||||||
|
then
|
||||||
|
dccmd='docker-compose'
|
||||||
|
else
|
||||||
|
dccmd='docker compose'
|
||||||
|
fi
|
||||||
|
|
||||||
SCRIPTS_DIR="$OUTPUT/scripts"
|
SCRIPTS_DIR="$OUTPUT/scripts"
|
||||||
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/server/master"
|
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/server/master"
|
||||||
@ -40,7 +46,11 @@ KEYCONNECTORVERSION="1.0.1"
|
|||||||
|
|
||||||
echo "bitwarden.sh version $COREVERSION"
|
echo "bitwarden.sh version $COREVERSION"
|
||||||
docker --version
|
docker --version
|
||||||
docker-compose --version
|
if [[ "$dccmd" == "docker compose" ]]; then
|
||||||
|
$dccmd version
|
||||||
|
else
|
||||||
|
$dccmd --version
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
|
if command -v docker-compose &> /dev/null
|
||||||
|
then
|
||||||
|
dccmd='docker-compose'
|
||||||
|
else
|
||||||
|
dccmd='docker compose'
|
||||||
|
fi
|
||||||
|
|
||||||
CYAN='\033[0;36m'
|
CYAN='\033[0;36m'
|
||||||
RED='\033[1;31m'
|
RED='\033[1;31m'
|
||||||
@ -102,19 +108,19 @@ function install() {
|
|||||||
function dockerComposeUp() {
|
function dockerComposeUp() {
|
||||||
dockerComposeFiles
|
dockerComposeFiles
|
||||||
dockerComposeVolumes
|
dockerComposeVolumes
|
||||||
docker-compose up -d
|
$dccmd up -d
|
||||||
}
|
}
|
||||||
|
|
||||||
function dockerComposeDown() {
|
function dockerComposeDown() {
|
||||||
dockerComposeFiles
|
dockerComposeFiles
|
||||||
if [ $(docker-compose ps | wc -l) -gt 2 ]; then
|
if [ $($dccmd ps | wc -l) -gt 2 ]; then
|
||||||
docker-compose down
|
$dccmd down
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function dockerComposePull() {
|
function dockerComposePull() {
|
||||||
dockerComposeFiles
|
dockerComposeFiles
|
||||||
docker-compose pull
|
$dccmd pull
|
||||||
}
|
}
|
||||||
|
|
||||||
function dockerComposeFiles() {
|
function dockerComposeFiles() {
|
||||||
@ -181,7 +187,7 @@ function forceUpdateLetsEncrypt() {
|
|||||||
function updateDatabase() {
|
function updateDatabase() {
|
||||||
pullSetup
|
pullSetup
|
||||||
dockerComposeFiles
|
dockerComposeFiles
|
||||||
MSSQL_ID=$(docker-compose ps -q mssql)
|
MSSQL_ID=$($dccmd ps -q mssql)
|
||||||
docker run -i --rm --name setup --network container:$MSSQL_ID \
|
docker run -i --rm --name setup --network container:$MSSQL_ID \
|
||||||
-v $OUTPUT_DIR:/bitwarden --env-file $ENV_DIR/uid.env bitwarden/setup:$COREVERSION \
|
-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
|
dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION -keyconnectorv $KEYCONNECTORVERSION
|
||||||
@ -190,11 +196,11 @@ function updateDatabase() {
|
|||||||
|
|
||||||
function updatebw() {
|
function updatebw() {
|
||||||
KEY_CONNECTOR_ENABLED=$(grep -A3 'enable_key_connector:' $OUTPUT_DIR/config.yml | tail -n1 | awk '{ print $2}')
|
KEY_CONNECTOR_ENABLED=$(grep -A3 'enable_key_connector:' $OUTPUT_DIR/config.yml | tail -n1 | awk '{ print $2}')
|
||||||
CORE_ID=$(docker-compose ps -q admin)
|
CORE_ID=$($dccmd ps -q admin)
|
||||||
WEB_ID=$(docker-compose ps -q web)
|
WEB_ID=$($dccmd ps -q web)
|
||||||
if [ "$KEY_CONNECTOR_ENABLED" = true ];
|
if [ "$KEY_CONNECTOR_ENABLED" = true ];
|
||||||
then
|
then
|
||||||
KEYCONNECTOR_ID=$(docker-compose ps -q key-connector)
|
KEYCONNECTOR_ID=$($dccmd ps -q key-connector)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $KEYCONNECTOR_ID ] &&
|
if [ $KEYCONNECTOR_ID ] &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user