-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy path.hooks-config.json
More file actions
131 lines (131 loc) · 3.57 KB
/
.hooks-config.json
File metadata and controls
131 lines (131 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
"pre-deploy": {
"enabled": true,
"description": "Run before any deployment",
"actions": [
{
"type": "validation",
"name": "check-git-status",
"command": "git status --porcelain",
"expectEmpty": true,
"errorMessage": "Uncommitted changes detected. Please commit or stash changes before deployment."
},
{
"type": "validation",
"name": "run-tests",
"command": "npm test 2>/dev/null || echo \"No tests configured\"",
"optional": true
}
]
},
"post-deploy": {
"enabled": true,
"description": "Run after successful deployment",
"actions": [
{
"type": "notification",
"name": "log-deployment",
"command": "echo \"[$(date)] Deployment completed to {server}\" >> deployments.log"
},
{
"type": "notification",
"name": "notify-slack",
"command": "curl -X POST -H \"Content-Type: application/json\" -d \"{{\\\"text\\\":\\\"Deployment to {server} completed\\\"}}\" $SLACK_WEBHOOK_URL 2>/dev/null || true",
"optional": true,
"requiresEnv": [
"SLACK_WEBHOOK_URL"
]
}
]
},
"on-error": {
"enabled": true,
"description": "Run when an error occurs",
"actions": [
{
"type": "notification",
"name": "log-error",
"command": "echo \"[$(date)] Error on {server}: {error}\" >> errors.log"
},
{
"type": "recovery",
"name": "attempt-recovery",
"remoteCommand": "bench restart && bench clear-cache",
"server": "{server}",
"optional": true
}
]
},
"pre-bench-update": {
"enabled": true,
"description": "Run before bench update",
"actions": [
{
"type": "backup",
"name": "backup-database",
"remoteCommand": "bench --site all backup --with-files",
"server": "{server}"
},
{
"type": "validation",
"name": "check-disk-space",
"remoteCommand": "df -h | grep -E \"/$|/home\" | awk '{print $5}' | sed 's/%//' | awk '{if($1 > 80) exit 1}'",
"server": "{server}",
"errorMessage": "Insufficient disk space (>80% used)"
}
]
},
"post-bench-update": {
"enabled": true,
"description": "Run after bench update",
"actions": [
{
"type": "verification",
"name": "check-services",
"remoteCommand": "supervisorctl status | grep -E \"RUNNING|STOPPED\"",
"server": "{server}"
},
{
"type": "verification",
"name": "check-site-status",
"remoteCommand": "bench --site all doctor",
"server": "{server}"
}
]
},
"pre-connect": {
"enabled": false,
"description": "Run before connecting to a server",
"actions": [
{
"type": "validation",
"name": "check-vpn",
"command": "ping -c 1 -W 2 10.0.0.1 > /dev/null 2>&1",
"errorMessage": "VPN not connected",
"optional": true
}
]
},
"post-connect": {
"enabled": false,
"description": "Run after successful connection",
"actions": [
{
"type": "notification",
"name": "log-connection",
"command": "echo \"[$(date)] Connected to {server}\" >> connections.log"
}
]
},
"context-test": {
"enabled": true,
"description": "Context replacement test",
"actions": [
{
"type": "notification",
"name": "use-context",
"command": "echo \"Server: {server}, Error: {error}\" > /Users/jeremy/mcp/mcp-ssh-manager/context-test.txt"
}
]
}
}