How to Hack The Target Database For My Hosting Setup

I’m hosting my test and production databases with AWS Elastic Beanstalk. Because it is a load-balanced system, they do not support uploading of your app via ftp/git, they only support it via a zip file.

I want to be able to upload one zip file and then apply it to both test and production… but that involves using some automatic grep commands on installation which will hack the Wappler created files to change the target… so I’m trying to work out which files I need to change.

I can see I need to change:

.wappler/project.json
    "activeTarget": "XYZ",

and it looks like I also need to change:

dmxConnect/modules/connections/connection.php
    "mysql:host=xyz;...."

Do I also need to change this one?

.wappler/targets/TARGET_NAME/dmxConnect/modules/connections/connection.php

Or any other file?

I understand that these things could change and I’m not supposed to be doing this stuff!

You shouldn’t mess with Wappler targets and flow otherwise much will break.

For site deployment we are supporting more and more options not only ftp but also git for deployments like on Heroku.

We might also add support for beanstalk and it’s deployment methods, but for now you can just run them via the terminal in Wappler.

So no need to hack anything.

Also you are talking about database deployment but mention file deployment with zip. Those are two separate things.

Thanks for your feedback @George!

So the upload to Elastic Beanstalk is via a zip file and I have two environments in AWS with two different databases.

At the moment I have to:

  1. Set target in Wappler to Test
  2. Create and upload zip file.
  3. Remember to set target back to Development
  4. Deploy to Test environment and check it works okay.
  5. Set target in Wappler to Production
  6. Create and upload another zip file.
  7. Remember to set target back to Development
  8. Deploy to Production environment

So what I am trying to find is a way to perform one upload, and have the
elastic beanstalk configuration files do the grep/sed to change the target automatically. I have the process working for editing the project.json file, but not yet for the others I mentioned.

What I am trying to do will save me steps 3, 5, 6 and 7 (So 4 steps instead of 8) and a lot of mental energy and potential to get things wrong.

And since I don’t have cable internet, each upload takes 20 minutes. :frowning:

I know you don’t like us fiddling with Wappler files, but any small amount of support you can give me in this would be really beneficial! :slight_smile:

What are you zipping exactly?

The entire project directory… so the directory with design_files.html, dmxConnect/* etc etc

Aren’t you just running the eb deploy command? It does the zipping and upload for you

No… because the upload takes 20 minutes and I may want to synchronise database changes… so I am doing the upload manually through the AWS console and deploying when that is done.

And…

I’m trying to do just one upload to EB… if I find all works okay in the test enviroment then I have the master release there waiting for me in EB to deploy to live at the click of a button… except I can’t do that at the moment as it has the wrong Wappler target!

Maybe you shouldn’t use the zip deploy method at all but switch to git deploy. It is much faster and reliable as only changes are uploaded.

See:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cli-git.html

And you can use simply the git integration in Wappler to deploy.

Thanks for coming back to me on this @George with a possible way forwards!

I had tried experimenting with using eb cli and git, but the eb cli threw an error when it went off to find my git repository which I couldn’t find any solution to via google.

I also had the impression that it will still upload the full site, but just taking the direction of what files to upload from the git commit… but maybe you are right and it only uploads the changes.

Do you know the best way to “reset” my git repository so that eb cli may recognise it without the error? I don’t mind losing my existing commits as I have them as zip files on my laptop too.

Then I can have a play and see if that path will work out…

Thanks for your help with this! :slight_smile:

Antony.