Use Cloud Database (like Firebase)

Hello,

I’m running into a problem, for which I think the best solution is to use a cloud database such as Firebase.

Somehow, some way, I got Postgres running in Docker on my Mac several months ago, with which I’ve been developing without issue. However, I’ve been trying to get it set up on another computer, and it’s failing every time. Seems like the database server is simply not running locally. It’s the same problem for two Macs other than the one working Mac. Whatever the problem is, I’m running out of time to solve it and so I’m looking for other solutions.

If I could get a database running in the cloud for local development, maybe in production though I’m unsure exactly, then the problem of setting it up on other computers would be fixed. If this needs to be put on another computer in the future for whatever reason, then the database would not be a concern. It would also simplify development between multiple machines when it comes to the database.

I’m aware that, to some degree, the database URLs are hardcoded in. But would it work somehow to use a cloud database (like Firebase), even if it requires changing some hardcoded values?

Thanks.

Hi,

i don’t really know what problems you are facing with running postgres locally on your mac. In case you have docker installed (https://docs.docker.com/docker-for-mac/) you can start a postgres db instance with a single command:
docker run -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres -p 5432:5432 -d postgres

So, i’ve run it hundred times on different computers and never really faced problems with it.

Another option, which is pretty common, is to use HSQLDB for development. Since it is embedded in CUBA studio, you should not have any problem running it.
Then only one person has to create the production DB scripts before deploying your application.

But what also work is to have a hosted DB running somewhere. There are dozens of offerings out there. E.g.:

AWS - https://aws.amazon.com/rds/postgresql/
Azure - https://azure.microsoft.com/en-us/services/postgresql/

Having a shared database for different developers comes with its own challenges and problems (see: https://www.troyhunt.com/unnecessary-evil-of-shared-development/).

Probably one of the options, which is not really suitable is to choose Firebase :slight_smile: The reason is, that it a NoSQL store at the end of the day (https://firebase.google.com/docs/database/)

Store and sync data with our NoSQL cloud database

Although CUBA is start to adopting NoSQL little by little, it is far from using a relational database like Postgres, Oracle, MySQL etc.

So, compared to your challenges you have with installing your local db server, the problems with trying to integrate a NoSQL store seamlessly in a framework which heavily relies on SQL will be tiny :wink:

I hope this gives you some guidance on what to do.

Bye
Mario

1 Like

It was an odd problem, but your reply gave me a hint at its solution - I didn’t specify the ports when I created the container. I didn’t think I had done that when I first set it up on the working Mac, but I started over and specified the ports, and I was able to successfully access the database. I haven’t been able to open Cuba Studio on that Mac, but I’m not concerned about that since I’m going to try again on the first new Mac and see if the database also runs properly there (Cuba Studio opens fine on that machine). I’ll update here with the success for that other Mac.

Thanks for your help!

In regards to the other parts of your reply, you have convinced me that shared databases are a bad idea for development, and that Firebase (or any NoSQL implementation) will not work as well as I need it to at the moment.

It worked just perfectly on the other Mac. Thanks for your assistance!