mirror of
https://github.com/bitwarden/server.git
synced 2025-02-16 01:51:21 +01:00
run setup update command on updates
This commit is contained in:
parent
43f8fb04d4
commit
3e04377e67
@ -113,8 +113,7 @@ elseif($update) {
|
||||
New-Item -ItemType directory -Path $dockerDir | Out-Null
|
||||
|
||||
Download-All-Files
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -restart -outputDir $output -dockerDir $dockerDir"
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -updatedb -outputDir $output -dockerDir $dockerDir"
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -update -outputDir $output -dockerDir $dockerDir"
|
||||
}
|
||||
elseif($updatedb) {
|
||||
Check-Output-Dir-Exists
|
||||
|
@ -126,8 +126,7 @@ then
|
||||
|
||||
mkdir $DOCKER_DIR
|
||||
downloadAllFiles
|
||||
$SCRIPTS_DIR/run.sh restart $OUTPUT $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh update $OUTPUT $DOCKER_DIR
|
||||
elif [ "$1" == "updatedb" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
|
@ -5,7 +5,8 @@ param (
|
||||
[switch] $restart,
|
||||
[switch] $stop,
|
||||
[switch] $pull,
|
||||
[switch] $updatedb
|
||||
[switch] $updatedb,
|
||||
[switch] $update
|
||||
)
|
||||
|
||||
# Setup
|
||||
@ -44,21 +45,25 @@ function Update-Lets-Encrypt {
|
||||
}
|
||||
|
||||
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 `
|
||||
dotnet Setup.dll -update 1 -db 1
|
||||
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 {
|
||||
docker pull bitwarden/setup:$tag
|
||||
Pull-Setup
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
|
||||
dotnet Setup.dll -printenv 1 -env win
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
||||
if($start -Or $restart) {
|
||||
function Restart {
|
||||
Docker-Compose-Down
|
||||
Docker-Compose-Pull
|
||||
Update-Lets-Encrypt
|
||||
@ -66,6 +71,16 @@ if($start -Or $restart) {
|
||||
Docker-Prune
|
||||
Print-Environment
|
||||
}
|
||||
|
||||
function Pull-Setup {
|
||||
docker pull bitwarden/setup:$tag
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
||||
if($start -Or $restart) {
|
||||
Restart
|
||||
}
|
||||
elseif($pull) {
|
||||
Docker-Compose-Pull
|
||||
}
|
||||
@ -75,3 +90,9 @@ elseif($stop) {
|
||||
elseif($updatedb) {
|
||||
Update-Database
|
||||
}
|
||||
elseif($update) {
|
||||
Docker-Compose-Down
|
||||
Update
|
||||
Restart
|
||||
Update-Database
|
||||
}
|
||||
|
@ -53,28 +53,42 @@ function updateLetsEncrypt() {
|
||||
}
|
||||
|
||||
function updateDatabase() {
|
||||
docker pull bitwarden/setup:$TAG
|
||||
pullSetup
|
||||
docker run -it --rm --name setup --network container:mssql -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
|
||||
dotnet Setup.dll -update 1 -db 1
|
||||
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() {
|
||||
docker pull bitwarden/setup:$TAG
|
||||
pullSetup
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
|
||||
dotnet Setup.dll -printenv 1 -env $OS
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
||||
if [ "$1" == "start" -o "$1" == "restart" ]
|
||||
then
|
||||
function restart() {
|
||||
dockerComposeDown
|
||||
dockerComposePull
|
||||
updateLetsEncrypt
|
||||
dockerComposeUp
|
||||
dockerPrune
|
||||
printEnvironment
|
||||
}
|
||||
|
||||
function pullSetup() {
|
||||
docker pull bitwarden/setup:$TAG
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
||||
if [ "$1" == "start" -o "$1" == "restart" ]
|
||||
then
|
||||
restart
|
||||
elif [ "$1" == "pull" ]
|
||||
then
|
||||
dockerComposePull
|
||||
@ -84,4 +98,10 @@ then
|
||||
elif [ "$1" == "updatedb" ]
|
||||
then
|
||||
updateDatabase
|
||||
elif [ "$1" == "update" ]
|
||||
then
|
||||
dockerComposeDown
|
||||
update
|
||||
restart
|
||||
updateDatabase
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user