1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

setup updates and added mac support to conpose

This commit is contained in:
Kyle Spearrin 2017-08-11 14:43:46 -04:00
parent 3ac1f87e12
commit e822e66a79
6 changed files with 73 additions and 22 deletions

View File

@ -0,0 +1,35 @@
version: '3'
services:
mssql:
volumes:
- mssql_data:/var/opt/mssql/data
env_file:
- mssql.env
- /etc/bitwarden/docker/mssql.override.env
web:
volumes:
- /etc/bitwarden/web:/etc/bitwarden/web
attachments:
volumes:
- /etc/bitwarden/core/attachments:/etc/bitwarden/core/attachments
api:
volumes:
- /etc/bitwarden/core:/etc/bitwarden/core
env_file:
- global.env
- /etc/bitwarden/docker/global.override.env
identity:
volumes:
- /etc/bitwarden/identity:/etc/bitwarden/identity
- /etc/bitwarden/core:/etc/bitwarden/core
env_file:
- global.env
- /etc/bitwarden/docker/global.override.env
nginx:
volumes:
- /etc/bitwarden/nginx:/etc/bitwarden/nginx
- /etc/bitwarden/letsencrypt:/etc/letsencrypt
- /etc/bitwarden/ssl:/etc/ssl
volumes:
mssql_data:

11
scripts/run-mac.sh Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
DIR="$(dirname $(readlink -f $0))"
DOCKER_DIR=$DIR/../docker
docker --version
docker-compose --version
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.mac.yml down
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.mac.yml up -d

View File

@ -7,5 +7,5 @@ DOCKER_DIR=$DIR/../docker
docker --version
docker-compose --version
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.windows.yml down
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.windows.yml up -d
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.linux.yml down
docker-compose -f $DOCKER_DIR/docker-compose.yml -f $DOCKER_DIR/docker-compose.linux.yml up -d

View File

@ -8,21 +8,23 @@ if(!(Test-Path -Path $outputDir )){
docker --version
[string]$domain = $( Read-Host "Enter the domain name for bitwarden (ex. bitwarden.company.com)" )
[string]$letsEncrypt = $( Read-Host "Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n)" )
[string]$installId = $( Read-Host "(!) Enter your installation id (get it at https://bitwarden.com/host/)" )
[string]$installKey = $( Read-Host "(!) Enter your installation key" )
[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)" )
$databasePassword=-join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_})
if($letsEncrypt -eq "y") {
[string]$email = $( Read-Host "Enter your email address (Let's Encrypt will send you certificate expiration reminders)" )
[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 letsencrypt -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --preferred-challenges http --email $email --agree-tos -d $domain
docker run -it --rm --name certbot -p 80:80 -v $outputDir/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --preferred-challenges http --email $email --agree-tos -d $domain
}
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup dotnet Setup.dll -domain ${domain} -letsencrypt ${letsEncrypt} -db_pass ${databasePassword}
docker run -it --rm --name setup -v ${outputDir}:/bitwarden bitwarden/setup dotnet Setup.dll -domain ${domain} -letsencrypt ${letsEncrypt} -db_pass ${databasePassword} -install_id $installId -install_key $installKey
echo "Setup complete"

View File

@ -6,21 +6,25 @@ mkdir -p $OUTPUT_DIR
docker --version
echo "Enter the domain name for bitwarden (ex. bitwarden.company.com): "
echo "(!) Enter your installation id (get it at https://bitwarden.com/host/): "
read INSTALL_ID
echo -e "\n(!) Enter your installation key: "
read INSTALL_KEY
echo -e "\n(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com): "
read DOMAIN
echo -e "\nDo you want to use Let's Encrypt to generate a free SSL certificate? (y/n): "
echo -e "\n(!) Do you want to use Let's Encrypt to generate a free SSL certificate? (y/n): "
read LETS_ENCRYPT
DATABASE_PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 32)
if [ $LETS_ENCRYPT == 'y' ]
then
echo -e "\nEnter your email address (Let's Encrypt will send you certificate expiration reminders): "
echo -e "\n(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders): "
read EMAIL
mkdir -p $OUTPUT_DIR/letsencrypt/live/$DOMAIN
docker run -it --rm -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --preferred-challenges http --email $EMAIL --agree-tos -d $DOMAIN
docker run -it --rm --name certbot -p 80:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot certonly --standalone --noninteractive --preferred-challenges http --email $EMAIL --agree-tos -d $DOMAIN
fi
docker run -it --rm -v $OUTPUT_DIR:/bitwarden bitwarden/setup dotnet Setup.dll -domain $DOMAIN -letsencrypt $LETS_ENCRYPT -db_pass $DATABASE_PASSWORD
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup dotnet Setup.dll -domain $DOMAIN -letsencrypt $LETS_ENCRYPT -db_pass $DATABASE_PASSWORD -install_id $INSTALL_ID -install_key $INSTALL_KEY
echo -e "\nSetup complete"

View File

@ -26,6 +26,10 @@ namespace Setup
_args = args;
_parameters = ParseParameters();
_installationId = _parameters.ContainsKey("install_id") ?
_parameters["install_id"].ToLowerInvariant() : null;
_installationKey = _parameters.ContainsKey("install_key") ?
_parameters["install_key"].ToLowerInvariant() : null;
_outputDir = _parameters.ContainsKey("out") ?
_parameters["out"].ToLowerInvariant() : "/etc/bitwarden";
_domain = _parameters.ContainsKey("domain") ?
@ -38,7 +42,7 @@ namespace Setup
_ssl = _letsEncrypt;
if(!_letsEncrypt)
{
Console.Write("Are you using your own SSL certificate? (y/n): ");
Console.Write("(!) Are you using your own SSL certificate? (y/n): ");
_ssl = Console.ReadLine().ToLowerInvariant() == "y";
if(_ssl)
@ -54,11 +58,7 @@ namespace Setup
_url = _ssl ? $"https://{_domain}" : $"http://{_domain}";
BuildNginxConfig();
Console.Write("Installation id (get it at https://bitwarden.com/host/): ");
_installationId = Console.ReadLine().ToLowerInvariant();
Console.Write("Installation key (get it at https://bitwarden.com/host/): ");
_installationKey = Console.ReadLine().ToLowerInvariant();
Console.Write("Do you want to use push notifications? (y/n): ");
Console.Write("(!) Do you want to use push notifications? (y/n): ");
_push = Console.ReadLine().ToLowerInvariant() == "y";
BuildEnvironmentFiles();
@ -69,7 +69,7 @@ namespace Setup
{
if(!_ssl)
{
Console.Write("Do you want to generate a self signed SSL certificate? (y/n): ");
Console.Write("(!) Do you want to generate a self signed SSL certificate? (y/n): ");
if(Console.ReadLine().ToLowerInvariant() == "y")
{
Directory.CreateDirectory($"/bitwarden/ssl/self/{_domain}/");
@ -85,7 +85,6 @@ namespace Setup
if(_letsEncrypt)
{
Directory.CreateDirectory($"/bitwarden/letsencrypt/live/{_domain}/");
Console.WriteLine("Generating DH ephemeral parameter.");
Exec($"openssl dhparam -out /bitwarden/letsencrypt/live/{_domain}/dhparam.pem 2048");
}
@ -109,14 +108,14 @@ namespace Setup
var dh = _letsEncrypt;
if(_ssl && !_selfSignedSsl && !_letsEncrypt)
{
Console.Write("Use Diffie Hellman ephemeral parameters for SSL (requires dhparam.pem)? (y/n): ");
Console.Write("(!) Use Diffie Hellman ephemeral parameters for SSL (requires dhparam.pem)? (y/n): ");
dh = Console.ReadLine().ToLowerInvariant() == "y";
}
var trusted = _letsEncrypt;
if(_ssl && !_selfSignedSsl && !_letsEncrypt)
{
Console.Write("Is this a trusted SSL certificate (requires ca.crt)? (y/n): ");
Console.Write("(!) Is this a trusted SSL certificate (requires ca.crt)? (y/n): ");
trusted = Console.ReadLine().ToLowerInvariant() == "y";
}