If you use Automation Document Processing, back up the secrets and your MongoDB
collections.
About this task
To run backup operations on MongoDB, install MongoDB Database Tools.
The following collections can be restored from the database by using the
gitMongoUri parameter.
Branch
fs.chunks
fs.files
git-fs.chunks
git-fs.files
GitProvider
git-service.ChangeLog
ImportReport
Packs
Repo
Resource
Revision
SecretRef
StagingResource
Tag
UserStaging
All collections of the MongoDB runtime database must be backed up and restored.
Procedure
-
Make a copy of the secrets. To retrieve the secrets, run the following commands:
kubectl --namespace $ADP_RELEASE_NAMESPACE get secret ibm-adp-secret -o yaml
- Get the value of the secrets and the name of the MongoDB data.
GIT_MONGO_URI=$(kubectl get secret --namespace $ADP_RELEASE_NAMESPACE ibm-adp-secret -o jsonpath="{.data.gitMongoUri}" | base64 --decode)
- If you use the embedded MongoDB instance instead of an external instance (which is
recommended in production), you must forward the MongoDB data port and adapt the
GIT_MONGO_URI and parts of the previous step.
# Get ADP mongo service name
export ADP_MONGO_SERVICE=$(kubectl get services --namespace $ADP_RELEASE_NAMESPACE -l 'app.kubernetes.io/name=adp-mongo' --output=jsonpath='{.items[0].metadata.name}')
GIT_MONGO_URI="${GIT_MONGO_URI/@$ADP_MONGO_SERVICE*:/@localhost:}"
kubectl port-forward --namespace $ADP_RELEASE_NAMESPACE svc/$ADP_MONGO_SERVICE 27017:27017 &
- Create directories for the files that you want to back up.
- Back up the collections to these directories by using the mongodump
tool.
for col_name in Branch fs.chunks fs.files git-fs.chunks git-fs.files GitProvider git-service.ChangeLog \
ImportReport Packs Repo Resource Revision SecretRef StagingResource Tag UserStaging ; do
mongodump --uri "$GIT_MONGO_URI" --tlsInsecure --out=adpbackup --collection="$col_name" done