@@ -477,12 +477,13 @@ From version **1.4.0 and higher**, we have deprecated support for the `Codefresh
477477
478478Obtain the PostgresSQL administrator password :
479479` ` ` shell
480- export PGPASSWORD=$(kubectl get secret --namespace codefresh cf-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode)
480+ NAMESPACE=codefresh
481+ export PGPASSWORD=$(kubectl get secret --namespace $NAMESPACE cf-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode)
481482` ` `
482483
483484Forward the PostgreSQL service port and place the process in the background :
484485` ` ` shell
485- kubectl port-forward --namespacecodefresh svc/cf-postgresql 5432:5432 &
486+ kubectl port-forward --namespace$NAMESPACE svc/cf-postgresql 5432:5432 &
486487` ` `
487488
488489Create a directory for the backup files and make it the current working directory :
@@ -503,18 +504,18 @@ Here, the *--net* parameter lets the Docker container use the host's network sta
503504
504505Create an environment variable with the password for the new stateful set :
505506` ` ` shell
506- export PGPASSWORD=$(kubectl get secret --namespacecodefresh cf-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode)
507+ export PGPASSWORD=$(kubectl get secret --namespace$NAMESPACE cf-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode)
507508` ` `
508509
509510Forward the PostgreSQL service port for the new stateful set and place the process in the background :
510511` ` ` shell
511- kubectl port-forward --namespacecodefresh svc/cf-postgresql 5432:5432
512+ kubectl port-forward --namespace$NAMESPACE svc/cf-postgresql 5432:5432
512513` ` `
513514
514515Restore the contents of the backup into the new release using the *pg_restore* tool. If this tool is not available on your system, mount the directory containing the backup files as a volume in Bitnami's PostgreSQL Docker container and use the *pg_restore* client tool in the container image to import the backup into the new cluster, as shown below :
515516` ` ` shell
516517cd psqlbackup
517- docker run --rm --name postgresql-backup -e PGPASSWORD=$PGPASSWORD -v $(pwd):/app --net="host" bitnami/postgresql:13 pg_restore -- Fc --create --dbname postgres -h host.docker.internal -p 5432 /app/audit.dump
518+ docker run --rm --name postgresql-backup -e PGPASSWORD=$PGPASSWORD -v $(pwd):/app --net="host" bitnami/postgresql:13 pg_restore -Fc --create --dbname postgres -h host.docker.internal -p 5432 /app/audit.dump
518519` ` `
519520
520521# #### Backup and restore via Helm hooks
@@ -553,12 +554,13 @@ From version **1.4.0 and higher**, we have deprecated support for the `Codefresh
553554
554555Obtain the MongoDB administrator password :
555556` ` ` shell
556- export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace codefresh cf-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
557+ NAMESPACE=codefresh
558+ export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace $NAMESPACE cf-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
557559` ` `
558560
559561Forward the MongoDB service port and place the process in the background :
560562` ` ` shell
561- kubectl port-forward --namespacecodefresh svc/mongodb 27017:27017 &
563+ kubectl port-forward --namespace$NAMESPACE svc/mongodb 27017:27017 &
562564` ` `
563565
564566Create a directory for the backup files and make it the current working directory :
@@ -579,14 +581,14 @@ Here, the *--net* parameter lets the Docker container use the host's network sta
579581
580582Create an environment variable with the password for the new stateful set :
581583` ` ` shell
582- export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespacecodefresh cf-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
584+ export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace$NAMESPACE cf-mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
583585` ` `
584586
585587Forward the MongoDB service port for the new stateful set and place the process in the background :
586588
587589(**Note!** Default service address was changed)
588590` ` ` shell
589- kubectl port-forward --namespacecodefresh svc/cf- mongodb 27017:27017 &
591+ kubectl port-forward --namespace$NAMESPACE svc/mongodb 27017:27017 &
590592` ` `
591593
592594Restore the contents of the backup into the new release using the *mongorestore* tool. If this tool is not available on your system, mount the directory containing the backup files as a volume in Bitnami's MongoDB Docker container and use the *mongorestore* client tool in the container image to import the backup into the new cluster, as shown below :
@@ -599,7 +601,7 @@ Stop the service port forwarding by terminating the background process.
599601
600602Connect to the new stateful set and confirm that your data has been successfully restored :
601603` ` ` shell
602- kubectl run --namespacecodefresh mongodb-new-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mongodb:4.2 --command -- mongo codefresh --host cf-mongodb --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --eval "db.accounts.find()"
604+ kubectl run --namespace$NAMESPACE mongodb-new-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mongodb:4.2 --command -- mongo codefresh --host cf-mongodb --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --eval "db.accounts.find()"
603605` ` `
604606
605607# #### Backup and restore via Helm hooks