Browse Source

run setup update command on updates

pull/139/head
Kyle Spearrin 8 years ago
parent
commit
3e04377e67
  1. 3
      scripts/bitwarden.ps1
  2. 3
      scripts/bitwarden.sh
  3. 33
      scripts/run.ps1
  4. 32
      scripts/run.sh

3
scripts/bitwarden.ps1

@ -113,8 +113,7 @@ elseif($update) { @@ -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

3
scripts/bitwarden.sh

@ -126,8 +126,7 @@ then @@ -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

33
scripts/run.ps1

@ -5,7 +5,8 @@ param ( @@ -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 { @@ -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) { @@ -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) { @@ -75,3 +90,9 @@ elseif($stop) {
elseif($updatedb) {
Update-Database
}
elseif($update) {
Docker-Compose-Down
Update
Restart
Update-Database
}

32
scripts/run.sh

@ -53,28 +53,42 @@ function updateLetsEncrypt() { @@ -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 @@ -84,4 +98,10 @@ then
elif [ "$1" == "updatedb" ]
then
updateDatabase
elif [ "$1" == "update" ]
then
dockerComposeDown
update
restart
updateDatabase
fi

Loading…
Cancel
Save