Files
windmill/workflows/u/antigravity/git_sync__flow/a.sh
Akira be710b920e 変更内容
削除したもの
traefik-net 外部ネットワーク
windmill_server の全 Traefik ラベル
windmill_extra の全 Traefik ラベル
サーバー固有のボリューム /home/windmill/windmill:/workspace(ローカルには不要)
Google OAuth 環境変数(ローカル開発では不要)
windmill_indexer(replicas: 0 で無意味だったので削除)
追加・変更したもの
項目	変更前	変更後
ネットワーク	traefik-net + windmill-internal	windmill-internal のみ
アクセス方法	Traefik経由(HTTPS)	Caddy経由 http://localhost
POSTGRES_PASSWORD	${POSTGRES_PASSWORD}	${DATABASE_PASSWORD}(.envと統一)
windmill_worker replicas	3	1(ローカル用に軽量化)
pull_policy	always	if_not_present(毎回pullしない)
BASE_URL	https://windmill.keinafarm.net	http://localhost
新規作成
Caddyfile.local — ローカル用のシンプルなCaddy設定(LSP WebSocket・デバッガー対応)
起動方法

docker compose -f docker-compose-dev.yml up -d
起動後、ブラウザで http://localhost にアクセスすればWindmillが使えます。

注意: windmill_worker に /var/run/docker.sock をマウントしていますが、Windows の Docker Desktop は通常これをサポートしています。もし問題が出る場合はそのボリューム行を削除してください。
2026-02-22 10:37:12 +09:00

69 lines
2.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -e
# 色付き出力
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${GREEN}=== Windmill Workflow Git Sync ===${NC}"
# リポジトリルート(コンテナ内: docker-compose.ymlの .:/workspace マウント)
REPO_ROOT="/workspace"
# wmill.yamlがあるディレクトリWindmill CLIはここで実行する
WMILL_DIR="${REPO_ROOT}/workflows"
# Windmill CLIのセットアップ
if ! command -v wmill &> /dev/null; then
echo -e "${YELLOW}Installing windmill-cli...${NC}"
npm install -g windmill-cli
fi
# 環境変数チェック
if [ -z "$WM_TOKEN" ]; then
echo -e "${RED}Error: WM_TOKEN is not set.${NC}"
exit 1
fi
# WM_BASE_URLはWindmill内で自動設定される場合があるが、念のため
: "${WM_BASE_URL:=http://windmill_server:8000}"
# Workspaceは環境変数または引数で
: "${WM_WORKSPACE:=admins}"
# Git設定コンテナ内での一時設定
git config --global --add safe.directory "$REPO_ROOT"
git config --global user.email "bot@keinafarm.net"
git config --global user.name "Windmill Bot"
# 1. Windmill(DB) -> Local Diskwmill.yamlがあるディレクトリで実行
echo -e "${YELLOW}Pulling from Windmill...${NC}"
cd "$WMILL_DIR"
wmill sync pull --token "$WM_TOKEN" --base-url "$WM_BASE_URL" --workspace "$WM_WORKSPACE" --skip-variables --skip-secrets --skip-resources --yes || exit 1
# 2. Local Disk -> Git RemoteGitリポジトリルートに戻ってgit操作
cd "$REPO_ROOT"
if [[ -n $(git status --porcelain) ]]; then
echo -e "${YELLOW}Changes detected, committing to Git...${NC}"
git add -A
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
git commit -m "Auto-sync: ${TIMESTAMP}"
echo -e "${YELLOW}Pushing to Gitea...${NC}"
# リモートの変更を先に取り込むローカルPCからのpushがある場合に備えて
git pull --rebase origin main || {
echo -e "${RED}Failed to pull from remote. Trying push anyway...${NC}"
}
git push origin main || {
echo -e "${RED}Failed to push. Need credentials in git remote url or credential helper.${NC}"
echo -e "${YELLOW}Hint: git remote set-url origin https://<token>@gitea.keinafarm.net/...${NC}"
exit 1
}
echo -e "${GREEN}✓ Changes pushed to Gitea${NC}"
else
echo -e "${GREEN}✓ No changes detected${NC}"
fi
echo -e "${GREEN}=== Sync Complete ===${NC}"