Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' for release 0.1.0-beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalger committed Jun 5, 2019
2 parents 4e763d2 + da1ae3a commit 2bc5aba
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 7 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
0.1.0-beta2
===============

* Updated assertion to automatically execute "warden install" if installed metadata indicator is older than bin/warden
* Fixed issue on Linux hosts where ssh_key.pub was unusable inside tunnel container due to bad permissions

0.1.0-beta1
===============

* Initial beta release
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Warden is a CLI utility for working with docker-compose environments, and enable
## Prerequisites

* [Homebrew](https://brew.sh) package manager (for installing Warden)
* [Docker for Mac](https://hub.docker.com/editions/community/docker-ce-desktop-mac) or [Docker for Linux](https://docs.docker.com/install/linux/docker-ce/fedora/)
* [Docker for Mac](https://hub.docker.com/editions/community/docker-ce-desktop-mac) or [Docker for Linux](https://docs.docker.com/install/linux/docker-ce/fedora/) (currently tested on Fedora 29)
* `docker-compose` available in your `$PATH` (included in Docker for Mac, can be installed via brew on Linux hosts)

## Installing Warden
Expand Down
8 changes: 7 additions & 1 deletion bin/warden
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ while (( "$#" )); do
done

function assert_installed {
if [[ ! -f "${WARDEN_HOME_DIR}/.installed" ]]; then
if [[ ! -f "${WARDEN_HOME_DIR}/.installed" ]] \
|| [[ "${WARDEN_HOME_DIR}/.installed" -ot "${WARDEN_DIR}/bin/warden" ]]
then
[[ -f "${WARDEN_HOME_DIR}/.installed" ]] && echo "==> Updating warden" || echo "==> Starting initialization"

"${WARDEN_DIR}/bin/warden" install

[[ -f "${WARDEN_HOME_DIR}/.installed" ]] && echo "==> Update complete" || echo "==> Initialization complete"
date > "${WARDEN_HOME_DIR}/.installed"
fi
}
Expand Down
7 changes: 5 additions & 2 deletions commands/install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ if [[ ! -f "${WARDEN_HOME_DIR}/tunnel/ssh_key" ]]; then
ssh-keygen -b 2048 -t rsa -f "${WARDEN_HOME_DIR}/tunnel/ssh_key" -N "" -C "[email protected]"
fi

## since bind mounts are native on linux to use .pub file as authorized_keys file in tunnel it must have proper perms
if [[ "$OSTYPE" == "linux-gnu" ]] && [[ "$(stat -c '%U' "${WARDEN_HOME_DIR}/tunnel/ssh_key.pub")" != "root" ]]; then
sudo chown root:root "${WARDEN_HOME_DIR}/tunnel/ssh_key.pub"
fi

if ! grep '## WARDEN START ##' /etc/ssh/ssh_config >/dev/null; then
echo "==> Configuring sshd tunnel in host ssh_config (requires sudo privileges)"
cat <<-EOF | sudo tee -a /etc/ssh/ssh_config >/dev/null
Expand All @@ -66,5 +71,3 @@ if ! grep '## WARDEN START ##' /etc/ssh/ssh_config >/dev/null; then
## WARDEN END ##
EOF
fi

echo "==> Installed successfully"
5 changes: 4 additions & 1 deletion commands/restart.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

## ensure warden install has been run
assert_installed

pushd "${WARDEN_DIR}" >/dev/null
docker-compose -p warden -f docker/docker-compose.yml restart "${WARDEN_PARAMS[@]}" "$@"
docker-compose -p warden -f docker/docker-compose.yml restart "${WARDEN_PARAMS[@]}" "$@"
3 changes: 3 additions & 0 deletions commands/sign-certificate.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

## ensure warden install has been run
assert_installed

mkdir -p "${WARDEN_SSL_DIR}/certs"

if [[ ! -f "${WARDEN_SSL_DIR}/rootca/certs/ca.cert.pem" ]]; then
Expand Down
3 changes: 3 additions & 0 deletions commands/start.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

## ensure warden install has been run
assert_installed

pushd "${WARDEN_DIR}" >/dev/null
docker-compose -p warden -f docker/docker-compose.yml start "${WARDEN_PARAMS[@]}" "$@"
1 change: 1 addition & 0 deletions commands/up.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
[[ ! ${WARDEN_COMMAND} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!" && exit 1

## ensure warden install has been run
assert_installed

mkdir -p "${WARDEN_HOME_DIR}/etc/traefik"
Expand Down
4 changes: 2 additions & 2 deletions commands/usage.help
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WARDEN_HEADER='

WARDEN_USAGE=$(cat <<EOF
${WARDEN_HEADER:1}
Warden version 0.1.0-dev
Warden version 0.1.0-beta2
\033[33mUsage:\033[0m
command [options] [arguments]
Expand All @@ -22,7 +22,7 @@ Warden version 0.1.0-dev
\033[33mCommands:\033[0m
down Stop and remove containers, networks, and services
install Installs local docker environment in the current directory
install Initializes or updates warden configuration on host machine
restart Restarts warden managed containers
sign-certificate Signs a wildcard certificate including all passed hostnames on the SAN list
start Start services
Expand Down

0 comments on commit 2bc5aba

Please sign in to comment.