Best way to create new 'production' docker contained app with external DB

Hey all,

So we are close to wanting to start creating our production environment.

We’ll be using a Docker Machine on AWS - I want to create the project correctly the first time so looking for some advice as I’ve had constant challenges with setting up DB’s if they are external to the docker DB, and utilizing the DB Manager in Wappler (which I want to use, and be able to merge changes).

My plan:
Go to targets - name the new target as Production
Create new docker machine in the AWS region of choice - choose server etc. and create.
Once created go back to targets and select it.
Choose NodeJS etc.
I then create a new RDS MySql DB in AWS.
for Database - should I put this as ‘none’ ?
And then in DB Manager - would I create a new DB with the new AWS RDS DB details? Or, would I just change the connection parameters of the pre-existing DB that will display in the DB manager that is there from the other targets to the new dB settings?

I assume I can’t deploy DB changes to the external DB so instead I would copy the schema from the staging DB and add to the new DB via SQL Workbench?

So for anyone interested in doing the same, and running an external DB for a docker application - I did get this 99% of the way with AWS. Especially useful if you have your own registered startup as you can apply for AWS Activate credits $5k.

What I’ve done:
Created new docker machine in AWS region, with desired server.
Applied this to my NodeJS target settings.
Chose ‘none’ for DB settings.
I then applied an elastic IP within the AWS UI, associated it with my EC2 instance.
Then back to Wappler and the docker machine, click change IP and add the new IP Address.
I then added expiremental features, had to restart Wappler for it to appear in the docker machine and then got my SSL up and running. You have to add all options in the target settings, both for Traefik and Portainer for the console to run below.

I then went back to AWS, and created a new MySql DB - set up the access permissions and made the DB public.

I went to my current Wappler remote DB, made sure all changes up to date and then opened Sql Workbench.

Connect to the new DB, and the old DB then start and follow the migration instructions.

And voila.

Here is where things are not 100%.

I went back to Wappler, I can create a ‘direct’ connection, but the server connection never stores - doesn’t matter how many times I try to save it - so I am getting the below error.

“{“status”:“500”,“code”:“ENOTFOUND”,“message”:“getaddrinfo ENOTFOUND db”,“stack”:“Error: getaddrinfo ENOTFOUND db\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)”}”

on the staging remote on AWS (db within Docker container) - no issues, on local, no issues but I cannot log in - or work with the production app due to this.

I also have a half green circle:
Screen Shot 2020-09-07 at 4.24.08 pm

@George can you please advise on the above error?

In addition, the only other issue I see is that I cannot access the portainer, or traffic dashboards, the do not load at all and also the user and password in the traefik setup does not store.

1 Like

@mgaussie

Great post. I am also looking at something similar, but with PHP, and RDS on MariaDB for improved/ease of encryption.

Any update? I am just at the stage where I am testing out AWS as a target and seeing what updates / configuration changes are needed. It was super easy to create the docker machine and deploy.

1 Like

That is a good best practice indeed. Use the database with docker just for small sized projects. For larger projects use a managed RDS from Amazon RDS or Digital Ocean managed database.

The error above shows that a wrong address is used to connect, see:

1 Like

Hey @runner - George might have answered, but I was wondering what you mean by ‘Any update’? So I know how to reply :slight_smile: