Files
server/scripts/install.ps1

34 lines
1.3 KiB
PowerShell
Raw Normal View History

2017-08-07 11:24:16 -04:00
param (
2017-08-21 08:49:44 -04:00
[string]$outputDir = "../."
2017-08-07 11:24:16 -04:00
)
2017-08-08 15:48:45 -04:00
if(!(Test-Path -Path $outputDir )){
2017-08-21 11:24:39 -04:00
New-Item -ItemType directory -Path $outputDir | Out-Null
2017-08-08 15:48:45 -04:00
}
2017-08-21 11:21:40 -04:00
[string]$letsEncrypt = "n"
[string]$domain = $( Read-Host "(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com)" )
2017-08-08 15:48:45 -04:00
2017-08-21 11:21:40 -04:00
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)" )
2017-08-21 11:39:49 -04:00
$letsEncryptPath = "${outputDir}/letsencrypt"
2017-08-21 11:21:40 -04:00
if(!(Test-Path -Path $letsEncryptPath )){
2017-08-21 11:24:39 -04:00
New-Item -ItemType directory -Path $letsEncryptPath | Out-Null
2017-08-21 11:21:40 -04:00
}
2017-08-26 22:54:10 -04:00
docker pull certbot/certbot
2017-08-21 11:21:40 -04:00
docker run -it --rm --name certbot -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot `
2017-08-21 11:35:09 -04:00
certonly --standalone --noninteractive --agree-tos --preferred-challenges http --email $email -d $domain `
2017-08-21 11:47:42 -04:00
--logs-dir /etc/letsencrypt/logs
2017-08-08 15:48:45 -04:00
}
2017-08-08 14:35:31 -04:00
}
2017-08-07 11:24:16 -04:00
2017-08-26 22:54:10 -04:00
docker pull bitwarden/setup
2017-08-19 09:36:03 -04:00
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup `
dotnet Setup.dll -install 1 -domain ${domain} -letsencrypt ${letsEncrypt}
2017-08-07 11:24:16 -04:00
2017-08-07 16:31:00 -04:00
echo "Setup complete"