onnela-lab / beiwe-backend

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe backend code
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
63 stars 43 forks source link

Add support to deploy on a non-default AWS VPC #281

Open eze1981 opened 2 years ago

eze1981 commented 2 years ago

Current launch_script.py assumes that a default VPC is available in the AWS account. That is not always true, also it does not allow control of the subnets where different resources will be deployed. For example, it will be useful to deploy the ElasticBeanstalk webserver in a public subnet and keep all other resources (RDS database, manager, and worker nodes) in private subnets.

I have a version of the repo that supports deployments in a non-default VPC but it breaks compatibility with default VPC installations. =)

This is the commit on my fork that adds this capability: https://github.com/ORC-RIS/beiwe-backend/commit/9483dc41ab9838c1fcb6b814e5a996b42626e9e0

This solution depends on four new configuration settings:

I included those settings in _globalconfiguration.json file. Is this the correct place for this kind of configuration?

Also, we need to identify a mechanism to determine when deployment needs to happen in a default-VPC with no specification about the subnets, and when it needs to happen in a non-deafult VPC being explicit about the subnets for each type of resource.

biblicabeebli commented 2 years ago

This is excellent work. I did/do not have the underlying fluency in the way AWS routes work on non-default VPCs - I just happen to have never touched that before - so thank you!

Some high level questions and comments for you:

Credentials and Code Stuff:

Code quibble: You've removed a try-except block that handled an InvalidSecurityGroupNameException - this styling is used intentionally to make the code explicit, and to make the code explode with a reportable stack trace and stop if some different error occurs. I do see other places where you are testing against None - I haven't gone through in detail, but I would like you to use convert to exception casing wherever possible.

eze1981 commented 2 years ago

High level questions:

Credentials and Code Stuff:

Code quibble:

biblicabeebli commented 2 years ago

(Hey, thanks for this, I've skimmed, I'm gonna need to find some time to review. In the meantime, can you make sure you are rebased off of main? There shouldn't be conflicts.)