Recovering lost data

hiii,

Is there any way to take snapshot of awx at regular interval so that we could recover the data if something goes wrong in future !!

Backup the DB which is postgre contents on regular intervals

I guess this is hack kind of thing and not the proper solution. Although it worked.
But is there a more organised way somewhat like taking screenshot of all 5 docker container, so that if anything goes wrong in future other than data too , I could have my awx up and running again.

If you wish to scale the AWX in HA mode , then you can refer this link https://github.com/ansible/awx/issues/3627 , so even if one is down , you can scale to next.

Also note that, these containers can be killed at anytime , we need to only look for the DB contents when it comes to backup without worrying about the container state.

Regards,
Sujith

Making a backup of the database is not a “hack kind of thing”. You should already be setting up streaming replication on postgres as part of your normal operation. You can take snapshots of this replica and can even promote it to primary if it goes down. The docker containers for AWX are mostly transient and all state is store in the database. Therefore, that’s what you need to focus your backup and recovery strategy on.

pardon me for asking such immature doubts but I am new to all this. All kind of help is heartly welcomed.

So by backing up postgre you mean copying the folder pgdata which is located inside pgdocker in some backup. Let me know if this is what you meant.

Regards,
Pranjal

You have a lot of reading to do in order to set this up as a production system, start here:

https://www.postgresql.org/docs/9.6/backup.html

also see:

https://wiki.postgresql.org/wiki/Streaming_Replication

if you're using a kubernetes/openshift install there are tasks for backup/restore
https://github.com/ansible/awx/blob/devel/installer/roles/kubernetes/tasks/backup.yml
https://github.com/ansible/awx/blob/devel/installer/roles/kubernetes/tasks/restore.yml
but sadly you'll need to make your own container see https://github.com/ansible/awx/pull/2831

Thanks man… This will help me a lot.
You all are doing a great work !!

I went through the documents you mentioned.
I only have very little knowledge about docker so pardon me if I say anything silly.

  1. [Talking about first technique — pg_dumpall ]
    As per what I understand, postgre docker is running in detached mode and has mounted the memory var/lib/postgre/data to the path tmp/awx/pgdocker/pgdata . let me know if it is not the case.
    So to execute anything like pg_dumpall what I did is, I entered the container and created a recovery file using pg_dumpall and moved that file to the location which is common to main os and docker.
    By by this if anything goes wrong, I could use this file back. I tried this and it worked(obviously). Now what I think is , I am doing something wrong here. Please let me know how should I have done it.

  2. [ talking about second technique – file system level backup ]
    what I learned is that for that you need to shut the server down first but the problem is as soon as I shut the server (by going in container and executing pg_ctl stop), it shuts and starts immediately. Let me know what I should have done instead.

Let me know which technique I should be using

Also one more thing

  1. can we use sql instead of postgre.

Guys waiting for your reply. Please help me out

postgresql is sql