1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-19 02:21:21 +01:00

run setup update command on updates

This commit is contained in:
Kyle Spearrin 2017-10-25 17:21:35 -04:00
parent 43f8fb04d4
commit 3e04377e67
4 changed files with 55 additions and 16 deletions

View File

@ -113,8 +113,7 @@ elseif($update) {
New-Item -ItemType directory -Path $dockerDir | Out-Null New-Item -ItemType directory -Path $dockerDir | Out-Null
Download-All-Files Download-All-Files
Invoke-Expression "$scriptsDir\run.ps1 -restart -outputDir $output -dockerDir $dockerDir" Invoke-Expression "$scriptsDir\run.ps1 -update -outputDir $output -dockerDir $dockerDir"
Invoke-Expression "$scriptsDir\run.ps1 -updatedb -outputDir $output -dockerDir $dockerDir"
} }
elseif($updatedb) { elseif($updatedb) {
Check-Output-Dir-Exists Check-Output-Dir-Exists

View File

@ -126,8 +126,7 @@ then
mkdir $DOCKER_DIR mkdir $DOCKER_DIR
downloadAllFiles downloadAllFiles
$SCRIPTS_DIR/run.sh restart $OUTPUT $DOCKER_DIR $SCRIPTS_DIR/run.sh update $OUTPUT $DOCKER_DIR
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $DOCKER_DIR
elif [ "$1" == "updatedb" ] elif [ "$1" == "updatedb" ]
then then
checkOutputDirExists checkOutputDirExists

View File

@ -5,7 +5,8 @@ param (
[switch] $restart, [switch] $restart,
[switch] $stop, [switch] $stop,
[switch] $pull, [switch] $pull,
[switch] $updatedb [switch] $updatedb,
[switch] $update
) )
# Setup # Setup
@ -44,21 +45,25 @@ function Update-Lets-Encrypt {
} }
function Update-Database { function Update-Database {
docker pull bitwarden/setup:$tag Pull-Setup
docker run -it --rm --name setup --network container:mssql -v ${outputDir}:/bitwarden bitwarden/setup:$tag ` docker run -it --rm --name setup --network container:mssql -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
dotnet Setup.dll -update 1 -db 1 dotnet Setup.dll -update 1 -db 1
echo "Database update complete" echo "Database update complete"
} }
function Update {
Pull-Setup
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
dotnet Setup.dll -update 1
}
function Print-Environment { function Print-Environment {
docker pull bitwarden/setup:$tag Pull-Setup
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$tag ` docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
dotnet Setup.dll -printenv 1 -env win dotnet Setup.dll -printenv 1 -env win
} }
# Commands function Restart {
if($start -Or $restart) {
Docker-Compose-Down Docker-Compose-Down
Docker-Compose-Pull Docker-Compose-Pull
Update-Lets-Encrypt Update-Lets-Encrypt
@ -66,6 +71,16 @@ if($start -Or $restart) {
Docker-Prune Docker-Prune
Print-Environment Print-Environment
} }
function Pull-Setup {
docker pull bitwarden/setup:$tag
}
# Commands
if($start -Or $restart) {
Restart
}
elseif($pull) { elseif($pull) {
Docker-Compose-Pull Docker-Compose-Pull
} }
@ -75,3 +90,9 @@ elseif($stop) {
elseif($updatedb) { elseif($updatedb) {
Update-Database Update-Database
} }
elseif($update) {
Docker-Compose-Down
Update
Restart
Update-Database
}

View File

@ -53,28 +53,42 @@ function updateLetsEncrypt() {
} }
function updateDatabase() { function updateDatabase() {
docker pull bitwarden/setup:$TAG pullSetup
docker run -it --rm --name setup --network container:mssql -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \ docker run -it --rm --name setup --network container:mssql -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
dotnet Setup.dll -update 1 -db 1 dotnet Setup.dll -update 1 -db 1
echo "Database update complete" echo "Database update complete"
} }
function update() {
pullSetup
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
dotnet Setup.dll -update 1
}
function printEnvironment() { function printEnvironment() {
docker pull bitwarden/setup:$TAG pullSetup
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \ docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
dotnet Setup.dll -printenv 1 -env $OS dotnet Setup.dll -printenv 1 -env $OS
} }
# Commands function restart() {
if [ "$1" == "start" -o "$1" == "restart" ]
then
dockerComposeDown dockerComposeDown
dockerComposePull dockerComposePull
updateLetsEncrypt updateLetsEncrypt
dockerComposeUp dockerComposeUp
dockerPrune dockerPrune
printEnvironment printEnvironment
}
function pullSetup() {
docker pull bitwarden/setup:$TAG
}
# Commands
if [ "$1" == "start" -o "$1" == "restart" ]
then
restart
elif [ "$1" == "pull" ] elif [ "$1" == "pull" ]
then then
dockerComposePull dockerComposePull
@ -84,4 +98,10 @@ then
elif [ "$1" == "updatedb" ] elif [ "$1" == "updatedb" ]
then then
updateDatabase updateDatabase
elif [ "$1" == "update" ]
then
dockerComposeDown
update
restart
updateDatabase
fi fi