Skip to content

Commit da295de

Browse files
committed
Merge pull request #136 from github/revert-134-no-hookshot-backup-restore
Revert "Remove hookshot backup/restore"
2 parents 2fe9d51 + b6a3ce3 commit da295de

7 files changed

Lines changed: 45 additions & 5 deletions

File tree

bin/ghe-backup

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
123123
echo "Backing up asset attachments ..."
124124
ghe-backup-userdata alambic_assets ||
125125
failures="$failures alambic_assets"
126+
127+
echo "Backing up hook deliveries ..."
128+
ghe-backup-userdata hookshot ||
129+
failures="$failures hookshot"
126130
fi
127131

128132
echo "Backing up Elasticsearch indices ..."

bin/ghe-restore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ ghe-restore-pages-${GHE_BACKUP_STRATEGY} "$GHE_HOSTNAME" 1>&3
194194
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
195195
echo "Restoring asset attachments ..."
196196
ghe-restore-userdata alambic_assets "$GHE_HOSTNAME" 1>&3
197+
198+
echo "Restoring hook deliveries ..."
199+
ghe-restore-userdata hookshot "$GHE_HOSTNAME" 1>&3
197200
fi
198201

199202
echo "Restoring MySQL database ..."

share/github-backup-utils/ghe-backup-repositories-rsync

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ rsync_repository_data -H <<RULES
247247
RULES
248248

249249
# Sync __special__ data directories, including the __alambic_assets__,
250-
# and __purgatory__ directories. The __nodeload_archives__,
250+
# __hookshot__, and __purgatory__ directories. The __nodeload_archives__,
251251
# __gitmon__, and __render__ directories are excludes since they act only as
252-
# caches. The __hookshot__ directory is also excluded since it only contains log files.
252+
# caches.
253253
#
254254
# Under v2.x and greater, only the special __purgatory__ directory remains under
255255
# /data/repositories. All other special user data directories have been moved under
@@ -260,7 +260,6 @@ rsync_repository_data <<RULES
260260
- /__nodeload_archives__/
261261
- /__gitmon__/
262262
- /__render__/
263-
- /__hookshot__/
264263
+ /__*__/
265264
+ /__*__/**
266265
+ /info/

share/github-backup-utils/ghe-backup-userdata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#/ Usage: ghe-backup-userdata <dirname>
33
#/ Take an online, incremental snapshot of a user data directory. This is used
44
#/ for a number of different simple datastores kept under /data/user on the
5-
#/ remote appliance, including alambic_assets and pages data.
5+
#/ remote appliance, including: hookshot, alambic_assets, and pages data.
66
set -e
77

88
# Bring in the backup configuration

share/github-backup-utils/ghe-restore-userdata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#/ Usage: ghe-restore-userdata <dirname> <host>
33
#/ Restore a special user data directory via rsync. This is used
44
#/ for a number of different simple datastores kept under /data/user on the
5-
#/ remote appliance, including alambic_assets and pages data.
5+
#/ remote appliance, including: hookshot, alambic_assets, and pages data.
66
set -e
77

88
# Bring in the backup configuration

test/test-ghe-backup.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ touch alice/index.html bob/index.html
1717
mkdir -p "$GHE_REMOTE_DATA_USER_DIR/common"
1818
echo "fake password hash data" > "$GHE_REMOTE_DATA_USER_DIR/common/manage-password"
1919

20+
# Create some fake hookshot data in the remote data directory
21+
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
22+
mkdir -p "$GHE_REMOTE_DATA_USER_DIR/hookshot"
23+
cd "$GHE_REMOTE_DATA_USER_DIR/hookshot"
24+
mkdir -p repository-123 repository-456
25+
touch repository-123/test.bpack repository-456/test.bpack
26+
fi
27+
2028
# Create some fake alambic data in the remote data directory
2129
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
2230
mkdir -p "$GHE_REMOTE_DATA_USER_DIR/alambic_assets/github-enterprise-assets/0000"
@@ -109,6 +117,9 @@ begin_test "ghe-backup first snapshot"
109117
fi
110118

111119
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
120+
# verify all hookshot user data was transferred
121+
diff -ru "$GHE_REMOTE_DATA_USER_DIR/hookshot" "$GHE_DATA_DIR/current/hookshot"
122+
112123
# verify all alambic assets user data was transferred
113124
diff -ru "$GHE_REMOTE_DATA_USER_DIR/alambic_assets" "$GHE_DATA_DIR/current/alambic_assets"
114125
fi
@@ -178,6 +189,9 @@ begin_test "ghe-backup subsequent snapshot"
178189
fi
179190

180191
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
192+
# verify all hookshot user data was transferred
193+
diff -ru "$GHE_REMOTE_DATA_USER_DIR/hookshot" "$GHE_DATA_DIR/current/hookshot"
194+
181195
# verify all alambic assets user data was transferred
182196
diff -ru "$GHE_REMOTE_DATA_USER_DIR/alambic_assets" "$GHE_DATA_DIR/current/alambic_assets"
183197
fi

test/test-ghe-restore.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ mkdir -p gh-enterprise-es/node/0
1818
touch gh-enterprise-es/node/0/stuff1
1919
touch gh-enterprise-es/node/0/stuff2
2020

21+
# Create some fake hookshot data in the remote data directory
22+
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
23+
mkdir -p "$GHE_DATA_DIR/1/hookshot"
24+
cd "$GHE_DATA_DIR/1/hookshot"
25+
mkdir -p repository-123 repository-456
26+
touch repository-123/test.bpack repository-456/test.bpack
27+
fi
28+
2129
# Create some fake alambic data in the remote data directory
2230
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
2331
mkdir -p "$GHE_DATA_DIR/1/alambic_assets/github-enterprise-assets/0000"
@@ -107,6 +115,9 @@ begin_test "ghe-restore into configured vm"
107115
diff -ru "$GHE_DATA_DIR/current/pages" "$GHE_REMOTE_DATA_USER_DIR/pages"
108116

109117
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
118+
# verify all hookshot user data was transferred
119+
diff -ru "$GHE_DATA_DIR/current/hookshot" "$GHE_REMOTE_DATA_USER_DIR/hookshot"
120+
110121
# verify all alambic assets user data was transferred
111122
diff -ru "$GHE_DATA_DIR/current/alambic_assets" "$GHE_REMOTE_DATA_USER_DIR/alambic_assets"
112123
fi
@@ -213,6 +224,9 @@ begin_test "ghe-restore -c into unconfigured vm"
213224
diff -ru "$GHE_DATA_DIR/current/pages" "$GHE_REMOTE_DATA_USER_DIR/pages"
214225

215226
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
227+
# verify all hookshot user data was transferred
228+
diff -ru "$GHE_DATA_DIR/current/hookshot" "$GHE_REMOTE_DATA_USER_DIR/hookshot"
229+
216230
# verify all alambic assets user data was transferred
217231
diff -ru "$GHE_DATA_DIR/current/alambic_assets" "$GHE_REMOTE_DATA_USER_DIR/alambic_assets"
218232
fi
@@ -266,6 +280,9 @@ begin_test "ghe-restore into unconfigured vm"
266280
# verify all pages data was transferred to the restore location
267281
diff -ru "$GHE_DATA_DIR/current/pages" "$GHE_REMOTE_DATA_USER_DIR/pages"
268282

283+
# verify all hookshot user data was transferred
284+
diff -ru "$GHE_DATA_DIR/current/hookshot" "$GHE_REMOTE_DATA_USER_DIR/hookshot"
285+
269286
# verify all alambic assets user data was transferred
270287
diff -ru "$GHE_DATA_DIR/current/alambic_assets" "$GHE_REMOTE_DATA_USER_DIR/alambic_assets"
271288

@@ -309,6 +326,9 @@ begin_test "ghe-restore with host arg"
309326
diff -ru "$GHE_DATA_DIR/current/pages" "$GHE_REMOTE_DATA_USER_DIR/pages"
310327

311328
if [ "$GHE_VERSION_MAJOR" -ge 2 ]; then
329+
# verify all hookshot user data was transferred
330+
diff -ru "$GHE_DATA_DIR/current/hookshot" "$GHE_REMOTE_DATA_USER_DIR/hookshot"
331+
312332
# verify all alambic assets user data was transferred
313333
diff -ru "$GHE_DATA_DIR/current/alambic_assets" "$GHE_REMOTE_DATA_USER_DIR/alambic_assets"
314334
fi

0 commit comments

Comments
 (0)