1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

Create missing container volume directories if/when docker-compose fails to

This commit is contained in:
Matt Portune 2020-05-29 18:03:55 -04:00
parent e1a0d59fd1
commit d746517ff4
2 changed files with 50 additions and 0 deletions

View File

@ -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"

View File

@ -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"