How to not overwrite data on deploy?

As a heads up I’m new to databases and such, so sorry in advance.

I have a Wappler project using SQLite and I have added an admin area where I can manage data on the site. When I deploy the site to DigitalOcean it’s all fine and I can edit and make new entries in the database using the admin area. If I go and make changes to the Wappler project and redeploy it, it erases/resets any changes I have made. I assume it is replacing the database on DigitalOcean with a copy of my local one?

How can I make it so when I want to make changes to my site it won’t overwrite the database when I deploy the changes?

Not sure if I am missing something or if this is how it is intended to work?

I’ve been looking around on the forums and docs and can’t figure this out. I see @Hyperbytes and @Teodor talk about it here All the questions about docker you wanted to ask but felt stupid asking but didn’t see an answer for the part about the local database overwriting.

I see this

“Hitting deploy only changes the files, it does not change the database structure or contents”

but it does change the database content for me. I assume it’s because I’m using SQLite and it’s reuploading the file? If so, can I use the publish manager to exclude the database file?

I feel like I’m missing something simple here.

Your issue appears specific to sqllite, as it is just a text file it is overwritten.
Either deploy to a proper mysql table or place your sqlite file in the uploads folder as defined in your project settings to stop it being overwritten

2 Likes

I’m a bit confused on how to deploy to MySQL. Do I need a managed database on DigitalOcean or can I just use my Droplet? And if I can use my Droplet how do I set it up via Docker? Do I set the type to Docker or is that for Docker locally?

I tried setting it to type Docker and Engine MySQL but I get the following error when I try to view the DigitalOcean site.

{
"status": "500",
"code": "ER_ACCESS_DENIED_ERROR",
"message": "ER_ACCESS_DENIED_ERROR: Access denied for user 'db_user'@'172.18.0.3' (using password: YES)",
"stack": "Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'db_user'@'172.18.0.3' (using password: YES)\n    at Handshake.Sequence._packetToError (/opt/node_app/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)\n    at Handshake.ErrorPacket (/opt/node_app/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)\n    at Protocol._parsePacket (/opt/node_app/node_modules/mysql/lib/protocol/Protocol.js:291:23)\n    at Parser._parsePacket (/opt/node_app/node_modules/mysql/lib/protocol/Parser.js:433:10)\n    at Parser.write (/opt/node_app/node_modules/mysql/lib/protocol/Parser.js:43:10)\n    at Protocol.write (/opt/node_app/node_modules/mysql/lib/protocol/Protocol.js:38:16)\n    at Socket.<anonymous> (/opt/node_app/node_modules/mysql/lib/Connection.js:88:28)\n    at Socket.<anonymous> (/opt/node_app/node_modules/mysql/lib/Connection.js:526:10)\n    at Socket.emit (node:events:513:28)\n    at addChunk (node:internal/streams/readable:315:12)\n    --------------------\n    at Protocol._enqueue (/opt/node_app/node_modules/mysql/lib/protocol/Protocol.js:144:48)\n    at Protocol.handshake (/opt/node_app/node_modules/mysql/lib/protocol/Protocol.js:51:23)\n    at Connection.connect (/opt/node_app/node_modules/mysql/lib/Connection.js:116:18)\n    at /opt/node_app/node_modules/knex/lib/dialects/mysql/index.js:66:18\n    at new Promise (<anonymous>)\n    at Client_MySQL.acquireRawConnection (/opt/node_app/node_modules/knex/lib/dialects/mysql/index.js:61:12)\n    at create (/opt/node_app/node_modules/knex/lib/client.js:254:39)"
}

I generally just use the droplet although I am not a big docker user.
Wappler manages your db settings for you, no need to manually set them. Use use the automatically created “DB” connection

The DB connection is set to SQLite.

Do I change it to MySQL and get the credentials

or did I need to have setup the project as MySQL in the first place?

Can i ask the obvious.
If are deploying via docker, why are you not also using docker local DB services on your development platform?
I assume you are using docker local rather than the wappler inbuilt node server?

To be honest, I’m a bit lost with all the whole hosting/database part of Wappler. I was remaking a simple WordPress site I had in Wappler to get the hang of using it. I used SQLite and the Wappler local server for development and didn’t do anything with Docker at the time. When I wanted to upload it, I looked at the docs to learn how to do so and found DigitalOcean and Docker recommended https://docs.wappler.io/t/about-the-hosting-and-cloud-platforms-category/22091

Coming from WordPress and Bubble I have no experience with this side of things. I’m not sure if I need to use Docker or if there is a simpler way. With WordPress/Bubble I always just built the site online and didn’t need to upload the site, so I really don’t know where to start. Any advice on what I should look into learning or if you know of any good resources/tutorials?

I actually just found out about the resource manager Managing Cloud Servers with Resource Manager
for some reason that page didn’t show on the docs page.

This seems quite a bit easier to me rather than trying to use Docker. I will take a look at it later on and hopefully figure it all out.

Your problem seems to be that my tutorials are based around wappler’s local server and mySqlite. This environment is used for non docker deployments.
If you want to use docker then your development target should be docker local.
Docker simplifies some aspects if deployment but also adds it’s own complications.
Personally I use a VPS and FTP in preference to docker so i use the wappler inbuilt server and mysqlite.
I will be releasing some new modules on the two server models in the future but there are some old modules I did re docker setup on the youtube channel.

To be honest I think there is an issue with the Wappler documentation. It is rather outdated and tends to only show one or two ways to achieve something even though the main draw of Wappler for me is the freedom it provides. As someone with little/no experience in the server side of things I saw Docker used in the docs so I assumed it was the best/easiest and never even really knew I could just upload via FTP.

I assume a big part of my problem is that Wappler expects you to have a higher base understanding of web development than I do. I feel like if they made it a bit easier to people coming from places like WordPress and Bubble they could get a large crowd of people interested.

If it wasn’t for your tutorials and the help on the forum from people like yourself and @ben me and probably quite a few others would have had to give up on Wappler just because of the learning curve. Then again, I might just not be the target user Wappler is going for.

Sorry for rambling a bit, but I really appreciate all you do for this community and making it accessible to newcomers like myself.

Wappler is effectively a victim of it’s own strengths.
I dont know any other product which changes so dynamically and frequently responding to user requests , sometimes on a weeks notice.
This makes keeping to 1000s of posts supporting it a huge task. We have the choice, better docs or more features, the team simply is not big enough to do both.
I try, as an ambassador to plug the gaps as best I can but I only have so much time to spare.
I do agree that sometimes the most fundamental basics for new users can get overlooked in favour of the newer “sexy features” and I have been in discussion with the team as to how I can best help to address that via my videos.
I deliberately left out the deploy to production aspect from course as there are so many alternatives that I couldn’t possible address all the alternatives but perhaps there is scope for two basic modules based on deploy via FTP and deploy via docker.
I will so what I can come up with but it may be a few weeks as I am currently recovering from surgery so not really working at all.

That was my general thoughts on it as well. Wappler has so many amazing features but for someone new it is hard to know what is all available or the when to use what. I assume part of the problem is that Wappler is both trying to improve and speed up the workflow of experienced users as well as make it accessible to newcomers and those sometimes don’t match up. With how small the team is the updates are incredible.

Perhaps a simple solution would just have a small document for each category showing the choices and when best to use them. And when a new feature is added it could be added to the list.

Again, most of this is on me, Wappler has all the features I just don’t have enough knowledge on the subject to know when and what to use. I assume it is obvious that you could just upload via FTP but I thought you might need to install server software and edit files via commands lines and such so I went with Docker which I assumed would be easier but I just ended up complicating things.

Anyways, thanks again for all the help and I hope you take it easy and get well!