./install.sh
- A random password will get assigned for
postgres
user if you have not specified a password. The password may be obtained from Rancher console.
- Make sure docker is running from machine you are testing.
- Postgres is accessible over "internal" channel, i.e. over Wireguard. Make sure you have the Wireguard setup along with credentials to connect to internal load balancer.
- Connect to postgres:
docker run -it --rm postgres psql -h <hostname pointing to load balancer> -U postgres -p 5432
- Review
init_values.yaml
for which DBs you would like to initialize. - Run init postgres helm chart to create necessary DB, users, roles etc:
./init_db.sh
Be aware of version of helm chart corresponding to mosip version.
Note that PVC and PV are not deleted after helm delete. So if you would like to postgres again, make sure you delete PVC and PV.
To initialized a specific db disable init of all others in init_values.yaml
by settings true
-> false
. Get db-user password with get_pwd.sh
. Provide the password in init_values.yaml
and run init_db.sh
.
- Export all DB's to a single file via below command:
pg_dumpall -c --if-exists -h <HOSTNAME> -p <PORT-NUMBER> -U <USERNAME> -f <BACKUP_FILE_NAME>.dump
- Import DB's from backup file via below command:
psql -h <HOSTNAME> -p <PORT-NUMBER> -U <USERNAME> -f <BACKUP_FILE_NAME>.dump
- Base64 Encoding and YAML Creation Script:
This script prompts the user for a password, encodes it in Base64, and generates a YAML file with the encoded password as a secret.
- Python 3.x installed
- Run the script:
python3 generate-secret.py
- Enter the password when prompted.
- The script will create a
db-common-secrets.yaml
andpostgres-postgresql.yaml
file in the same directory, containing the encoded password as a secret. - Then after the yaml file is created run the command:
kubectl create ns postgres
kubectl apply -f db-common-secrets.yaml
kubectl apply -f postgres-postgresql.yaml
- After running the above command
db-common-secrets
andpostgres-postgresql
will be created assecrets
inpostgres
namespace.
- Used to upgrade the schemas and required data from one MOSIP version to another.
- The upgrade script facilitates the upgrade process from the previous version (n-1) to the current version (n). It follows the upgrade path if you are two versions away from the current version (n-2).
- In case of upgrade of multiple versions of same DB, do update all the details sequentially in
upgrade.csv
. - Install in required Kubernetes cluster using below mentioned steps:
- DB_SERVERIP : Ip to access the DB server to be upgraded.
- DB_PORT : port for connecting to DB server.
- SU_USER : Super User for DB server.
- SU_USER_PWD : Super User Password
- PRIMARY_LANGUAGE_CODE : Primary language for MOSIP.
- Updated
upgrade.csv
with sequential details of upgrade to be performed.
./postgres-upgrade.sh
helm delete postgres-upgrade -n postgres
- If you face login issues even when the password entered is correct, it could be due to previous PVC, and PV. Delete them, but exercise caution as this will delete all persistent data.
- If you face below error while importing db's.
Then replace
psql:all-db-backup.dump:139: ERROR: option "locale" not recognized LINE 1: ...late1 WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = '...
LOCALE
withLC_COLLATE
in<BACKUP_FILE_NAME>.dump
file via sed command.sed -i 's/LOCALE/LC_COLLATE/g' <BACKUP_FILE_NAME>.dump