@@ -56,11 +56,6 @@ mkdir -p "$GHE_SNAPSHOT_DIR"
56
56
cd " $GHE_SNAPSHOT_DIR "
57
57
touch " incomplete"
58
58
59
- # This is toggled true once we've successfully re-enabled maintenance mode
60
- # on the remote appliance. This is used to avoid trying to re-enable in the exit
61
- # trap again on successful backup runs.
62
- GHE_MAINTENANCE_MODE_ENABLED=false
63
-
64
59
# To prevent multiple backup runs happening at the same time, we create a
65
60
# in-progress file with the timestamp and pid of the backup process,
66
61
# giving us a form of locking.
@@ -80,10 +75,6 @@ cleanup () {
80
75
fi
81
76
fi
82
77
83
- if $GHE_MAINTENANCE_MODE_ENABLED ; then
84
- ghe-maintenance-mode-disable " $GHE_HOSTNAME "
85
- fi
86
-
87
78
# Cleanup SSH multiplexing
88
79
ghe-ssh --clean " $GHE_HOSTNAME "
89
80
}
@@ -131,22 +122,14 @@ export GHE_BACKUP_STRATEGY=${GHE_BACKUP_STRATEGY:-$(ghe-backup-strategy)}
131
122
# Record the strategy with the snapshot so we will know how to restore.
132
123
echo " $GHE_BACKUP_STRATEGY " > strategy
133
124
134
- # If we're using the tarball backup strategy, put the appliance in maintenance
135
- # mode and wait for all writing processes to bleed out.
136
- if [ " $GHE_BACKUP_STRATEGY " = " tarball" ]; then
137
- ghe-maintenance-mode-enable " $GHE_HOSTNAME "
138
- GHE_MAINTENANCE_MODE_ENABLED=true
139
- fi
140
-
141
125
# Create benchmark file
142
126
bm_init > /dev/null
143
127
144
128
ghe-backup-store-version ||
145
129
echo " Warning: storing backup-utils version remotely failed."
146
130
147
131
echo " Backing up GitHub settings ..."
148
- ghe-backup-settings ||
149
- failures=" $failures settings"
132
+ ghe-backup-settings || failures=" $failures settings"
150
133
151
134
echo " Backing up SSH authorized keys ..."
152
135
bm_start " ghe-export-authorized-keys"
@@ -163,98 +146,38 @@ bm_end "ghe-export-ssh-host-keys"
163
146
echo " Backing up MySQL database ..."
164
147
bm_start " ghe-export-mysql"
165
148
echo ' set -o pipefail; ghe-export-mysql | gzip' |
166
- ghe-ssh " $GHE_HOSTNAME " -- /bin/bash > mysql.sql.gz ||
167
- failures=" $failures mysql"
149
+ ghe-ssh " $GHE_HOSTNAME " -- /bin/bash > mysql.sql.gz || failures=" $failures mysql"
168
150
bm_end " ghe-export-mysql"
169
151
170
152
echo " Backing up Redis database ..."
171
- if [ " $GHE_BACKUP_STRATEGY " = " cluster" ]; then
172
- ghe-backup-redis-cluster > redis.rdb ||
173
- failures=" $failures redis"
174
- else
175
- ghe-backup-redis > redis.rdb ||
176
- failures=" $failures redis"
177
- fi
153
+ ghe-backup-redis > redis.rdb || failures=" $failures redis"
178
154
179
- if [ $GHE_VERSION_MAJOR -ge 2 ]; then
180
- echo " Backing up audit log ..."
181
- ghe-backup-es-audit-log ||
182
- failures=" $failures audit-log"
155
+ echo " Backing up audit log ..."
156
+ ghe-backup-es-audit-log || failures=" $failures audit-log"
183
157
184
- echo " Backing up hookshot logs ..."
185
- ghe-backup-es-hookshot ||
186
- failures=" $failures hookshot"
187
- fi
158
+ echo " Backing up hookshot logs ..."
159
+ ghe-backup-es-hookshot || failures=" $failures hookshot"
188
160
189
161
echo " Backing up Git repositories ..."
190
- if [ " $GHE_BACKUP_STRATEGY " = " cluster" ]; then
191
- if ghe-ssh " $GHE_HOSTNAME " test -f /data/github/current/bin/dgit-cluster-backup-routes ; then
192
- echo " * Using calculated routes method..."
193
- ghe-backup-repositories-cluster-ng || failures=" $failures repositories"
194
- else
195
- echo " * Using legacy method. A faster backup method is available on enterprise 2.7 and up."
196
- ghe-backup-repositories-cluster || failures=" $failures repositories"
197
- fi
198
- else
199
- ghe-backup-repositories-${GHE_BACKUP_STRATEGY} ||
200
- failures=" $failures repositories"
201
- fi
162
+ ghe-backup-repositories || failures=" $failures repositories"
202
163
203
164
echo " Backing up GitHub Pages ..."
204
- ghe-backup-pages-${GHE_BACKUP_STRATEGY} ||
205
- failures=" $failures pages"
206
-
207
- if [ " $GHE_VERSION_MAJOR " -ge 2 ]; then
208
- if [ " $GHE_BACKUP_STRATEGY " = " cluster" ]; then
209
- echo " Backing up storage data ..."
210
- if ghe-ssh " $GHE_HOSTNAME " test -f /data/github/current/bin/storage-cluster-backup-routes; then
211
- ghe-backup-alambic-cluster-ng || failures=" $failures alambic"
212
- else
213
- ghe-backup-alambic-cluster || failures=" $failures alambic"
214
- fi
165
+ ghe-backup-pages || failures=" $failures pages"
215
166
216
- echo " Backing up custom Git hooks ..."
217
- ghe-backup-git-hooks-cluster ||
218
- failures=" $failures git-hooks"
219
- else
220
- echo " Backing up asset attachments ..."
221
- ghe-backup-userdata alambic_assets ||
222
- failures=" $failures alambic_assets"
223
-
224
- echo " Backing up storage data ..."
225
- ghe-backup-userdata storage ||
226
- failures=" $failures storage"
227
-
228
- echo " Backing up hook deliveries ..."
229
- ghe-backup-userdata hookshot ||
230
- failures=" $failures hookshot"
231
-
232
- echo " Backing up custom Git hooks ..."
233
- ghe-backup-userdata git-hooks/environments/tarballs ||
234
- failures=" $failures git-hooks-environments"
235
- ghe-backup-userdata git-hooks/repos ||
236
- failures=" $failures git-hooks-repos"
237
- fi
238
- fi
167
+ echo " Backing up storage data ..."
168
+ ghe-backup-storage || failures=" $failures storage"
239
169
240
- if [ " $GHE_BACKUP_STRATEGY " != " cluster" ]; then
241
- echo " Backing up Elasticsearch indices ..."
242
- ghe-backup-es-${GHE_BACKUP_STRATEGY} ||
243
- failures=" $failures elasticsearch"
244
- fi
170
+ echo " Backing up custom Git hooks ..."
171
+ ghe-backup-git-hooks || failures=" $failures git-hooks"
245
172
246
- # If we're using the tarball backup strategy, bring the appliance out of
247
- # maintenance mode now instead of waiting until after pruning stale snapshots.
248
- if $GHE_MAINTENANCE_MODE_ENABLED ; then
249
- ghe-maintenance-mode-disable " $GHE_HOSTNAME " ||
250
- echo " Warning: Disabling maintenance mode on $GHE_HOSTNAME failed."
251
- GHE_MAINTENANCE_MODE_ENABLED=false
173
+ if [ " $GHE_BACKUP_STRATEGY " = " rsync" ]; then
174
+ echo " Backing up Elasticsearch indices ..."
175
+ ghe-backup-es-rsync || failures=" $failures elasticsearch"
252
176
fi
253
177
254
178
# git fsck repositories after the backup
255
179
if [ " $GHE_BACKUP_FSCK " = " yes" ]; then
256
- ghe-backup-fsck $GHE_SNAPSHOT_DIR ||
257
- failures=" $failures fsck"
180
+ ghe-backup-fsck $GHE_SNAPSHOT_DIR || failures=" $failures fsck"
258
181
fi
259
182
260
183
# If everything was successful, mark the snapshot as complete, update the
0 commit comments