1
0
mirror of https://github.com/bitwarden/server synced 2026-01-04 17:43:53 +00:00

Revert "Use user primary group if not root (#292)"

This reverts commit ec89c36ca0.
This commit is contained in:
Kyle Spearrin
2018-05-29 19:17:48 -04:00
parent ec89c36ca0
commit 0f675d8ccb
11 changed files with 393 additions and 164 deletions

View File

@@ -5,7 +5,7 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
OUTPUT_DIR=".."
OUTPUT_DIR="../."
if [ $# -gt 1 ]
then
OUTPUT_DIR=$2
@@ -23,18 +23,17 @@ then
WEBVERSION=$4
fi
ENV_DIR="$OUTPUT_DIR/env"
DOCKER_DIR="$OUTPUT_DIR/docker"
# As in install.sh, save the running UID/GID, they could not exist yet, during an update for example
if ! grep -q "^LOCAL_UID=" $ENV_DIR/uid.env 2>/dev/null || ! grep -q "^LOCAL_GID=" $ENV_DIR/uid.env 2>/dev/null
OS="lin"
if [ "$(uname)" == "Darwin" ]
then
LUID="LOCAL_UID=`id -u $USER`"
LGID="LOCAL_GID=`id -g $USER`"
mkdir -p $ENV_DIR
(echo $LUID; echo $LGID) > $ENV_DIR/uid.env
OS="mac"
fi
DOCKER_DIR="$OUTPUT_DIR/docker"
ENV_DIR="$OUTPUT_DIR/env"
LUID="LOCAL_UID=`id -u $USER`"
LGID="LOCAL_GID=`getent group docker | cut -d: -f3`"
# Functions
function dockerComposeUp() {
@@ -80,30 +79,58 @@ function updateLetsEncrypt() {
function updateDatabase() {
pullSetup
docker run -i --rm --name setup --network container:bitwarden-mssql \
-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
if [ $OS == "lin" ]
then
docker run -i --rm --name setup --network container:bitwarden-mssql \
-v $OUTPUT_DIR:/bitwarden -e $LUID -e $LGID bitwarden/setup:$COREVERSION \
dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
else
docker run -i --rm --name setup --network container:bitwarden-mssql \
-v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
fi
echo "Database update complete"
}
function update() {
pullSetup
docker run -i --rm --name setup -v $OUTPUT_DIR:/bitwarden \
--env-file $ENV_DIR/uid.env bitwarden/setup:$COREVERSION \
dotnet Setup.dll -update 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
if [ $OS == "lin" ]
then
docker run -i --rm --name setup -v $OUTPUT_DIR:/bitwarden \
-e $LUID -e $LGID bitwarden/setup:$COREVERSION \
dotnet Setup.dll -update 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
else
docker run -i --rm --name setup \
-v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
dotnet Setup.dll -update 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
fi
}
function printEnvironment() {
pullSetup
docker run -i --rm --name setup -v $OUTPUT_DIR:/bitwarden \
--env-file $ENV_DIR/uid.env bitwarden/setup:$COREVERSION \
dotnet Setup.dll -printenv 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
if [ $OS == "lin" ]
then
docker run -i --rm --name setup -v $OUTPUT_DIR:/bitwarden \
-e $LUID -e $LGID bitwarden/setup:$COREVERSION \
dotnet Setup.dll -printenv 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
else
docker run -i --rm --name setup \
-v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
dotnet Setup.dll -printenv 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
fi
}
function restart() {
dockerComposeDown
dockerComposePull
updateLetsEncrypt
if [ $OS == "lin" ]
then
mkdir -p $ENV_DIR
(echo $LUID; echo $LGID) > $ENV_DIR/uid.env
fi
dockerComposeUp
dockerPrune
printEnvironment