Files
server/scripts/install.sh

59 lines
1.4 KiB
Bash
Raw Normal View History

2017-08-07 11:24:16 -04:00
#!/usr/bin/env bash
set -e
2017-08-19 21:45:13 -04:00
OUTPUT_DIR="../."
2017-11-09 00:18:35 -05:00
if [ $# -gt 0 ]
2017-08-19 16:17:32 -04:00
then
OUTPUT_DIR=$1
fi
2017-10-03 23:20:09 -04:00
2017-11-08 22:24:23 -05:00
COREVERSION="latest"
2017-11-09 00:18:35 -05:00
if [ $# -gt 1 ]
2017-11-08 22:24:23 -05:00
then
COREVERSION=$2
fi
WEBVERSION="latest"
2017-11-09 00:18:35 -05:00
if [ $# -gt 2 ]
2017-11-08 22:24:23 -05:00
then
WEBVERSION=$3
fi
OS="lin"
if [ "$(uname)" == "Darwin" ]
then
OS="mac"
fi
2017-10-03 23:20:09 -04:00
2017-08-11 15:05:50 -04:00
mkdir -p $OUTPUT_DIR
2017-08-08 15:48:45 -04:00
2017-08-21 11:21:40 -04:00
LETS_ENCRYPT="n"
2017-08-19 15:27:57 -04:00
read -p "(!) Enter the domain name for your bitwarden instance (ex. bitwarden.company.com): " DOMAIN
2017-08-07 11:24:16 -04:00
if [ "$DOMAIN" == "" ]
then
DOMAIN="localhost"
fi
2017-08-21 11:21:40 -04:00
if [ "$DOMAIN" != "localhost" ]
2017-08-08 15:48:45 -04:00
then
2017-08-21 11:21:40 -04:00
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
2017-08-21 11:47:42 -04:00
mkdir -p $OUTPUT_DIR/letsencrypt
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 $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
2017-08-21 11:47:42 -04:00
certonly --standalone --noninteractive --agree-tos --preferred-challenges http --email $EMAIL -d $DOMAIN \
--logs-dir /etc/letsencrypt/logs
2017-08-21 11:21:40 -04:00
fi
2017-08-08 15:48:45 -04:00
fi
2017-08-07 11:24:16 -04:00
2017-11-08 22:24:23 -05:00
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
2017-08-07 11:24:16 -04:00
2017-08-19 15:52:10 -04:00
echo ""
echo "Setup complete"