Docker Targets and Database structure

Will the data in my remote database (the database stored on Digital Ocean) get overwritten each time I re-deploy from Wappler to my remote Docker server on Digital Ocean?

In Bubble, when you deploy from development to live, the live data will not be overwritten by the development data. I’m wondering if it’s the same when deploying from Wappler to the remote Docker server on Digital Ocean.

Thanks!

1 Like

No the database won’t be overwritten and will stay on each redeploy.

Only when you completely shutdown and rebuild the docker project it will get reinitialized from the last backup

Thanks, @George. I’m somewhat familiar with the rebuild process and have tested it via clicking the Save Database Data and Structure button and then shutting down and rebuilding. Works great!

What I was asking above was more in regards to development vs production.

Let’s say my project has a target called Local Docker (which is, of course, using a local connection).

The same project has another target called Remote Docker (which is using a remote connection). This is the target that deploys a Docker container to a Digital Ocean Droplet.

When I, for example, make changes to the database structure of the Local Docker database, what happens when I then switch to the Remote Docker target and deploy to Digital Ocean? Are the structural changes I made to the Local Docker database then published to the Remote Docker database on Digital Ocean?

And, if so, is it just the structural changes that are published to the Remote Docker database on Digital Ocean…or is the data itself in the Remote Docker database overwritten with the data from the Local Docker database?

3 Likes

We don’t have yet a database structure synchronization tool. So if you make any structural changes in your local database (docker or not doesn’t matter), you have to save the changes sql and execute it on the remote database as well to make the structures equal.

See also:

1 Like

Thanks, @George. That clears up how to keep my live database structure synched up with my local database structure. Much appreciated.

When creating a local Docker target, Wappler automatically creates a database (called db) and makes the initial database connection for me…which is great. I use that database connection over and over when developing locally.

What happens though when I change to my remote Docker target and deploy to Digital Ocean? Won’t that database connection in my Server Connect action files still be pointing towards the database in the local Docker container? If so, wouldn’t that cause my live web app on Digital Ocean to not function properly?

Am I supposed to manually edit the database connection in Server Connect to point towards the database in my remote Digital Ocean Docker container before each and every deploy and then change it back after each deploy so that I can continue developing locally?

No, with docker targets we have separate database connections per target.

It is called “db” and it is automatically switched when you switch targets.

1 Like

How can the local docker target db (structure and data) be copied/synced manually to the remote docker db? Because this part is not working for me:

In fact I tried this on remote and local Docker and now both db’s are completely empty, all tables are gone!

You should use the new Database Manager for synch different targets, see my video with explanation:

Thanks for this amazing video @George. Next gathering I will join for sure.