-
-
Save mcint/aef7bd143bdcdf6b649d1e414af46ead to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
CONF=$1 | |
KEY=$2 | |
NAME="${3:-kloudless-connect}" | |
usage(){ | |
echo >&2 \ | |
"Usage: $0 [./k-connect.yaml] [./ssh-key.priv] [[name]]" | |
} | |
[ ($# != 2) ] && [ ($# != 3) ] && usage && exit 1 | |
#[ $# != 3 ] && usage && exit 1 | |
get_abs_path(){ | |
_path="$1" | |
if [ "$_path" != "/*" ]; then | |
_path="$PWD/$_path"; | |
fi | |
echo "$_path" | |
} | |
verify_exists(){ | |
_type="$1" | |
_path="$2" | |
if [ ! -f "$_path" ]; then | |
usage | |
echo >&2 "No $_type file present at path: $_path"; | |
exit | |
fi | |
} | |
verify_exists "config" $CONF | |
CONF="`get_abs_path $CONF`" | |
verify_exists "ssh key" $KEY | |
KEY="`get_abs_path $KEY`" | |
docker run --name $NAME --rm \ | |
-v "$CONF":/etc/kloudless/connect.yaml \ | |
-v "$KEY":/gateway.priv \ | |
--memory 250m \ | |
--cpus="1" \ | |
kloudless/customer-proxy:1.0 | |
#### Useful commands: | |
## docker logs proxy | |
## docker exec -it proxy service kloudless_connect [status|start|restart|stop] | |
## docker exec -it proxy supervisorctl status [[kloudless_connect]:[...]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment