Skip to content

Commit 58fea43

Browse files
committed
Refactor deploy script to use SPIN_SWARM_STACK_NAME variable for Docker stack deployment
- Updated the deployment command in deploy.sh to utilize the new SPIN_SWARM_STACK_NAME variable, enhancing clarity and consistency in stack naming. - Introduced SPIN_SWARM_STACK_NAME to allow for customizable stack names based on the project and environment, improving flexibility in deployment configurations.
1 parent f0e9c78 commit 58fea43

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/actions/deploy.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ deploy_docker_stack() {
4747

4848
local docker_host="ssh://$ssh_user@$manager_host:$ssh_port"
4949
echo "${BOLD}${BLUE}📤 Deploying Docker stack with compose files: ${compose_files[*]} on $manager_host...${RESET}"
50-
docker -H "$docker_host" stack deploy "${compose_args[@]}" --detach=false --prune "$spin_project_name-$deployment_environment"
50+
docker -H "$docker_host" stack deploy "${compose_args[@]}" --detach=false --prune "$swarm_stack_name"
5151
if [ $? -eq 0 ]; then
5252
echo "${BOLD}${BLUE}🎉 Successfully deployed Docker stack on $manager_host.${RESET}"
5353

@@ -199,6 +199,7 @@ action_deploy() {
199199
ssh_user="${SPIN_SSH_USER:-"deploy"}"
200200
spin_project_name="${SPIN_PROJECT_NAME:-"spin"}"
201201
registry_image="${SPIN_REGISTRY_IMAGE:-"registry:2"}"
202+
swarm_stack_name="${SPIN_SWARM_STACK_NAME:-"$spin_project_name-$deployment_environment"}"
202203

203204
# Clean up services on exit
204205
trap cleanup_on_exit EXIT

0 commit comments

Comments
 (0)