Add setup scripts to install/run vault locally and using docker compose

This commit is contained in:
Mark Paluch
2016-04-01 11:24:09 +02:00
parent 16fe3596ce
commit efe53f3d55
5 changed files with 75 additions and 2 deletions

8
docker-compose.yml Normal file
View File

@@ -0,0 +1,8 @@
# Work in Progress
vault:
image: cgswong/vault
volumes:
- ./src/test/resources:/config
ports:
- "8200:8200"
command: server -config /config/vault.conf

9
src/test/bash/env.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
###########################################################################
# Vault environment settings. Source this file. #
###########################################################################
export VAULT_TOKEN=00000000-0000-0000-0000-000000000000
export VAULT_ADDR=http://localhost:8200
export VAULT_SKIP_VERIFY=true

45
src/test/bash/install_vault.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
###########################################################################
# Download and Install Vault #
# This script is prepared for caching of the vault/download directory #
###########################################################################
VAULT_VER="0.5.2"
UNAME=$(uname -s | tr '[:upper:]' '[:lower:]')
VAULT_ZIP="vault_${VAULT_VER}_${UNAME}_amd64.zip"
IGNORE_CERTS="${IGNORE_CERTS:-no}"
# cleanup
mkdir -p vault/download
cd vault
if [[ ! -f "download/${VAULT_ZIP}" ]] ; then
cd download
# install Vault
if [[ "${IGNORE_CERTS}" == "no" ]] ; then
echo "Downloading consul with certs verification"
wget "https://releases.hashicorp.com/vault/${VAULT_VER}/${VAULT_ZIP}"
else
echo "WARNING... Downloading consul WITHOUT certs verification"
wget "https://releases.hashicorp.com/vault/${VAULT_VER}/${VAULT_ZIP}" --no-check-certificate
fi
if [[ $? != 0 ]] ; then
echo "Cannot download vault"
exit 1
fi
cd ..
fi
if [[ -f vault ]] ; then
rm vault
fi
unzip download/${VAULT_ZIP}
chmod a+x vault
# check
./vault --version

View File

@@ -0,0 +1,9 @@
#!/bin/bash
###########################################################################
# Start Vault on localhost:8200 #
###########################################################################
BASEDIR=`dirname $0`/../../..
./vault/vault server -config=${BASEDIR}/src/test/resources/vault.conf
exit $?

View File

@@ -2,6 +2,8 @@ backend "inmem" {
}
listener "tcp" {
address = "127.0.0.1:8200"
address = "0.0.0.0:8200"
tls_disable = 1
}
}
disable_mlock = true