Skip to content

Commit

Permalink
Refactor deploy script to use SPIN_SWARM_STACK_NAME variable for Dock…
Browse files Browse the repository at this point in the history
…er 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.
  • Loading branch information
jaydrogers committed Jan 23, 2025
1 parent f0e9c78 commit 58fea43
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/actions/deploy.sh
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ deploy_docker_stack() {

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

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

# Clean up services on exit
trap cleanup_on_exit EXIT

0 comments on commit 58fea43

Please sign in to comment.