A few silly question mainly Docker Remote related

I have a couple things that I just cant seem to find the answers to.

So I start off local development with docker local, a database and my project gets bigger and bigger, as well as my database, which sometimes will also have structural alterations.

Eventually i am ready to add it to a remote environment, so I sign up to a service like Digital Ocean, set it all up with Portainer and Traefik etc.

Question 1: How do I take my entire database from Wappler and replicate the latest current version to my remote, considering half my database changes are made in an external database application like Navicat, phpMyAdmin, or the likes, so Wappler has no Changes files for me to use.
Attempted to use Seeds but that made no sense to me, and the Clear Previous Data toggle scared me, also tried the “Save Database Data and Structure” button near the Deploy button, but could not even find where that save went to.
My final solution was to just back it all up in my database application and restore it to my remote database, then refresh the connection in Wappler which then showed all the tables as they were in local.

Question 2: Once the 2 databases are identical and my target is mostly set to remote from now on, how do I keep the 2 databases in sync, data wise, I mean the customer is adding records to the live site, but the local site is never updated, so if i want to make some local alterations for testing, i need the data to be the same.

Question 3: Due to my database and Docker confusion, I am doing all my testing on the remote, but after each change I have to save, as well as Deploy, which is time consuming, but it also makes many images in the container, until Wappler says the Container is out of space, I have to go into Portainer and dump all the images no longer in use. Is there a way around this, either that Wappler only keeps the latest 5 images, or is there a way to dump the unused images without Portainer or the CLI, purely in Wappler.

Lastly, and this is not so much a question but a feature request for the silliest feature ever, once I have deployed, can it give me a time in the log output, as when doing many tests all day long and into the wee hours of the morning I sometimes forget if i deployed or not and land up doing it again just incase, if it had a time I would have some indication.

You can use the CLI in Wappler to achieve this:

Best bit is, once you have run docker system prune once. You just need to go to the Host Server SSH next time and press up arrow to see the previously run command to run it again - simples :smile:

1 Like

Thank you, that is far quicker than manually doing the Portainer deletes where I have to manually select each image, or filter unused ones etc.

Sadly I actually recall seeing this post, but as I was not planning on using Docker at that time I kind of glossed over it, too much info to retain.

Now only question 1 and 2 remain, hoping @Hyperbytes, mr database has found a way around this one.

1 Like

I was hoping that there would be a ‘clean up’ button in the Docker command buttons to run this - I guess @George and the team have been busy… TBH once you’ve run it once, it takes seconds to flick to the terminal and run it again

1 Like

In terms of the DB, dumping and restoring is probably the way to go. The other option is pulling the schema and recursively running to check if tables/columns exist, adding data (again if it doesn’t exist). If you find a simple solution, I would love to know!

Yeah, I did an SQL dump of my entire database through SQLPro Studio but because many of my tables use Foreign Keys, its a bit of a manual process as it can not do it in one go without giving Foreign Key missing errors all over the place. So a bit of a pain to be honest.

I feel your pain…

1 Like

I do have to wonder why sql dumps are created so silly, it’s like they have no logic.

I mean why make the DROP TABLE IF EXISTS right above the CREATE TABLE command, considering if you use Foreign Keys they need to be exactly opposite to each other.

If I create 4 tables

  1. Continent
  2. Country
  3. State
  4. City

And add Foreign Keys to that, I would have
Table (4) references (3) and Table (3) references (2) and Table (2) references (1)

Therefore creation may be 1, 2, 3, 4 but deletion should be 4, 3, 2, 1 to not hit the Foreign Key errors.

I mean if I can manually extract all the DROP TABLE's and order them correctly and then extract all the CREATE TABLES's and order those correctly, and place them in a single file and get no errors when importing that dump then i can not see how it can not be worked out by the program itself. It should only need to read all the CONSTRAINT and REFERENCES and it should know exactly how to order the whole lot automatically.

Sorry late night rant, hahaha