diff --git a/scripts/run.ps1 b/scripts/run.ps1 index 363fce14c..5113b9cf2 100644 --- a/scripts/run.ps1 +++ b/scripts/run.ps1 @@ -76,6 +76,7 @@ function Install() { function Docker-Compose-Up { Docker-Compose-Files + Docker-Compose-Volumes Invoke-Expression ("docker-compose up -d{0}" -f $quietPullFlag) } @@ -99,6 +100,30 @@ function Docker-Compose-Files { $env:COMPOSE_HTTP_TIMEOUT = "300" } +function Docker-Compose-Volumes { + Create-Dir "core" + Create-Dir "core/attachments" + Create-Dir "logs" + Create-Dir "logs/admin" + Create-Dir "logs/api" + Create-Dir "logs/events" + Create-Dir "logs/icons" + Create-Dir "logs/identity" + Create-Dir "logs/mssql" + Create-Dir "logs/nginx" + Create-Dir "logs/notifications" + Create-Dir "mssql/backups" + Create-Dir "mssql/data" +} + +function Create-Dir($str) { + $outPath = "${outputDir}/$str" + if (!(Test-Path -Path $outPath )) { + Write-Line "Creating directory $outPath" + New-Item -ItemType directory -Path $outPath | Out-Null + } +} + function Docker-Prune { docker image prune --all --force --filter="label=com.bitwarden.product=bitwarden" ` --filter="label!=com.bitwarden.project=setup" diff --git a/scripts/run.sh b/scripts/run.sh index 974ea104d..83e7e99b8 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -85,6 +85,7 @@ function install() { function dockerComposeUp() { dockerComposeFiles + dockerComposeVolumes docker-compose up -d } @@ -108,6 +109,30 @@ function dockerComposeFiles() { export COMPOSE_HTTP_TIMEOUT="300" } +function dockerComposeVolumes() { + createDir "core" + createDir "core/attachments" + createDir "logs" + createDir "logs/admin" + createDir "logs/api" + createDir "logs/events" + createDir "logs/icons" + createDir "logs/identity" + createDir "logs/mssql" + createDir "logs/nginx" + createDir "logs/notifications" + createDir "mssql/backups" + createDir "mssql/data" +} + +function createDir() { + if [ ! -d "${OUTPUT_DIR}/$1" ] + then + echo "Creating directory $OUTPUT_DIR/$1" + mkdir -p $OUTPUT_DIR/$1 + fi +} + function dockerPrune() { docker image prune --all --force --filter="label=com.bitwarden.product=bitwarden" \ --filter="label!=com.bitwarden.project=setup"