# Postgres data migration not working

**URL:** <https://forum.ansible.com/t/postgres-data-migration-not-working/37323>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [November 9, 2022, 1:31am UTC](https://forum.ansible.com/t/postgres-data-migration-not-working/37323 "2022-11-09T01:31:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaushik\_R](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Kaushik\_R](https://forum.ansible.com/u/Kaushik_R)\
**Post date:** [November 9, 2022, 1:31am UTC](https://forum.ansible.com/t/postgres-data-migration-not-working/37323/1 "2022-11-09T01:31:43Z")

</div>

I have tried migrating the data from existing externally managed postgres instance to the new postgres instance for the AWX upgraded version.

However, after migrating the data when I tried provisioning AWX instance, the pod is successfully provisioned but unable to authenticate to postgres instance.

Below is the error seen -

bash-4.2$ **kubectl exec awx-67cb856d46-42qnq -c awx-task -n ansible-awx awx-manage check\_db**  
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] – [COMMAND] instead.  
2022-11-03 19:36:56,936 ERROR [-] awx.main.utils.encryption Failed to decrypt `Setting(pk=20).value`; if you’ve recently restored from a database backup or are running in a clustered environment, check that your `SECRET_KEY` value is correct  
Traceback (most recent call last):  
File “/var/lib/awx/venv/awx/lib64/python3.9/site-packages/cryptography/fernet.py”, line 120, in \_verify\_signature  
h.verify(data[-32:])  
File “/var/lib/awx/venv/awx/lib64/python3.9/site-packages/cryptography/hazmat/primitives/hmac.py”, line 69, in verify  
ctx.verify(signature)  
File “/var/lib/awx/venv/awx/lib64/python3.9/site-packages/cryptography/hazmat/backends/openssl/hmac.py”, line 76, in verify  
raise InvalidSignature(“Signature did not match digest.”)  
cryptography.exceptions.InvalidSignature: Signature did not match digest.

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [November 9, 2022, 7:45pm UTC](https://forum.ansible.com/t/postgres-data-migration-not-working/37323/2 "2022-11-09T19:45:12Z")

</div>

Hello,

It looks like the DB secret may not have been transferred after the migration. We would recommend referring to this documentation for further assistance:

[https://github.com/ansible/awx-operator/blob/devel/docs/migration.md](https://github.com/ansible/awx-operator/blob/devel/docs/migration.md)

If you’re unable to use the AWX backup object for whatever reason, be sure to copy over the secret key secret and the Postgres secret to your namespace.

-AWX Team

---

<div class="post-metadata">

**Author:** ![Kaushik\_R](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@Kaushik\_R](https://forum.ansible.com/u/Kaushik_R)\
**Post date:** [November 15, 2022, 7:39pm UTC](https://forum.ansible.com/t/postgres-data-migration-not-working/37323/3 "2022-11-15T19:39:50Z")

</div>

Hi Team,

My previous AWX instance is running on an older version (not using awx-operator).

Are you suggesting to copy over these secrets corresponding to this previous instance to the instance with the newer version?

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [November 18, 2022, 6:40pm UTC](https://forum.ansible.com/t/postgres-data-migration-not-working/37323/4 "2022-11-18T18:40:12Z")

</div>

Hello,  
The database contains secrets and there is a secret key file on the AWX webserver. That key allows AWX to decrypt the secrets in the database. If you want to use a backup of the database you will need the secret key file to access the secrets in the database.

-AWX Team
