Browse Source

script updates

pull/95/head
Kyle Spearrin 8 years ago
parent
commit
74415b9955
  1. 26
      README.md
  2. 0
      docker/docker-compose.macwin.yml
  3. 35
      docker/docker-compose.windows.yml
  4. 33
      scripts/bitwarden.ps1
  5. 23
      scripts/bitwarden.sh
  6. 2
      scripts/install.ps1
  7. 4
      scripts/run.ps1
  8. 7
      scripts/run.sh
  9. 2
      scripts/update-db.ps1

26
README.md

@ -71,34 +71,24 @@ You can deploy bitwarden using Docker containers on Windows, macOS, and Linux di @@ -71,34 +71,24 @@ You can deploy bitwarden using Docker containers on Windows, macOS, and Linux di
*These dependencies are free to use.*
### Windows
```
Invoke-RestMethod -OutFile bitwarden.ps1 -Uri https://raw.githubusercontent.com/bitwarden/core/master/scripts/bitwarden.ps1
.\bitwarden.ps1 -install
.\bitwarden.ps1 -updatedb
.\bitwarden.ps1 -run
```
### macOS
### Linux & macOS
```
curl -s -o bitwarden.sh https://raw.githubusercontent.com/bitwarden/core/master/scripts/bitwarden.sh
sudo curl -s -o bitwarden.sh https://raw.githubusercontent.com/bitwarden/core/master/scripts/bitwarden.sh && chmod u+x bitwarden.sh
./bitwarden.sh install
./bitwarden.sh updatedb
./bitwarden.sh runmac
./bitwarden.sh run
```
### Linux
### Windows
```
curl -s -o bitwarden.sh https://raw.githubusercontent.com/bitwarden/core/master/scripts/bitwarden.sh
Invoke-RestMethod -OutFile bitwarden.ps1 -Uri https://raw.githubusercontent.com/bitwarden/core/master/scripts/bitwarden.ps1
./bitwarden.sh install
./bitwarden.sh updatedb
./bitwarden.sh run
.\bitwarden.ps1 -install
.\bitwarden.ps1 -updatedb
.\bitwarden.ps1 -run
```
## Contribute

0
docker/docker-compose.mac.yml → docker/docker-compose.macwin.yml

35
docker/docker-compose.windows.yml

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

33
scripts/bitwarden.ps1

@ -4,11 +4,9 @@ param ( @@ -4,11 +4,9 @@ param (
[switch] $restart,
[switch] $update,
[switch] $updatedb,
[string] $output = "c:/bitwarden"
[string] $output = ""
)
$year = (Get-Date).year
Write-Host @'
_ _ _ _
| |__ (_) |___ ____ _ _ __ __| | ___ _ __
@ -19,25 +17,34 @@ Write-Host @' @@ -19,25 +17,34 @@ Write-Host @'
Write-Host "
Open source password management solutions
Copyright 2015-${year}, 8bit Solutions LLC
Copyright 2015-${(Get-Date).year}, 8bit Solutions LLC
https://bitwarden.com, https://github.com/bitwarden
"
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path
$dockerDir = ".\docker"
if($output -eq "") {
$output="${dir}\bitwarden"
}
if(!(Test-Path -Path $output)) {
New-Item -ItemType directory -Path $output | Out-Null
}
$scriptsDir = "${output}\scripts"
$dockerDir = "${output}\docker"
$githubBaseUrl = "https://raw.githubusercontent.com/bitwarden/core/master"
function Download-Run-Files {
Invoke-RestMethod -OutFile run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1"
Invoke-RestMethod -OutFile $scriptsDir\run.ps1 -Uri "${githubBaseUrl}/scripts/run.ps1"
Invoke-RestMethod -OutFile $dockerDir\docker-compose.yml -Uri "${githubBaseUrl}/docker/docker-compose.yml"
Invoke-RestMethod -OutFile $dockerDir\docker-compose.windows.yml ` -Uri "${githubBaseUrl}/docker/docker-compose.windows.yml"
Invoke-RestMethod -OutFile $dockerDir\docker-compose.macwin.yml ` -Uri "${githubBaseUrl}/docker/docker-compose.macwin.yml"
Invoke-RestMethod -OutFile $dockerDir\global.env -Uri "${githubBaseUrl}/docker/global.env"
Invoke-RestMethod -OutFile $dockerDir\mssql.env -Uri "${githubBaseUrl}/docker/mssql.env"
}
if($install) {
Invoke-RestMethod -OutFile install.ps1 ` -Uri "${githubBaseUrl}/scripts/install.ps1"
.\install.ps1 -outputDir $output
Invoke-RestMethod -OutFile $scriptsDir\install.ps1 ` -Uri "${githubBaseUrl}/scripts/install.ps1"
$scriptsDir\install.ps1 -outputDir $output
}
elseif($run -Or $restart) {
if(!(Test-Path -Path $dockerDir)) {
@ -45,7 +52,7 @@ elseif($run -Or $restart) { @@ -45,7 +52,7 @@ elseif($run -Or $restart) {
Download-Run-Files
}
.\run.ps1 -dockerDir $dockerDir
$scriptsDir\run.ps1 -dockerDir $dockerDir
}
elseif($update) {
if(Test-Path -Path $dockerDir) {
@ -54,11 +61,11 @@ elseif($update) { @@ -54,11 +61,11 @@ elseif($update) {
New-Item -ItemType directory -Path $dockerDir | Out-Null
Download-Run-Files
.\run.ps1 -dockerDir $dockerDir
$scriptsDir\run.ps1 -dockerDir $dockerDir
}
elseif($updatedb) {
Invoke-RestMethod -OutFile update-db.ps1 -Uri "${githubBaseUrl}/scripts/update-db.ps1"
.\update-db.ps1 -outputDir $output
Invoke-RestMethod -OutFile $scriptsDir\update-db.ps1 -Uri "${githubBaseUrl}/scripts/update-db.ps1"
$scriptsDir\update-db.ps1 -outputDir $output
}
else {
echo "No command found."

23
scripts/bitwarden.sh

@ -17,20 +17,11 @@ https://bitwarden.com, https://github.com/bitwarden @@ -17,20 +17,11 @@ https://bitwarden.com, https://github.com/bitwarden
EOF
OS="linux"
if [ $# -eq 2 ]
then
if [ $2 == "mac" -o $2 == "linux" ]
then
OS=$2
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
OUTPUT="$DIR/bitwarden"
if [ $# -eq 3 ]
if [ $# -eq 2 ]
then
OUTPUT=$3
OUTPUT=$2
fi
if [ ! -d "$OUTPUT" ]
@ -38,6 +29,12 @@ then @@ -38,6 +29,12 @@ then
mkdir $OUTPUT
fi
OS="linux"
if [ "$(uname)" == "Darwin" ]
then
OS="macwin"
fi
SCRIPTS_DIR="$OUTPUT/scripts"
DOCKER_DIR="$OUTPUT/docker"
GITHUB_BASE_URL="https://raw.githubusercontent.com/bitwarden/core/master"
@ -68,7 +65,7 @@ then @@ -68,7 +65,7 @@ then
mkdir $DOCKER_DIR
downloadRunFiles
fi
$SCRIPTS_DIR/run.sh $DOCKER_DIR $OS
$SCRIPTS_DIR/run.sh $DOCKER_DIR
elif [ "$1" == "update" ]
then
if [ -d "$DOCKER_DIR" ]
@ -78,7 +75,7 @@ then @@ -78,7 +75,7 @@ then
mkdir $DOCKER_DIR
downloadRunFiles
$SCRIPTS_DIR/run.sh $DOCKER_DIR $OS
$SCRIPTS_DIR/run.sh $DOCKER_DIR
elif [ "$1" == "updatedb" ]
then
curl -s -o $SCRIPTS_DIR/update-db.sh $GITHUB_BASE_URL/scripts/update-db.sh

2
scripts/install.ps1

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
param (
[string]$outputDir = "c:/bitwarden"
[string]$outputDir = "../."
)
if(!(Test-Path -Path $outputDir )){

4
scripts/run.ps1

@ -10,5 +10,5 @@ if($dockerDir -eq "") { @@ -10,5 +10,5 @@ if($dockerDir -eq "") {
docker --version
docker-compose --version
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.windows.yml down
docker-compose -f ${dockerDir}\docker-compose.yml -f ${dockerDir}\docker-compose.windows.yml up -d
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

7
scripts/run.sh

@ -3,14 +3,15 @@ set -e @@ -3,14 +3,15 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCKER_DIR=$DIR/../docker
OS="linux"
if [ $# -eq 1 ]
then
DOCKER_DIR=$1
fi
if [ $# -eq 2 ]
OS="linux"
if [ "$(uname)" == "Darwin" ]
then
OS=$2
OS="macwin"
fi
docker --version

2
scripts/update-db.ps1

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
param (
[string]$outputDir = "c:/bitwarden"
[string]$outputDir = "../."
)
docker run -it --rm --name setup --network container:mssql -v ${outputDir}:/bitwarden bitwarden/setup `

Loading…
Cancel
Save