mirror of
https://github.com/bitwarden/server.git
synced 2024-12-26 17:37:36 +01:00
Merge pull request #756 from bitwarden/docker-validate-volumes
Create missing container volume directories if/when docker-compose fails to
This commit is contained in:
commit
ab24257f11
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user