Skip to content
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

Fix(server): remove unnecessary configuration of FLASK_APP #1836

Merged
merged 1 commit into from Dec 20, 2023

Conversation

angela-tran
Copy link
Member

@angela-tran angela-tran commented Dec 20, 2023

I was finally able to reproduce the issue we've been seeing in our GitHub Actions Cypress test failures. That workflow starts up client and server via Docker Compose.

I had to delete all my containers and images to finally see the issue:

2023-12-20 12:35:09 + bin/init.sh
2023-12-20 12:35:09 + flask init-db
2023-12-20 12:35:09 Error: Could not import 'app'.
2023-12-20 12:35:09 
2023-12-20 12:35:09 Usage: flask [OPTIONS] COMMAND [ARGS]...
2023-12-20 12:35:09 Try 'flask --help' for help.
2023-12-20 12:35:09 
2023-12-20 12:35:09 Error: No such command 'init-db'.

I guess somewhere in some cached layer of a Docker image, there must've been something that made my server able to find the Flask app, and only by deleting everything was I able to get my Docker Compose server to break.

The reason that server was not starting up is because FLASK_APP needs to be to eligibility_server.app:app to match the change in cal-itp/eligibility-server@60c8eb2#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R16.

But actually, Benefits doesn't even need to set this environment variable since eligibility-server's Dockerfile already sets it.

the reason that server was not starting up is because this needed to be
changed to 'eligibility_server.app:app'.

actually, this environment variable is already configured in the
Dockerfile for eligibility-server, so there is no reason for Benefits to
configure it.
@angela-tran angela-tran self-assigned this Dec 20, 2023
@angela-tran angela-tran requested a review from a team as a code owner December 20, 2023 18:47
@github-actions github-actions bot added the docker Application container, devcontainer, Compose, etc. label Dec 20, 2023
Copy link

Coverage report

The coverage rate went from 90.87% to 90.87% ➡️
The branch rate is 85%.

None of the new lines are part of the tested code. Therefore, there is no coverage data about them.

@angela-tran
Copy link
Member Author

angela-tran commented Dec 20, 2023

The eligibility_server.app:app that's passed to Gunicorn in eligibility-server's bin/start.sh script is just to tell Gunicorn what WSGI app to run (source: Gunicorn docs).

FLASK_APP is still needed so that Flask can find the app to start (source: Flask docs).

@angela-tran angela-tran added the bug Something isn't working label Dec 20, 2023
@angela-tran angela-tran merged commit 025f5a6 into dev Dec 20, 2023
10 checks passed
@angela-tran angela-tran deleted the fix/flask-app branch December 20, 2023 20:44
@machikoyasuda
Copy link
Member

Incredible debugging and sleuthing Angela 👏 👏 🗜️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker Application container, devcontainer, Compose, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants