mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
self host script updates
This commit is contained in:
parent
78b28061b2
commit
8944c49484
@ -1,34 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
mssql:
|
||||
volumes:
|
||||
- ../mssql/data:/var/opt/mssql/data
|
||||
- ../mssql/backups:/etc/bitwarden/mssql/backups
|
||||
env_file:
|
||||
- mssql.env
|
||||
- ../env/mssql.override.env
|
||||
web:
|
||||
volumes:
|
||||
- ../web:/etc/bitwarden/web
|
||||
attachments:
|
||||
volumes:
|
||||
- ../core/attachments:/etc/bitwarden/core/attachments
|
||||
api:
|
||||
volumes:
|
||||
- ../core:/etc/bitwarden/core
|
||||
env_file:
|
||||
- global.env
|
||||
- ../env/global.override.env
|
||||
identity:
|
||||
volumes:
|
||||
- ../identity:/etc/bitwarden/identity
|
||||
- ../core:/etc/bitwarden/core
|
||||
env_file:
|
||||
- global.env
|
||||
- ../env/global.override.env
|
||||
nginx:
|
||||
volumes:
|
||||
- ../nginx:/etc/bitwarden/nginx
|
||||
- ../letsencrypt:/etc/letsencrypt
|
||||
- ../ssl:/etc/ssl
|
@ -1,36 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
mssql:
|
||||
volumes:
|
||||
- mssql_data:/var/opt/mssql/data
|
||||
- ../mssql/backups:/etc/bitwarden/mssql/backups
|
||||
env_file:
|
||||
- mssql.env
|
||||
- ../env/mssql.override.env
|
||||
web:
|
||||
volumes:
|
||||
- ../web:/etc/bitwarden/web
|
||||
attachments:
|
||||
volumes:
|
||||
- ../core/attachments:/etc/bitwarden/core/attachments
|
||||
api:
|
||||
volumes:
|
||||
- ../core:/etc/bitwarden/core
|
||||
env_file:
|
||||
- global.env
|
||||
- ../env/global.override.env
|
||||
identity:
|
||||
volumes:
|
||||
- ../identity:/etc/bitwarden/identity
|
||||
- ../core:/etc/bitwarden/core
|
||||
env_file:
|
||||
- global.env
|
||||
- ../env/global.override.env
|
||||
nginx:
|
||||
volumes:
|
||||
- ../nginx:/etc/bitwarden/nginx
|
||||
- ../letsencrypt:/etc/letsencrypt
|
||||
- ../ssl:/etc/ssl
|
||||
volumes:
|
||||
mssql_data:
|
@ -1,40 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
mssql:
|
||||
image: bitwarden/mssql:1.13.1
|
||||
container_name: mssql
|
||||
restart: always
|
||||
|
||||
web:
|
||||
image: bitwarden/web:1.19.0
|
||||
container_name: web
|
||||
restart: always
|
||||
|
||||
attachments:
|
||||
image: bitwarden/attachments:1.13.1
|
||||
container_name: attachments
|
||||
restart: always
|
||||
|
||||
api:
|
||||
image: bitwarden/api:1.13.1
|
||||
container_name: api
|
||||
restart: always
|
||||
|
||||
identity:
|
||||
image: bitwarden/identity:1.13.1
|
||||
container_name: identity
|
||||
restart: always
|
||||
|
||||
icons:
|
||||
image: bitwarden/icons:1.13.1
|
||||
container_name: icons
|
||||
restart: always
|
||||
|
||||
nginx:
|
||||
image: bitwarden/nginx:1.13.1
|
||||
container_name: nginx
|
||||
restart: always
|
||||
ports:
|
||||
- '80:80'
|
||||
- '443:443'
|
@ -1,8 +0,0 @@
|
||||
ASPNETCORE_ENVIRONMENT=Production
|
||||
globalSettings__selfHosted=true
|
||||
globalSettings__baseServiceUri__vault=http://localhost
|
||||
globalSettings__baseServiceUri__api=http://localhost/api
|
||||
globalSettings__baseServiceUri__identity=http://localhost/identity
|
||||
globalSettings__baseServiceUri__internalIdentity=http://identity
|
||||
globalSettings__pushRelayBaseUri=https://push.bitwarden.com
|
||||
globalSettings__installation__identityUri=https://identity.bitwarden.com
|
@ -1,3 +0,0 @@
|
||||
ACCEPT_EULA=Y
|
||||
MSSQL_PID=Express
|
||||
SA_PASSWORD=SECRET
|
@ -41,8 +41,9 @@ if($output -eq "") {
|
||||
}
|
||||
|
||||
$scriptsDir = "${output}\scripts"
|
||||
$dockerDir = "${output}\docker"
|
||||
$githubBaseUrl = "https://raw.githubusercontent.com/bitwarden/core/master"
|
||||
$coreVersion = "1.14.0"
|
||||
$webVersion = "1.20.0"
|
||||
|
||||
# Functions
|
||||
|
||||
@ -64,18 +65,6 @@ function Download-Run-File {
|
||||
Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1"
|
||||
}
|
||||
|
||||
function Download-Docker-Files {
|
||||
Invoke-RestMethod -OutFile $dockerDir\docker-compose.yml -Uri "${githubBaseUrl}/docker/docker-compose.yml"
|
||||
Invoke-RestMethod -OutFile $dockerDir\docker-compose.linwin.yml ` -Uri "${githubBaseUrl}/docker/docker-compose.linwin.yml"
|
||||
Invoke-RestMethod -OutFile $dockerDir\global.env -Uri "${githubBaseUrl}/docker/global.env"
|
||||
Invoke-RestMethod -OutFile $dockerDir\mssql.env -Uri "${githubBaseUrl}/docker/mssql.env"
|
||||
}
|
||||
|
||||
function Download-All-Files {
|
||||
Download-Run-File
|
||||
Download-Docker-Files
|
||||
}
|
||||
|
||||
function Check-Output-Dir-Exists {
|
||||
if(!(Test-Path -Path $output)) {
|
||||
throw "Cannot find a bitwarden installation at $output."
|
||||
@ -94,34 +83,24 @@ if($install) {
|
||||
Check-Output-Dir-Not-Exists
|
||||
New-Item -ItemType directory -Path $output | Out-Null
|
||||
Download-Install
|
||||
Invoke-Expression "$scriptsDir\install.ps1 -outputDir $output"
|
||||
Invoke-Expression "$scriptsDir\install.ps1 -outputDir $output -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif($start -Or $restart) {
|
||||
Check-Output-Dir-Exists
|
||||
if(!(Test-Path -Path $dockerDir)) {
|
||||
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 -restart -outputDir $output -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif($update) {
|
||||
Check-Output-Dir-Exists
|
||||
if(Test-Path -Path $dockerDir) {
|
||||
Remove-Item -Recurse -Force $dockerDir | Out-Null
|
||||
}
|
||||
New-Item -ItemType directory -Path $dockerDir | Out-Null
|
||||
|
||||
Download-All-Files
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -update -outputDir $output -dockerDir $dockerDir"
|
||||
Download-Run-File
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -update -outputDir $output -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif($updatedb) {
|
||||
Check-Output-Dir-Exists
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -updatedb -outputDir $output -dockerDir $dockerDir"
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -updatedb -outputDir $output -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif($stop) {
|
||||
Check-Output-Dir-Exists
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -stop -outputDir $output -dockerDir $dockerDir"
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -stop -outputDir $output -coreVersion $coreVersion -webVersion $webVersion"
|
||||
}
|
||||
elseif($updateself) {
|
||||
Download-Self
|
||||
|
@ -35,15 +35,10 @@ then
|
||||
OUTPUT=$2
|
||||
fi
|
||||
|
||||
OS="linwin"
|
||||
if [ "$(uname)" == "Darwin" ]
|
||||
then
|
||||
OS="mac"
|
||||
fi
|
||||
|
||||
SCRIPTS_DIR="$OUTPUT/scripts"
|
||||
DOCKER_DIR="$OUTPUT/docker"
|
||||
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/core/master"
|
||||
COREVERSION="1.14.0"
|
||||
WEBVERSION="1.20.0"
|
||||
|
||||
# Functions
|
||||
|
||||
@ -70,18 +65,6 @@ function downloadRunFile() {
|
||||
chmod u+x $SCRIPTS_DIR/run.sh
|
||||
}
|
||||
|
||||
function downloadDockerFiles() {
|
||||
curl -s -o $DOCKER_DIR/docker-compose.yml $GITHUB_BASE_URL/docker/docker-compose.yml
|
||||
curl -s -o $DOCKER_DIR/docker-compose.$OS.yml $GITHUB_BASE_URL/docker/docker-compose.$OS.yml
|
||||
curl -s -o $DOCKER_DIR/global.env $GITHUB_BASE_URL/docker/global.env
|
||||
curl -s -o $DOCKER_DIR/mssql.env $GITHUB_BASE_URL/docker/mssql.env
|
||||
}
|
||||
|
||||
function downloadAllFiles() {
|
||||
downloadRunFile
|
||||
downloadDockerFiles
|
||||
}
|
||||
|
||||
function checkOutputDirExists() {
|
||||
if [ ! -d "$OUTPUT" ]
|
||||
then
|
||||
@ -105,36 +88,24 @@ then
|
||||
checkOutputDirNotExists
|
||||
mkdir $OUTPUT
|
||||
downloadInstall
|
||||
$SCRIPTS_DIR/install.sh $OUTPUT
|
||||
$SCRIPTS_DIR/install.sh $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "start" -o "$1" == "restart" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
if [ ! -d "$DOCKER_DIR" ]
|
||||
then
|
||||
mkdir $DOCKER_DIR
|
||||
downloadAllFiles
|
||||
fi
|
||||
|
||||
$SCRIPTS_DIR/run.sh restart $OUTPUT $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh restart $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "update" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
if [ -d "$DOCKER_DIR" ]
|
||||
then
|
||||
rm -rf $DOCKER_DIR
|
||||
fi
|
||||
|
||||
mkdir $DOCKER_DIR
|
||||
downloadAllFiles
|
||||
$SCRIPTS_DIR/run.sh update $OUTPUT $DOCKER_DIR
|
||||
downloadRunFile
|
||||
$SCRIPTS_DIR/run.sh update $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "updatedb" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh updatedb $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "stop" ]
|
||||
then
|
||||
checkOutputDirExists
|
||||
$SCRIPTS_DIR/run.sh stop $OUTPUT $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh stop $OUTPUT $COREVERSION $WEBVERSION
|
||||
elif [ "$1" == "updateself" ]
|
||||
then
|
||||
downloadSelf
|
||||
|
@ -1,9 +1,9 @@
|
||||
param (
|
||||
[string]$outputDir = "../."
|
||||
[string]$outputDir = "../.",
|
||||
[string]$coreVersion = "latest",
|
||||
[string]$webVersion = "latest"
|
||||
)
|
||||
|
||||
[string]$tag = "1.13.1"
|
||||
|
||||
if(!(Test-Path -Path $outputDir )){
|
||||
New-Item -ItemType directory -Path $outputDir | Out-Null
|
||||
}
|
||||
@ -32,8 +32,8 @@ if($domain -ne "localhost") {
|
||||
}
|
||||
}
|
||||
|
||||
docker pull bitwarden/setup:$tag
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
|
||||
dotnet Setup.dll -install 1 -domain ${domain} -letsencrypt ${letsEncrypt}
|
||||
docker pull bitwarden/setup:$coreVersion
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
|
||||
dotnet Setup.dll -install 1 -domain ${domain} -letsencrypt ${letsEncrypt} -os win -corev $coreVersion -webv $webVersion
|
||||
|
||||
echo "Setup complete"
|
||||
|
@ -7,7 +7,23 @@ then
|
||||
OUTPUT_DIR=$1
|
||||
fi
|
||||
|
||||
TAG="1.13.1"
|
||||
COREVERSION="latest"
|
||||
if [ $# -gt 2 ]
|
||||
then
|
||||
COREVERSION=$2
|
||||
fi
|
||||
|
||||
WEBVERSION="latest"
|
||||
if [ $# -gt 3 ]
|
||||
then
|
||||
WEBVERSION=$3
|
||||
fi
|
||||
|
||||
OS="lin"
|
||||
if [ "$(uname)" == "Darwin" ]
|
||||
then
|
||||
OS="mac"
|
||||
fi
|
||||
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
@ -34,9 +50,9 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
docker pull bitwarden/setup:$TAG
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
|
||||
dotnet Setup.dll -install 1 -domain $DOMAIN -letsencrypt $LETS_ENCRYPT
|
||||
docker pull bitwarden/setup:$COREVERSION
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
|
||||
dotnet Setup.dll -install 1 -domain $DOMAIN -letsencrypt $LETS_ENCRYPT -os $OS -corev $COREVERSION -webv $WEBVERSION
|
||||
|
||||
echo ""
|
||||
echo "Setup complete"
|
||||
|
@ -1,6 +1,7 @@
|
||||
param (
|
||||
[string]$outputDir = "../.",
|
||||
[string]$dockerDir = "",
|
||||
[string]$coreVersion = "latest",
|
||||
[string]$webVersion = "latest",
|
||||
[switch] $start,
|
||||
[switch] $restart,
|
||||
[switch] $stop,
|
||||
@ -11,25 +12,20 @@ param (
|
||||
|
||||
# Setup
|
||||
|
||||
[string]$tag = "1.13.1"
|
||||
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
if($dockerDir -eq "") {
|
||||
$dockerDir="${dir}\..\docker"
|
||||
}
|
||||
$dockerDir="${outputDir}\docker"
|
||||
|
||||
# Functions
|
||||
|
||||
function Docker-Compose-Up {
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.linwin.yml up -d
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml up -d
|
||||
}
|
||||
|
||||
function Docker-Compose-Down {
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.linwin.yml down
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml down
|
||||
}
|
||||
|
||||
function Docker-Compose-Pull {
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.linwin.yml pull
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml pull
|
||||
}
|
||||
|
||||
function Docker-Prune {
|
||||
@ -46,21 +42,21 @@ function Update-Lets-Encrypt {
|
||||
|
||||
function Update-Database {
|
||||
Pull-Setup
|
||||
docker run -it --rm --name setup --network container:mssql -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
|
||||
dotnet Setup.dll -update 1 -db 1
|
||||
docker run -it --rm --name setup --network container:mssql -v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
|
||||
dotnet Setup.dll -update 1 -db 1 -os win -corev $coreVersion -webv $webVersion
|
||||
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
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
|
||||
dotnet Setup.dll -update 1 -os win -corev $coreVersion -webv $webVersion
|
||||
}
|
||||
|
||||
function Print-Environment {
|
||||
Pull-Setup
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$tag `
|
||||
dotnet Setup.dll -printenv 1 -env win
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup:$coreVersion `
|
||||
dotnet Setup.dll -printenv 1 -os win -corev $coreVersion -webv $webVersion
|
||||
}
|
||||
|
||||
function Restart {
|
||||
@ -73,7 +69,7 @@ function Restart {
|
||||
}
|
||||
|
||||
function Pull-Setup {
|
||||
docker pull bitwarden/setup:$tag
|
||||
docker pull bitwarden/setup:$coreVersion
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
@ -11,32 +11,38 @@ then
|
||||
OUTPUT_DIR=$2
|
||||
fi
|
||||
|
||||
DOCKER_DIR=$DIR/../docker
|
||||
COREVERSION="latest"
|
||||
if [ $# -gt 2 ]
|
||||
then
|
||||
DOCKER_DIR=$3
|
||||
COREVERSION=$3
|
||||
fi
|
||||
|
||||
OS="linwin"
|
||||
WEBVERSION="latest"
|
||||
if [ $# -gt 3 ]
|
||||
then
|
||||
WEBVERSION=$4
|
||||
fi
|
||||
|
||||
OS="lin"
|
||||
if [ "$(uname)" == "Darwin" ]
|
||||
then
|
||||
OS="mac"
|
||||
fi
|
||||
|
||||
TAG="1.13.1"
|
||||
DOCKER_DIR="$OUTPUT_DIR/docker"
|
||||
|
||||
# Functions
|
||||
|
||||
function dockerComposeUp() {
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml up -d
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml up -d
|
||||
}
|
||||
|
||||
function dockerComposeDown() {
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml down
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml down
|
||||
}
|
||||
|
||||
function dockerComposePull() {
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml pull
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml pull
|
||||
}
|
||||
|
||||
function dockerPrune() {
|
||||
@ -44,7 +50,7 @@ function dockerPrune() {
|
||||
}
|
||||
|
||||
function updateLetsEncrypt() {
|
||||
if [ -d "${outputDir}/letsencrypt/live" ]
|
||||
if [ -d "${OUTPUT_DIR}/letsencrypt/live" ]
|
||||
then
|
||||
docker pull certbot/certbot
|
||||
docker run -it --rm --name certbot -p 443:443 -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
@ -54,21 +60,21 @@ function updateLetsEncrypt() {
|
||||
|
||||
function updateDatabase() {
|
||||
pullSetup
|
||||
docker run -it --rm --name setup --network container:mssql -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
|
||||
dotnet Setup.dll -update 1 -db 1
|
||||
docker run -it --rm --name setup --network container:mssql -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
|
||||
dotnet Setup.dll -update 1 -db 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
|
||||
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
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
|
||||
dotnet Setup.dll -update 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
|
||||
}
|
||||
|
||||
function printEnvironment() {
|
||||
pullSetup
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$TAG \
|
||||
dotnet Setup.dll -printenv 1 -env $OS
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup:$COREVERSION \
|
||||
dotnet Setup.dll -printenv 1 -os $OS -corev $COREVERSION -webv $WEBVERSION
|
||||
}
|
||||
|
||||
function restart() {
|
||||
@ -81,7 +87,7 @@ function restart() {
|
||||
}
|
||||
|
||||
function pullSetup() {
|
||||
docker pull bitwarden/setup:$TAG
|
||||
docker pull bitwarden/setup:$COREVERSION
|
||||
}
|
||||
|
||||
# Commands
|
||||
|
Loading…
Reference in New Issue
Block a user