Hello I’m new to Kinsta ( but veteran developer)
My team is working on a client’s site,
Were running into issues keeping our data bases synced, and I’m wondering what the recommended protocol is for this, and if anyone in the community has worked out a clever solution
We are each have out own local version using DevKinsta, and pushing up to a Staging instance.
But if i make changes to the footer and push, then my co-worked makes changes to the header and pushes the header changes overwrite the footer changes.
We can export our own DBs and share them, but then we’re getting some duplications. In the menus etc. Moreover when we’re making multiple changes a day, exporting is time-consuming, and they diverge quickly.
What is the recommended workflow?
Moreover…Questions numbered to make threaded replies easier:
Is there a way to share one remote DB?
Is there a way to make sure imports merge w/o duplicating?
Is there a way to slave local DBs to the staging?
is there a way to push local changes to stage w/o updating the DB (theme files only)
You can SSH into your Docker database image with docker exec -it devkinsta_db bash; you’ll likely need to apt update and then apt install <someeditor>; just keep in mind that your changes to the container’s settings would get overwritten every time the container is restarted.
Keep in mind that you can only remotely connect to the staging environment if the connecting machine’s SSH key has been added in MyKinsta.
For example, you can test an ssh connection from a local server into your staging environment with this command: ssh -i /www/path/to/sshkey/id_rsa stagingusername@1.23.1.23 -p <stagingportnumber>
Unfortunately DevKinsta wasn’t really made with this sort of workflow in mind so you might end up having to develop a custom solution, but hopefully this all sets you on the right track! Please let us know if you have any more questions!
Thank you. We are already using git to version our work on the them templates and assets. We have git ignoring essential everything outside the theme folder, but as i said we’re running into issues with the data, users, menus etc.
The ssh tunnel approach looks promising, but if i’m not mistaken, when i push to stage it would push wp-config.php so I’d have to revert it first? Or is that overwritten on stage as well when the new docker spins up?
Do you mean if you end up using the remote db connection on local?
If you’re worried about needing to change the db connection settings you can either use a framework that integrates environments, like Bedrock, or use some conditional logic like this . But if you’re already using Git, there should be a way to only push the files from your local to MyKinsta Staging instead of pushing using DevKinsta. If you are planning on using the remote database approach you won’t be able to push normally from DevKinsta without overwriting the database on MyKinsta Staging.