Import AWX database to AWX-Operator

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 :slight_smile:

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?

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

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 ?

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?

Hi Gordon,

Have you found the solution to this one :slight_smile:

I recommend you Use awx-cli

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

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.