Docker: Local Databases

Wow, thanks @psweb (Paul)! I will crack open another beer and go through this. I very much appreciate your time.

No problem @brad, i know how daunting it was when I first ventured into it, but honestly, i will not go back to PHP now, it really is pretty awesome, I do not know exactly why, but there are just little differences that somehow just make it better. Access server data without a server connect when needed is just one of them, adding your SEO tags without jumping through manual code, a second.

2 Likes

Hi Brad,

I have been battling with the same problems. We are used to our own environments when coming from Dreamweaver. We have our Wamp/Mamp server and we can create and manipulate the database using (in my case) phpMyAdmin.

When creating a site in Docker, nothing much changes with the exception that in this case Docker supplies its own Wamp/Mamp and database servers. The problem is, that when deploying the site, we enter a strange territory for us Dreamweavers. For this reason I only use Docker locally when I want to quickly create a dynamic site. The result can still be uploaded to our normal host; the SQL in Docker can be used to populate the remote database. Personally, I would do this only in extreme circumstances.

I have found NodeJS to be a great option. NodeJS replaces PHP that we are so used to. The result is a much better environment than PHP and the future looks even rosier. You can still use the local database that is created in Wamp/Mamp. With NodeJS we stay in familiar territory although there is no need to create the site within the Wamp/Mamp www or similar directory. NodeJS has its own very capable server.

My suggestion based on the type of sites that we (you and I) produce: for new projects go NodeJS and enjoy, especially the templating and routing systems.

When Wappler expands the NodeJS features - and there are numerous - you will appreciate this advice.

3 Likes

thanks for this Paul!!! you saved my ass!!! good and clear instructions… and easy to understand… im also still old school and want to use WAMP to manage my databases… BUT… I know that with time as i get to know this better within wappler… it will get better… stupid question… i see you used MariaDB? why not MySQL? or is nodejs using MariaDB?

Hi Ben… if i do the database with docker… and it has data in it “locally” and I update the “remote” docker… what happens to the online “data” already in the database … and will my “sample” test data then not overwrite my legit online database? eish… sorry stupid questions… just trying to get my head around this…

2 Likes

Look into seeds my local database is empty but seeds maybe what you are looking for here as far as I knew they do data and just the changes do the tables structure (I maybe wrong not something ive needed to look into much yet)

thanks…

Hey @Mozzi your data remains within the database and there is no change to its content. Nothing is overwritten.

3 Likes

thanks Dave… so only the stucture will update… tables if changed…

So how would i dump my data from my current mysql using phpmyadmin to the docker one… i guess this is not a simple answer…

maybe connect to that database that docket generats via navicat or somethig then do a datadump… and then refresh in wappler…? anyway dont want to waste your time… as there is lots of content on this site… im sure ill find the answers somewhere…

1 Like

No time wasted Mozzi! We all have to help each other.

Dump via your favorite DB Manager or phpmyadmin. Connect to your new DB within the container, using the containers IP and whatever port you set for your database, import. Try to stay with whatever version of whatever database you are using initially. When you get things up and running you can always update that side if you wish to. All should be very simple sir.

:slight_smile:

1 Like

Sorry forgot to answer that.

Yes, BUT, whatever you do ALWAYS backup first before applying changes, and get in to the habbit of it if you can. Things can go wrong. Can’t count how many times backups have saved my skinny little behind! :slight_smile:

1 Like

thanks Dave… small steps… but ill get there… thanks for the heads up… and all the help

1 Like

Hi Mozzi, you can use either with Node to be honest, I just prefer MariaDB because I have found it to be faster, however it is really just what I am used to at this stage, so no real solid reason.

1 Like

If you plan to develop on a Mac with M1 chip, MySQL doesn’t yet (afik) have a compatible image so choosing Maria covers all CPU types

2 Likes

eish cant afford even half an apple… not even to speak of one with the M1 chip… some seriously well of developers here… hahahahhaah… i must be doing something wrong :slight_smile: (— must be the php holding me back i hear @JonL say)

3 Likes

I just got the cheapest M1 Mac you can get, the MacMini, and it is a beast compared to all my pre M1 macs, well worth it and cheeper than a custom PC. I did get the 512gb storage version as you can not upgrade hard drive afterwards. Love it.

4 Likes

Totally agree. That’s the route I went… Can add monitors etc. without costing the Earth and it’s properly RAPID!

2 Likes

I have a Mac and a Windows computer on my desk. I’m not a great Mac fan and use Windows most of the time. However, the Mac is a new Mac mini and I’m reallly impressed. It’s the basic version and cost £557.50 (+VAT) in the UK, which seems cheap to me. I need to upgrade my main Windows computer soon and will probably spend a great deal more than this.

3 Likes

You can count on that :joy:

Last year I bought a maxed out and overpriced second-hand 15” macbook pro 2015 as no Mac Apple built from 2015 onwards was worth the money. Then M1 arrived.

I bought it with nodejs money.

I am just waiting patiently for the 16” macbook pro with ARM to arrive. It will be paid with blood and tears of php developers.

3 Likes

Ahhh good old Acorn. Come along way since the days of the Electron hahaha. An amazing story in itself. So much so they made a film about it.

:smiley:

2 Likes