14 lines
504 B
Bash
14 lines
504 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Run ONCE, on the manager node, after both boxes have joined the swarm.
|
||
|
|
# Labels the worker (beta) so the Forgejo stack's placement constraint
|
||
|
|
# (node.labels.role == forge) schedules there and nowhere else.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
WORKER_HOSTNAME="${1:?usage: $0 <worker_node_hostname_or_id> (see: docker node ls)}"
|
||
|
|
|
||
|
|
docker node update --label-add role=forge "$WORKER_HOSTNAME"
|
||
|
|
|
||
|
|
echo
|
||
|
|
echo "Labels on ${WORKER_HOSTNAME}:"
|
||
|
|
docker node inspect "$WORKER_HOSTNAME" --format '{{.Spec.Labels}}'
|