How to restore DevKinsta backup?

I accidentally pulled a production site and wiped out a lot of work that I’d been doing on a new landing page. I see that DevKinsta always does a site backup before pulling from Kinsta. How might I find and restore the backup to hopefully recover my work?

Hello @38South Klint :wave: , and welcome to Kinsta Community!

While DevKinsta always does a site backup before pulling (syncing) from Kinsta (MyKinsta), that backup is just temporary - and it will not be kept permanently.
The .tar.gz backup file would be created and stored inside the docker’s container “devkinsta_fpm”, under the /www/kinsta/temp/backup sub-folder - then it would be deleted right away once the pulling process has been completed/done.

If you check the main.log file for that whole site pulling process, you may notice such the following in that log file, for example:

[2023-09-19 07:19:47.716] [info] [createSiteBackup] Creating site backup for yoursitenamehere
[2023-09-19 07:19:47.716] [info] [createSiteBackup] Writing to /www/kinsta/temp/backup/yoursitenamehere.tar.gz

and at the end of that site pulling process, we will see something like this in that main.log file:

[2023-09-19 07:20:05.837] [info] [containerExec] Command ‘rm -Rf /www/kinsta/temp/backup/yoursitenamehere.tar.gz’ on devkinsta_fpm finished with exit code 0
[2023-09-19 07:20:05.837] [info] [deleteSiteBackup] Deleted /www/kinsta/temp/backup/yoursitenamehere.tar.gz successfully!
[2023-09-19 07:20:05.837] [info] [ipc/sync/pull] PULL site finished

as we can see there, the .tar.gz backup file was removed/deleted right away upon the site pull has finished.

I’m afraid if you didn’t take any manual backup of your local site in question on your local computer before, then there’s no way to restore that local site from your local backup unfortunately.

In order to perform manual backup of your local site (that may help you in the future), you can do the following.

First export your local WordPress site’s database (on a standard WP setup).

Depends on the operating system you’re using on your computer.
If you’re using Linux or Mac, you can run the command below via a terminal program:

docker exec -u www-data -it devkinsta_fpm bash -c "cd /www/kinsta/public/yoursitename && wp db export yoursitename.sql; chmod 0777 yoursitename.sql"

If you’re on Windows, you can go to the Docker Desktop → Containers → click the devkinsta_fpm container name → then click the Terminal tab, and run the command below:

cd /www/kinsta/public/yoursitename && wp db export yoursitename.sql --allow-root; chmod 0777 yoursitename.sql; chown www-data:www-data yoursitename.sql

Please be sure to replace the word yoursitename above with your actual local site name in question.

Second, once that .sql database has been created, you can then create a ZIP of your local site’s files (along with that .sql file) that are located under this sub-folder: `~/Devkinsta/public/yoursitename , from your filesystem using your ZIP tool of choice.
Then you may want to save that .zip file elsewhere as your backup file (which contains that specific site’s files/folders and its .sql database file as well) for further usage in case you require to restore from that backup.

In order to restore that .zip backup file, you can read and follow this article (skip the first step and start from the “Creating a Site in DevKinsta” section).


Thanks for the detailed response @Agus .

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.