2017-08-07 17:24:16 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2017-08-08 21:48:45 +02:00
|
|
|
docker --version
|
2017-08-11 21:05:50 +02:00
|
|
|
echo ""
|
|
|
|
|
2017-08-20 03:45:13 +02:00
|
|
|
OUTPUT_DIR="../."
|
2017-08-19 22:17:32 +02:00
|
|
|
if [ $# -eq 1 ]
|
|
|
|
then
|
|
|
|
OUTPUT_DIR=$1
|
|
|
|
fi
|
2017-08-11 21:05:50 +02:00
|
|
|
mkdir -p $OUTPUT_DIR
|
2017-08-08 21:48:45 +02:00
|
|
|
|
2017-08-19 21:27:57 +02:00
|
|
|
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
|
2017-08-07 17:24:16 +02:00
|
|
|
|
2017-08-20 03:55:34 +02:00
|
|
|
if [ "$LETS_ENCRYPT" == "y" ]
|
2017-08-08 21:48:45 +02:00
|
|
|
then
|
2017-08-19 21:52:10 +02:00
|
|
|
read -p "(!) Enter your email address (Let's Encrypt will send you certificate expiration reminders): " EMAIL
|
2017-08-08 21:48:45 +02:00
|
|
|
mkdir -p $OUTPUT_DIR/letsencrypt/live/$DOMAIN
|
2017-08-19 15:36:03 +02:00
|
|
|
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
|
2017-08-08 21:48:45 +02:00
|
|
|
fi
|
2017-08-07 17:24:16 +02:00
|
|
|
|
2017-08-19 15:36:03 +02:00
|
|
|
docker run -it --rm --name setup -v $OUTPUT_DIR:/bitwarden bitwarden/setup \
|
|
|
|
dotnet Setup.dll -install 1 -domain $DOMAIN -letsencrypt $LETS_ENCRYPT
|
2017-08-07 17:24:16 +02:00
|
|
|
|
2017-08-19 21:52:10 +02:00
|
|
|
echo ""
|
|
|
|
echo "Setup complete"
|