# Import AWX database to AWX-Operator

**URL:** <https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [June 25, 2021, 11:54am UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411 "2021-06-25T11:54:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.ansible.com/u/Gordon)\
**Post date:** [June 25, 2021, 11:54am UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/1 "2021-06-25T11:54:00Z")

</div>

Hi there!

I’ve got a problem to import my already used AWX databse in the newly created AWX-Operator. Maybe you can help me 🙂

The problem is after i import the DB the server won’t come up. It just say: “Internal Server Error”.

To reproduce the error i show you my way to import the DB:

1. Export Docker DB like: **pg\_dump --username awx awx --format=c" \> ./psql\_dump.sql**
2. Drop AWX-Operator DB: **minikube kubectl – exec -it awx-postgres-0 – dropdb -U awx awx**
3. Create new DB: **minikube kubectl – exec -it awx-postgres-0 – createdb -U awx awx**
4. Restore DB: **minikube kubectl – exec -it awx-postgres-0 – pg\_restore -U awx -d awx \< psql\_dump.sql**

Every single command works without any errors.  
The DB is active and looks the same like in old AWX installation.  
Do you have a better functionally way to import the DB or any tips how i can solve the problem?

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.ansible.com/u/Gordon)\
**Post date:** [June 25, 2021, 12:04pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/2 "2021-06-25T12:04:17Z")

</div>

logs show: **minikube kubectl – logs awx-postgres-0 --tail 200**

PostgreSQL Database directory appears to contain a database; Skipping initialization

2021-06-25 11:56:21.476 UTC [1] LOG: starting PostgreSQL 12.7 (Debian 12.7-1.pgdg100+1) on x86\_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit  
2021-06-25 11:56:21.484 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432  
2021-06-25 11:56:21.484 UTC [1] LOG: listening on IPv6 address “::”, port 5432  
2021-06-25 11:56:21.490 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”  
2021-06-25 11:56:21.549 UTC [26] LOG: database system was shut down at 2021-06-25 11:54:56 UTC  
2021-06-25 11:56:21.605 UTC [1] LOG: database system is ready to accept connections

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.ansible.com/u/Gordon)\
**Post date:** [June 25, 2021, 12:22pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/3 "2021-06-25T12:22:41Z")

</div>

Okay, now i think a find the issue.  
The logs says:

**awx.main.utils.encryption Failed to decrypt `Setting(pk=21).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**

Do you know how to change the **SECRET\_KEY**?

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.ansible.com/u/Gordon)\
**Post date:** [June 25, 2021, 12:56pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/4 "2021-06-25T12:56:27Z")

</div>

Okay, i changed the key in a yaml file and apply that file.  
Now i didn’t see anything. AWX website is totally blank.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![Sam2](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sam2](https://forum.ansible.com/u/Sam2)\
**Post date:** [August 6, 2021, 10:37pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/5 "2021-08-06T22:37:28Z")

</div>

Hi Gordon,

Have you found the solution to this one 🙂

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [August 6, 2021, 10:38pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/6 "2021-08-06T22:38:53Z")

</div>

I recommend you Use awx-cli

---

<div class="post-metadata">

**Author:** ![Sam2](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sam2](https://forum.ansible.com/u/Sam2)\
**Post date:** [August 6, 2021, 10:44pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/7 "2021-08-06T22:44:40Z")

</div>

Hi Weiye,

Thanks for the hint, in my case AWX has many integration with other systems, if I do AWX export & import, will the job template be created with same way, otherwise all API calls coming from other systems to trigger AWX will fail.

Another point, wil awx export do it for credentials as well ?

Thanks  
Samer

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [August 6, 2021, 10:49pm UTC](https://forum.ansible.com/t/import-awx-database-to-awx-operator/35411/8 "2021-08-06T22:49:25Z")

</div>

Credentials won’t. I Use tower-configuration collection to treat my entire tower configuration as code.

Do you hit the api? There fore you are tied to the URL? Ouch. I use awx-cli to run jobs too. It’s all based on job template not api URL as well.
