Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit 87199a6

Browse files
authored
Backup reports AND version bump (#190)
* bump version and fix restore bug * new index.yaml * handle consistency report in backups * bump version to 4.2.7 * Azure backup is now 6 files (+2 reports, one for neo4j db and one for system db) * put backup output into the report directory so that there is _something_ in there * upload backup log even if job fails
1 parent 35f290f commit 87199a6

File tree

9 files changed

+52
-14
lines changed

9 files changed

+52
-14
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ jobs:
267267
az storage blob list -c $AZURE_CONTAINER_NAME --account-name helmbackups --prefix build-$CIRCLE_BUILD_NUM/ | tee -a files.txt
268268
cat files.txt >> $LOGFILE
269269
total_files=$(cat files.txt | grep name | wc -l)
270-
if [ $total_files = 4 ] ; then
270+
if [ $total_files = 6 ] ; then
271271
echo "Test pass" ;
272272
else
273273
echo "$total_files total files on Azure storage; failed"
@@ -287,7 +287,7 @@ jobs:
287287
288288
echo "MATCH (n) RETURN count(n) as n;" | kubectl run -i --rm cypher-shell \
289289
--namespace $NAMESPACE \
290-
--image=neo4j:4.2.6-enterprise --restart=Never \
290+
--image=neo4j:4.2.7-enterprise --restart=Never \
291291
--command -- ./bin/cypher-shell -u neo4j -p "$NEO4J_PASSWORD" \
292292
-a neo4j://$NAME_RESTORE-neo4j.$NAMESPACE.svc.cluster.local 2>&1 | tee restore-result.log
293293
cp restore-result.log $BUILD_ARTIFACTS/

Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v1
22
name: neo4j
33
home: https://www.neo4j.com
4-
version: 4.2.6-1
5-
appVersion: 4.2.6
4+
version: 4.2.7-1
5+
appVersion: 4.2.7
66
description: Neo4j is the world's leading graph database
77
keywords:
88
- graph

deployment-scenarios/cluster-restore.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ core:
77
restore:
88
enabled: true
99
image: gcr.io/neo4j-helm/restore
10-
imageTag: 4.2.6-1
10+
imageTag: 4.2.7-1
1111
secretName: neo4j-gcp-credentials #neo4j-aws-credentials
1212
database: neo4j,system
1313
cloudProvider: gcp #aws
@@ -20,7 +20,7 @@ readReplica:
2020
restore:
2121
enabled: true
2222
image: gcr.io/neo4j-helm/restore
23-
imageTag: 4.2.6-1
23+
imageTag: 4.2.7-1
2424
secretName: neo4j-gcp-credentials #neo4j-aws-credentials
2525
database: neo4j,system
2626
cloudProvider: gcp #aws

tools/backup/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v1
22
name: neo4j-backup
33
home: https://www.neo4j.com
4-
version: 4.2.6-1
5-
appVersion: 4.2.6
4+
version: 4.2.7-1
5+
appVersion: 4.2.7
66
description: Neo4j Backup Utility
77
keywords:
88
- graph

tools/backup/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN echo "deb http://httpredir.debian.org/debian stretch-backports main" | tee -
1111
RUN echo "neo4j-enterprise neo4j/question select I ACCEPT" | debconf-set-selections
1212
RUN echo "neo4j-enterprise neo4j/license note" | debconf-set-selections
1313

14-
RUN apt-get update && apt-get install -y neo4j-enterprise=1:4.2.6
14+
RUN apt-get update && apt-get install -y neo4j-enterprise=1:4.2.7
1515
RUN apt-get install -y google-cloud-sdk unzip less
1616
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
1717
RUN unzip awscliv2.zip

tools/backup/backup.sh

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,38 @@ function cloud_copy() {
120120
esac
121121
}
122122

123+
function upload_report() {
124+
echo "Archiving and Compressing -> ${REPORT_DIR}/$BACKUP_SET.tar"
125+
126+
tar -zcvf "backups/$BACKUP_SET.report.tar.gz" "${REPORT_DIR}" --remove-files
127+
128+
if [ $? -ne 0 ]; then
129+
echo "REPORT ARCHIVING OF ${REPORT_DIR} FAILED"
130+
exit 1
131+
fi
132+
133+
echo "Zipped report size:"
134+
du -hs "/backups/$BACKUP_SET.report.tar.gz"
135+
136+
cloud_copy "/backups/$BACKUP_SET.report.tar.gz" $db
137+
138+
if [ $? -ne 0 ]; then
139+
echo "Storage copy of report for ${REPORT_DIR} FAILED"
140+
exit 1
141+
else
142+
echo "Removing /backups/$BACKUP_SET.report.tar.gz"
143+
rm "/backups/$BACKUP_SET.report.tar.gz"
144+
fi
145+
}
146+
123147
function backup_database() {
124148
db=$1
125149

150+
export REPORT_DIR="/backups/.report_$db"
151+
mkdir -p "${REPORT_DIR}"
152+
echo "Removing any existing files from ${REPORT_DIR}"
153+
rm -rfv "${REPORT_DIR}"/*
154+
126155
export BACKUP_SET="$db-$(date "+%Y-%m-%d-%H:%M:%S")"
127156
export LATEST_POINTER="$db-latest.tar.gz"
128157

@@ -142,11 +171,13 @@ function backup_database() {
142171
--pagecache=$PAGE_CACHE \
143172
--fallback-to-full=$FALLBACK_TO_FULL \
144173
--check-consistency=$CHECK_CONSISTENCY \
174+
--report-dir="${REPORT_DIR}" \
145175
--check-graph=$CHECK_GRAPH \
146176
--check-indexes=$CHECK_INDEXES \
147177
--check-label-scan-store=$CHECK_LABEL_SCAN_STORE \
148178
--check-property-owners=$CHECK_PROPERTY_OWNERS \
149-
--verbose
179+
--verbose \
180+
| tee "${REPORT_DIR}/backup.log"
150181

151182
# Docs: see exit codes here: https://neo4j.com/docs/operations-manual/current/backup/performing/#backup-performing-command
152183
backup_result=$?
@@ -157,7 +188,12 @@ function backup_database() {
157188
3) echo "Backup succeeded but consistency check found inconsistencies - $db" ;;
158189
esac
159190

191+
echo "Backup report(s):"
192+
du -hs "${REPORT_DIR}"
193+
ls -l "${REPORT_DIR}"
194+
160195
if [ $backup_result -eq 1 ]; then
196+
upload_report
161197
echo "Aborting other actions; backup failed"
162198
exit 1
163199
fi
@@ -189,6 +225,8 @@ function backup_database() {
189225
echo "Removing /backups/$BACKUP_SET.tar.gz"
190226
rm "/backups/$BACKUP_SET.tar.gz"
191227
fi
228+
229+
upload_report
192230
}
193231

194232
function activate_gcp() {

tools/backup/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
image: gcr.io/neo4j-helm/backup
2-
imageTag: 4.2.6-1
2+
imageTag: 4.2.7-1
33
podLabels: {}
44
podAnnotations: {}
55
neo4jaddr: holder-neo4j.default.svc.cluster.local:6362

tools/restore/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM neo4j:4.2.6-enterprise
1+
FROM neo4j:4.2.7-enterprise
22
RUN apt-get update \
33
&& apt-get install -y curl wget gnupg apt-transport-https apt-utils lsb-release unzip less \
44
&& rm -rf /var/lib/apt/lists/*

values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: "neo4j"
77

88
# Specs for the Neo4j docker image
99
image: "neo4j"
10-
imageTag: "4.2.6-enterprise"
10+
imageTag: "4.2.7-enterprise"
1111
imagePullPolicy: "IfNotPresent"
1212
# imagePullSecret: registry-secret
1313
acceptLicenseAgreement: "no"
@@ -159,7 +159,7 @@ core:
159159
restore:
160160
enabled: false
161161
image: gcr.io/neo4j-helm/restore
162-
imageTag: 4.2.6-1
162+
imageTag: 4.2.7-1
163163
secretName: neo4j-gcp-credentials
164164
database: neo4j,system
165165
cloudProvider: gcp

0 commit comments

Comments
 (0)