Skip to content

Commit 1cd6c45

Browse files
authored
Merge pull request #8 from kitconcept/scale-after
Add option to scale a service after a successful deployment
2 parents 1fbbd0e + 99374d2 commit 1cd6c45

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ GitHub Action and Docker image used to deploy a Docker stack on a Docker Swarm.
3838
| `stack_param` | `STACK_PARAM` | Additional parameter (env var) to be passed to the stack. | | |
3939
| `env_file` | `ENV_FILE` | Additional environment variables to be passed to the stack. | | |
4040
| `debug` | `DEBUG` | Verbose logging | | **0** |
41+
| `scale_after` | `SCALE_AFTER` | Scale a service after a deployment has converged successfully. Example: servicename=1 | | |
4142

4243

4344
## Using the GitHub Action

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ inputs:
5353
description: "Debug information"
5454
required: false
5555
default: "0"
56+
scale_after:
57+
description: "Service to scale after successful deploy (example: servicename=1)"
58+
default: ""
5659
runs:
5760
using: 'docker'
5861
image: 'docker://ghcr.io/kitconcept/docker-stack-deploy:latest'
@@ -70,3 +73,4 @@ runs:
7073
STACK_PARAM: ${{ inputs.stack_param }}
7174
ENV_FILE: ${{ inputs.env_file }}
7275
DEBUG: ${{ inputs.debug }}
76+
SCALE_AFTER: ${{ inputs.scale_after }}

scripts/docker-entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ check_deploy() {
6969
/stack-wait.sh -t "${DEPLOY_TIMEOUT}" "${STACK_NAME}"
7070
}
7171

72+
scale_after() {
73+
if [[ -n "$SCALE_AFTER" ]]; then
74+
echo "Scaling services: $SCALE_AFTER"
75+
docker service scale $SCALE_AFTER
76+
fi
77+
}
78+
7279
[ -z ${DEBUG+x} ] && export DEBUG="0"
7380

7481
# ADDITIONAL ENV VARIABLES
@@ -182,3 +189,5 @@ else
182189
echo "Deploy: Failed"
183190
exit 1
184191
fi
192+
193+
scale_after

0 commit comments

Comments
 (0)