cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2020-02-01 23:14:37 +01:00
parent 37b6df3996
commit 2669d633ea
4 changed files with 20 additions and 7 deletions

View File

@ -4,6 +4,10 @@
[![Docker Hub](https://img.shields.io/badge/docker-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/xoxys/bitwardenrs)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
This is a custom Docker image for [bitwarden_rs](https://github.com/dani-garcia/bitwarden_rs). Bitwarden_rs is a Bitwarden server API implementation written in Rust compatible with upstream Bitwarden clients, perfect for self-hosted deployment where running the official resource-heavy service might not be ideal.
> **WARNING**: While bitwarden_rs does not allow to compile binaries with multi DB providers, this build will only work with a PostgreSQL database backend.
## Usage
### Docker Compose
@ -31,6 +35,8 @@ services:
ports:
- "80:8080"
environment:
ITWARDENRS_WAIT_FOR_HOST: bitwardenrs_postgres
BITWARDENRS_WAIT_FOR_PORT: 5432
BITWARDENRS_DATABASE_URL: postgresql://user:pass@bitwardenrs_postgres:5432/bitwarden
BITWARDENRS_ADMIN_TOKEN: test
@ -43,6 +49,11 @@ volumes:
```Shell
BITWARDENRS_DATABASE_URL=
# Wait for database host. If you don't set a Host and Port
# Bitwarden will start immediately.
BITWARDENRS_WAIT_FOR_HOST=
BITWARDENRS_WAIT_FOR_PORT=
BITWARDENRS_WAIT_FOR_TIMEOUT=15
BITWARDENRS_TEMPLATES_FOLDER=
BITWARDENRS_RELOAD_TEMPLATES=False

View File

@ -1,12 +1,13 @@
#!/usr/bin/env sh
set -eo pipefail
/usr/local/bin/gomplate -V -o /app/.env -f /etc/templates/env.tmpl
if [ ! -z "$BITWARDENRS_WAIT_FOR_HOST" ] && [ ! -z "$BITWARDENRS_WAIT_FOR_PORT" ]
then
printf "Wait for ${BITWARDENRS_WAIT_FOR_HOST}:${BITWARDENRS_WAIT_FOR_PORT} ...\n"
/usr/local/bin/wait-for ${BITWARDENRS_WAIT_FOR_HOST}:${BITWARDENRS_WAIT_FOR_PORT}
printf "Wait for database server ...\n"
/usr/local/bin/wait-for
fi
printf "Start Bitwarden Server ...\n"

View File

@ -1,4 +1,5 @@
#!/usr/bin/env sh
set -eo pipefail
URL=http://127.0.0.1:8080/alive

View File

@ -1,6 +1,6 @@
#!/bin/sh
#!/usr/bin/env sh
TIMEOUT=15
BITWARDENRS_WAIT_FOR_TIMEOUT=15
QUIET=0
echoerr() {
@ -20,9 +20,9 @@ USAGE
}
wait_for() {
for i in `seq $TIMEOUT` ; do
nc -z "$HOST" "$PORT" > /dev/null 2>&1
for i in `seq $BITWARDENRS_WAIT_FOR_TIMEOUT` ; do
nc -z "$BITWARDENRS_WAIT_FOR_HOST" "$BITWARDENRS_WAIT_FOR_PORT" > /dev/null 2>&1
result=$?
if [ $result -eq 0 ] ; then
if [ $# -gt 0 ] ; then