Create backup from local that's importable through DevKinsta

When importing a site INTO devKinsta, it has an option to “import backup” which wants a zip file I believe.

however, there’s no option that I’m aware of to export a local site into a zip file.

On Kinsta, you can request staging and production to be compiled into a backup file which is emailed to you.

How are people doing this for local versions of code + db?

My situation is that I have an outdated version of my company’s site on my local devKinsta
I want to be able to make a backup of my local version, then copy the production version from Kinsta into devKinsta, but be able to refer back to my original local if needed.

I cannot have a local version of production pulled down without removing my current local - due to conflicts.

Any solutions to this problem?

Hi @rpearson, thanks for reaching out. You essentially just need to create a ZIP with your file directory and a DB export.

You can use this command to create an export of your database (on a standard WP setup):

docker exec -it devkinsta_fpm bash -c "cd /www/kinsta/public/SITENAME && wp db export --allow-root"

You can then create a ZIP with your SQL file adjacent to your files `~/Devkinsta/public/SITENAME from your filesystem using your ZIP tool of choice.
image

The process will be a bit different depending on OS but feel free to let us know if you have any questions.

1 Like

Thank you, looks like the db exported into a sql file properly w/ that command.

I then used Mac OS to select both .sql and the site folder and right clicked “compress” which zip’ed the site together.

Hopefully I don’t have to use it, but it’s nice knowing I should be able to import this zip into devKinsta and DevKinsta will know what to do with it (I’ve zipped just the public/sitename folder in the past, and when I tried to import via devKinsta it gave an error)

1 Like

Hi, I know this is an old post, but it worked for me once and now there’s a problem. Just today, I used the terminal command once and it made a backup with .sql extension. It put it in the same folder as the devkinsta site. I was able to make the zip file (didn’t test it with a new import yet). Anyway, the exact same terminal command never worked after the first time.

Hi @sk5594

Just to be sure, when running the command above, you’re updating the “SITENAME” to the actual sitename/path folder of the WordPress install, right?

For example, my Devkinsta site name is defaultwp-1 and the WordPress install is at /www/kinsta/public/defaultwp-1

So I ran this command a few times and seem it is working fine.

docker exec -it devkinsta_fpm bash -c "cd /www/kinsta/public/defaultwp-1 && wp db export --allow-root"

I can also run cd /www/kinsta/public/defaultwp-1 && wp db export --allow-root inside the devkinsta_fpm container and is giving the same output.

Hi Adrian,
I had already changed it to the right site name. I found out I have to start DevKinsta and Docker before running the command. That makes it output the .sql file. I can then restore using the instructions here:

I do really like DevKinsta enough to try out Kinsta when my site is ready, but I would really like to see a much easier local backup solution, maybe just a backup/restore function in DevKinsta that does all this stuff for me.

Thank you for a helpful and timely response. :slight_smile:

  • Shawn