Skip to content

Add support for src/common directory #1104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 20, 2023
Merged

Conversation

rzats
Copy link
Contributor

@rzats rzats commented Mar 6, 2023

Closes #1037.

Prerequisites:

  • Unless it is a documentation hotfix it should be merged against the dev branch
  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

Summary

Adds support for the src/common directory visible by both acquisition & server and restructures the web Docker container's imports to make them make a little more sense. This includes modifications to the:

  • ci.yaml workflow
  • deploy.json
  • Makefile
  • Dockerfile

Additionally, this merges the two (identical) logger files from acquisition and server into one, now located in the common directory.

@rzats rzats requested review from krivard and melange396 and removed request for krivard March 6, 2023 20:17
@rzats
Copy link
Contributor Author

rzats commented Mar 6, 2023

@melange396 @krivard this is potentially an extremely breaking change, so if there's any way to test this besides making sure that the usual tests pass (which they do), please let me know!

@krivard krivard requested a review from korlaxxalrok March 6, 2023 21:56
@melange396
Copy link
Collaborator

we can try deploying to staging, which should be a much closer approximation to the production environment than the dev docker images are, right @korlaxxalrok ?

@@ -61,7 +61,7 @@ jobs:
run: |
docker network create --driver bridge delphi-net
docker run --rm -d -p 13306:3306 --network delphi-net --name delphi_database_epidata --cap-add=sys_nice delphi_database_epidata
docker run --rm -d -p 10080:80 --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --network delphi-net --name delphi_web_epidata delphi_web_epidata
docker run --rm -d -p 10080:80 --env "MODULE_NAME=delphi.epidata.server.main" --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --network delphi-net --name delphi_web_epidata delphi_web_epidata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: where is MODULE_NAME used?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its used in the base image that gets built upon in devops/Dockerfile, "tiangolo/meinheld-gunicorn". see the documentation for that image, which i also mentioned in the associated issue (#1037) for this pr.

comments noting the purpose of MODULE_NAME along with that documentation link above should probably be included here, in the Makefile, and in devops/Dockerfile.

MODULE_NAME will also need to be populated in automation or ansible or whatever it is that runs the API server code, which we will probably see when we try to test running this on our staging and/or qa setups. (cc: @korlaxxalrok )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks like we'd need to pass an additional environment variable.

Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move CovidcastRow into common as well? that could help with #1103, as referenced in #1078.

@@ -61,7 +61,7 @@ jobs:
run: |
docker network create --driver bridge delphi-net
docker run --rm -d -p 13306:3306 --network delphi-net --name delphi_database_epidata --cap-add=sys_nice delphi_database_epidata
docker run --rm -d -p 10080:80 --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --network delphi-net --name delphi_web_epidata delphi_web_epidata
docker run --rm -d -p 10080:80 --env "MODULE_NAME=delphi.epidata.server.main" --env "SQLALCHEMY_DATABASE_URI=mysql+mysqldb://user:pass@delphi_database_epidata:3306/epidata" --env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --network delphi-net --name delphi_web_epidata delphi_web_epidata
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its used in the base image that gets built upon in devops/Dockerfile, "tiangolo/meinheld-gunicorn". see the documentation for that image, which i also mentioned in the associated issue (#1037) for this pr.

comments noting the purpose of MODULE_NAME along with that documentation link above should probably be included here, in the Makefile, and in devops/Dockerfile.

MODULE_NAME will also need to be populated in automation or ansible or whatever it is that runs the API server code, which we will probably see when we try to test running this on our staging and/or qa setups. (cc: @korlaxxalrok )

@korlaxxalrok
Copy link
Contributor

This looks good to me. Since this touches both acquisition and the API container image we should coordinate and test fully on staging.

korlaxxalrok
korlaxxalrok previously approved these changes Mar 13, 2023
Copy link
Contributor

@korlaxxalrok korlaxxalrok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (pending suggestions + any remaining questions) 👍

@rzats
Copy link
Contributor Author

rzats commented Mar 15, 2023

@korlaxxalrok @melange396 @krivard applied the changes, re-requesting review!

(Also, @korlaxxalrok, let me know how and when you'd like to test this on staging)

@rzats
Copy link
Contributor Author

rzats commented Mar 15, 2023

Both changes applied! @melange396

@rzats rzats requested a review from melange396 March 15, 2023 21:47
Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonderful!

Copy link
Contributor

@korlaxxalrok korlaxxalrok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks. We can merge and test on staging next.

@korlaxxalrok korlaxxalrok merged commit 61e545f into dev Mar 20, 2023
@korlaxxalrok korlaxxalrok deleted the rzatserkovnyi/common-package branch March 20, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make a "src/common/" directory (package?) to share between server and acquisition code
4 participants