updated option --help
This commit is contained in:
44
deploy.sh
44
deploy.sh
@@ -1,5 +1,47 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
(-h|--help) cat <<EOF
|
||||||
|
$0 [OPTIONS] FILES…
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
|
||||||
|
-h, --help show this help
|
||||||
|
|
||||||
|
FILES…
|
||||||
|
|
||||||
|
List of stack names or yaml files to deploy. There must be yaml
|
||||||
|
files with the same name. The extension .yaml may be given or not.
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
|
||||||
|
Deploys stack from yaml files. The stack name is identical to the
|
||||||
|
file name, but wihout path and without .yaml extendsion.
|
||||||
|
|
||||||
|
EXAMPLS
|
||||||
|
|
||||||
|
The following calls ado the same and deploy a local yaml file:
|
||||||
|
|
||||||
|
$0 yaml-file-name
|
||||||
|
$0 yaml-file-name.yaml
|
||||||
|
$0 ./yaml-file-name.yaml
|
||||||
|
|
||||||
|
Deploy three files from three sources:
|
||||||
|
|
||||||
|
$0 /path/to/file1/first.yaml /path/to/file2/second.yaml third
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit;;
|
||||||
|
(*) break;;
|
||||||
|
esac
|
||||||
|
if test $# -lt 1; then
|
||||||
|
echo "error: missing argument, try $0 --help" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
for f in $*; do
|
for f in $*; do
|
||||||
f=${f%.yaml}
|
f=${f%.yaml}
|
||||||
if ! test -e ${f}.yaml; then
|
if ! test -e ${f}.yaml; then
|
||||||
@@ -10,5 +52,5 @@ for f in $*; do
|
|||||||
for d in $(sed -n 's/^ *source: *//p' ${f}.yaml); do
|
for d in $(sed -n 's/^ *source: *//p' ${f}.yaml); do
|
||||||
test -e $d || mkdir -p $d
|
test -e $d || mkdir -p $d
|
||||||
done
|
done
|
||||||
docker stack deploy --compose-file ${f}.yaml ${f}
|
docker stack deploy --compose-file ${f}.yaml ${##*/f}
|
||||||
done
|
done
|
||||||
|
@@ -4,20 +4,21 @@ limit=''
|
|||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(-h|--help) cat <<EOF
|
(-h|--help) cat <<EOF
|
||||||
$0 [OPTIONS] NAMES…
|
$0 [OPTIONS] FILES…
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
|
||||||
-h, --help show this help
|
-h, --help show this help
|
||||||
-s, --limit service limit update to given service
|
-s, --limit service limit update to given service
|
||||||
|
|
||||||
NAMES…
|
FILES…
|
||||||
|
|
||||||
list of stack names to update
|
List of stack names or yaml files to deploy. There must be yaml
|
||||||
|
files with the same name. The extension .yaml may be given or not.
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
updates the docker images of all services in the given stacks
|
Updates the docker images of all services in the given stacks.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit;;
|
exit;;
|
||||||
|
Reference in New Issue
Block a user