mirror of
https://github.com/bitwarden/server.git
synced 2025-04-12 16:48:12 -05:00
renew lets encrypt cert on run
This commit is contained in:
parent
2cfea467d1
commit
a0a5bffec9
@ -60,7 +60,7 @@ elseif($run -Or $restart) {
|
||||
Download-Run-Files
|
||||
}
|
||||
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -dockerDir $dockerDir"
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -outputDir $output -dockerDir $dockerDir"
|
||||
}
|
||||
elseif($update) {
|
||||
if(Test-Path -Path $dockerDir) {
|
||||
@ -69,7 +69,7 @@ elseif($update) {
|
||||
New-Item -ItemType directory -Path $dockerDir | Out-Null
|
||||
|
||||
Download-Run-Files
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -dockerDir $dockerDir"
|
||||
Invoke-Expression "$scriptsDir\run.ps1 -outputDir $output -dockerDir $dockerDir"
|
||||
}
|
||||
elseif($updatedb) {
|
||||
Invoke-RestMethod -OutFile $scriptsDir\update-db.ps1 -Uri "${githubBaseUrl}/scripts/update-db.ps1"
|
||||
|
@ -67,7 +67,7 @@ then
|
||||
mkdir $DOCKER_DIR
|
||||
downloadRunFiles
|
||||
fi
|
||||
$SCRIPTS_DIR/run.sh $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh $OUTPUT $DOCKER_DIR
|
||||
elif [ "$1" == "update" ]
|
||||
then
|
||||
if [ -d "$DOCKER_DIR" ]
|
||||
@ -77,7 +77,7 @@ then
|
||||
|
||||
mkdir $DOCKER_DIR
|
||||
downloadRunFiles
|
||||
$SCRIPTS_DIR/run.sh $DOCKER_DIR
|
||||
$SCRIPTS_DIR/run.sh $OUTPUT $DOCKER_DIR
|
||||
elif [ "$1" == "updatedb" ]
|
||||
then
|
||||
curl -s -o $SCRIPTS_DIR/update-db.sh $GITHUB_BASE_URL/scripts/update-db.sh
|
||||
|
@ -9,18 +9,22 @@ if(!(Test-Path -Path $outputDir )){
|
||||
docker --version
|
||||
echo ""
|
||||
|
||||
[string]$letsEncrypt = "n"
|
||||
[string]$domain = $( Read-Host "(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com)" )
|
||||
[string]$letsEncrypt = $( Read-Host "(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n)" )
|
||||
|
||||
if($letsEncrypt -eq "y") {
|
||||
[string]$email = $( Read-Host "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders)" )
|
||||
|
||||
$letsEncryptPath = "${outputDir}/letsencrypt/live/${domain}"
|
||||
if(!(Test-Path -Path $letsEncryptPath )){
|
||||
New-Item -ItemType directory -Path $letsEncryptPath
|
||||
if($domain -ne "localhost") {
|
||||
$letsEncrypt = $( Read-Host "(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n)" )
|
||||
|
||||
if($letsEncrypt -eq "y") {
|
||||
[string]$email = $( Read-Host "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders)" )
|
||||
|
||||
$letsEncryptPath = "${outputDir}/letsencrypt/live/${domain}"
|
||||
if(!(Test-Path -Path $letsEncryptPath )){
|
||||
New-Item -ItemType directory -Path $letsEncryptPath
|
||||
}
|
||||
docker run -it --rm --name certbot -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot `
|
||||
certonly --standalone --noninteractive --agree-tos --preferred-challenges http --email $email -d $domain
|
||||
}
|
||||
docker run -it --rm --name certbot -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot `
|
||||
certonly --standalone --noninteractive --agree-tos --preferred-challenges http --email $email -d $domain
|
||||
}
|
||||
|
||||
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup `
|
||||
|
@ -11,15 +11,20 @@ then
|
||||
fi
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
LETS_ENCRYPT="n"
|
||||
read -p "(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com): " DOMAIN
|
||||
read -p "(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): " LETS_ENCRYPT
|
||||
|
||||
if [ "$LETS_ENCRYPT" == "y" ]
|
||||
if [ "$DOMAIN" != "localhost" ]
|
||||
then
|
||||
read -p "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders): " EMAIL
|
||||
mkdir -p $OUTPUT_DIR/letsencrypt/live/$DOMAIN
|
||||
docker run -it --rm --name certbot -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
certonly --standalone --noninteractive --agree-tos --preferred-challenges http --email $EMAIL -d $DOMAIN
|
||||
read -p "(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): " LETS_ENCRYPT
|
||||
|
||||
if [ "$LETS_ENCRYPT" == "y" ]
|
||||
then
|
||||
read -p "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders): " EMAIL
|
||||
mkdir -p $OUTPUT_DIR/letsencrypt/live/$DOMAIN
|
||||
docker run -it --rm --name certbot -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
certonly --standalone --noninteractive --agree-tos --preferred-challenges http --email $EMAIL -d $DOMAIN
|
||||
fi
|
||||
fi
|
||||
|
||||
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup \
|
||||
|
@ -1,5 +1,6 @@
|
||||
param (
|
||||
[string] $dockerDir = ""
|
||||
[string]$outputDir = "../.",
|
||||
[string]$dockerDir = ""
|
||||
)
|
||||
|
||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
@ -10,5 +11,11 @@ if($dockerDir -eq "") {
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
$letsEncryptLivePath = "${outputDir}/letsencrypt/live"
|
||||
if(Test-Path -Path $letsEncryptLivePath) {
|
||||
docker run -it --rm --name certbot -p 443:443 -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot `
|
||||
renew
|
||||
}
|
||||
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.macwin.yml down
|
||||
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.macwin.yml up -d
|
||||
|
@ -2,10 +2,17 @@
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
DOCKER_DIR=$DIR/../docker
|
||||
|
||||
OUTPUT_DIR="../."
|
||||
if [ $# -eq 1 ]
|
||||
then
|
||||
DOCKER_DIR=$1
|
||||
OUTPUT_DIR=$1
|
||||
fi
|
||||
|
||||
DOCKER_DIR=$DIR/../docker
|
||||
if [ $# -eq 2 ]
|
||||
then
|
||||
DOCKER_DIR=$2
|
||||
fi
|
||||
|
||||
OS="linux"
|
||||
@ -17,5 +24,12 @@ fi
|
||||
docker --version
|
||||
docker-compose --version
|
||||
|
||||
LETS_ENCRYPT_LIVE = "${outputDir}/letsencrypt/live"
|
||||
if [ -d "$LETS_ENCRYPT_LIVE" ]
|
||||
then
|
||||
docker run -it --rm --name certbot -p 443:443 -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
|
||||
renew
|
||||
fi
|
||||
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml down
|
||||
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.$OS.yml up -d
|
||||
|
Loading…
x
Reference in New Issue
Block a user