差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
| tech:docker_swarm [2025/09/26 15:07] – [安裝與部署] jonathan | tech:docker_swarm [2025/11/19 11:49] (目前版本) – [使用 portainer 進行 Web 統一控管] jonathan | ||
|---|---|---|---|
| 行 23: | 行 23: | ||
| * 當 Agent 安裝成功後, | * 當 Agent 安裝成功後, | ||
| * 回到 Home 在 Environments 清單就可以看到 Portainer-186 , 點下去就可以開始管理這個 Swarm cluster \\ {{: | * 回到 Home 在 Environments 清單就可以看到 Portainer-186 , 點下去就可以開始管理這個 Swarm cluster \\ {{: | ||
| + | * 當每台 swarm node 重新啟動後 Portainer 管理介面點選出現 Failure Unable to retrieve system info: Unable to find an agent on any manager node 這異常訊息時, | ||
| + | portainer-161: | ||
| + | portainer_agent | ||
| + | overall progress: 1 out of 1 tasks | ||
| + | aeaia7g7xz3w: | ||
| + | verify: Service portainer_agent converged | ||
| + | </ | ||
| - | ===== 建立 | + | ===== 建立 |
| - | * 希望可以透過 Discord 進行通知 | + | * stack yaml < |
| - | * 將 Discord 的 Webhook URL 以建立 Secrets 方式處理, | + | |
| - | echo ' | + | |
| - | </ | + | |
| - | * 使用 Configs 來存放通知訊息的設定內容 template | + | |
| - | vi watchtower_template.tpl</ | + | |
| - | {{- if .Entries -}} | + | |
| - | {{- range .Entries -}} | + | |
| - | **Service: | + | |
| - | **Image:** `{{.Service.ImageName}}` | + | |
| - | **Version: | + | |
| - | --- | + | |
| - | {{- end -}} | + | |
| - | {{- else -}} | + | |
| - | *No new updates found.* | + | |
| - | {{- end -}} | + | |
| - | </ | + | |
| - | docker config create watchtower_notification_template watchtower_template.tpl | + | |
| - | </ | + | |
| - | * 建立 watchtower 的 Swarm Stack < | + | |
| - | vi watchtower-stack.yml</ | + | |
| services: | services: | ||
| - | | + | |
| - | image: containrrr/watchtower | + | image: containrrr/shepherd:latest |
| - | volumes: | + | |
| - | - "/ | + | |
| - | environment: | + | |
| - | TZ: Asia/ | + | |
| - | WATCHTOWER_SCHEDULE: | + | |
| - | WATCHTOWER_CLEANUP: | + | |
| - | WATCHTOWER_NOTIFICATIONS: | + | |
| - | WATCHTOWER_NOTIFICATION_URL_FILE: | + | |
| - | WATCHTOWER_NOTIFICATIONS_LEVEL: | + | |
| - | WATCHTOWER_NOTIFICATION_TITLE: | + | |
| - | WATCHTOWER_NOTIFICATION_TEMPLATE_FILE: | + | |
| - | secrets: | + | |
| - | - watchtower_discord_url | + | |
| - | configs: | + | |
| - | - source: watchtower_notification_template | + | |
| - | target: / | + | |
| - | command: --scope swarm | + | |
| deploy: | deploy: | ||
| - | mode: global | + | mode: replicated |
| + | replicas: 1 | ||
| placement: | placement: | ||
| constraints: | constraints: | ||
| 行 73: | 行 44: | ||
| restart_policy: | restart_policy: | ||
| condition: on-failure | condition: on-failure | ||
| - | secrets: | + | delay: 10s |
| - | | + | |
| - | | + | |
| - | configs: | + | - TZ=Asia/ |
| - | | + | - SLEEP_TIME=8h |
| - | | + | # - WITH_REGISTRY_AUTH=true # 啟用註冊庫驗證 |
| - | </file> | + | # - REGISTRY_USER_FILE=/run/ |
| - | docker stack deploy | + | # - REGISTRY_PASSWORD_FILE=/ |
| - | </cli> | + | - ROLLBACK_ON_FAILURE=true |
| + | - UPDATE_OPTIONS=--update-delay=1m --update-parallelism=1 --update-failure-action=rollback | ||
| + | - IGNORELIST_SERVICES=cleanup-scheduler_cleanup-scheduler | ||
| + | - NO_PROXY=localhost, | ||
| + | volumes: | ||
| + | | ||
| + | source: / | ||
| + | target: / | ||
| + | </ | ||
| ===== FAQ ===== | ===== FAQ ===== | ||
| ==== 1. 移除特定 Worker host 方式 Exp. immich-237 ==== | ==== 1. 移除特定 Worker host 方式 Exp. immich-237 ==== | ||
| 行 118: | 行 97: | ||
| q4fxgqgi2sp42wntxynks3wqf | q4fxgqgi2sp42wntxynks3wqf | ||
| </ | </ | ||
| + | |||
| + | ==== 3. 建立 nfs volume 的作法 ==== | ||
| + | - 先在 NFS Server 建立分享目錄與權限設定 參考 - [[tech/ | ||
| + | - NFS Volume 的指定方式如下 Exp. NFS Serer: 192.168.1.159 , 分享目錄: | ||
| + | volumes: | ||
| + | mystack_nfs-data: | ||
| + | driver: local | ||
| + | driver_opts: | ||
| + | type: nfs | ||
| + | o: " | ||
| + | device: ":/ | ||
| + | </ | ||
| + | <note important> | ||
| + | * 啟動 stack 時**不會**如同本地 volume 自動建立出目錄, | ||
| + | * 如想要修改 NFS Volume 定義 | ||
| + | - 要將 stack 移除 Exp. < | ||
| + | - 進入 swarm **每個 node 移除 volume** Exp.< | ||
| + | - 重新部署 stack Exp. < | ||
| + | - 檢查新建立的 Volume 內容 Exp. < | ||
| + | </ | ||
| {{tag> | {{tag> | ||