ErrorsAndGlitches / waisn-tech-tools

Tech tools for the WAISN.
0 stars 1 forks source link

Set up WSGI for Elastic Beanstalk #16

Open ErrorsAndGlitches opened 5 years ago

ErrorsAndGlitches commented 5 years ago

A lot of links and references can be found in this issue:

ErrorsAndGlitches commented 5 years ago

Going to start working on this.

ErrorsAndGlitches commented 5 years ago

Still need to figure out how commands are run using these.

ErrorsAndGlitches commented 5 years ago

Using EB extensions for running commands before/after service start:

ErrorsAndGlitches commented 5 years ago

Setting up the docker configuration:

ErrorsAndGlitches commented 5 years ago

Docker repo has been set up:

Installing eb CLI:

pip install --upgrade awsebcli
ErrorsAndGlitches commented 5 years ago

eb create documentation:

ErrorsAndGlitches commented 5 years ago

Environment variables:

ErrorsAndGlitches commented 5 years ago

The meaning of upstream in nginx configuration:

ErrorsAndGlitches commented 5 years ago

More information about upstream and nginx configuration in general. Very thorough though I haven't read all of it, but skimmed the upstream parts:

ErrorsAndGlitches commented 5 years ago

Elastic Beanstalk also supports hooks, which seem to overlap with ebextensions:

ErrorsAndGlitches commented 5 years ago

Issue was that EB parses the Dockerfile for the EXPOSE information.

ErrorsAndGlitches commented 5 years ago

May be able to use the second version of the Dockerrun.aws.json

ErrorsAndGlitches commented 5 years ago

Other notes:

ErrorsAndGlitches commented 5 years ago

What is the relationship between .ebextensions and hooks?

ErrorsAndGlitches commented 5 years ago

Interestingly, the EB Docker set up does not have a host to container port mapping (tested on Mac). This might point to an issue that I'll need to hunt through the hooks to understand. Alternatively, moving to V2 configuration is another option.

ErrorsAndGlitches commented 5 years ago

Fixing SSL MySQL issue:

ErrorsAndGlitches commented 5 years ago

Things to fix:

ErrorsAndGlitches commented 5 years ago

I'm also not 100% certain that the migrations happened. May need to change this to a hook (though, this doesn't require the service to be deployed so not sure what's up here).

ErrorsAndGlitches commented 5 years ago

I may have fixed the static files by overriding the sites-available file:

ErrorsAndGlitches commented 5 years ago

One issue was that it wasn't checked in so it wasn't getting deployed. After committing it, eb deploy wasn't updating the file. It could have to do that the file is only deployed during the first initialization. Going to try that. If not, it may be worth looking into the code again. Here are some SO articles that might help:

ErrorsAndGlitches commented 5 years ago

The ebextensions approach only works for Java and Go platforms. WTF.

ErrorsAndGlitches commented 5 years ago

Fixed the static files by overwriting the sites-available file via ebextensions. Still having some trouble getting Auth0 to work, but I believe I have identified the issue in the settings logic. I have created some unit tests to verify and am testing in production now.

ErrorsAndGlitches commented 5 years ago

Figured out the Auth0 issue - it was because the database migration command did not specify the production settings and hence it was not creating the needed Auth0 tables.

ErrorsAndGlitches commented 5 years ago

When going through this tutorial:

Found that the code was taking the approach of a custom Auth0 integration, which I don't think is needed. I've switched it out to the default one and found that it was erroring on not getting email. I made the change to enable email and it works when running production model locally (not in Docker). Going to try in prod mode via docker, push, and redeploy.

ErrorsAndGlitches commented 5 years ago

It seems that running in DEBUG mode, but with authentication on generates more logs. It shows that the rsa module is missing.