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

Initial incubator resources for container build #819

Merged
merged 7 commits into from
Oct 22, 2024

Conversation

tylerthome
Copy link
Member

Completes some items from #627

What changes did you make?

  • add Dockerfile definitions for base and app container images to .incubator directory
  • add auxiliary files (e.g. nginx config, entrypoint bash script) to .incubator directory

Rationale behind the changes?

  • prepare for GitHub Action deployment to incubator ECR and ECS

Testing done for these changes

  • deployment to ECR

What did you learn or can share that is new?(optional)

  • Dockerized nginx customization for server blocks (without TLS), in contrast to existing EC2 configuration

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

N/A

Copy link
Member

@paulespinosa paulespinosa 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! Renaming docker-entrypoint.sh will help avoid confusion. Thank you!

Copy link
Member

@paulespinosa paulespinosa left a comment

Choose a reason for hiding this comment

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

gunicorn is not a dependency anymore and I can't see where it's being installed. You might be able to get away with running the fastapi run app/main.py --port 8000 command instead.

@tylerthome
Copy link
Member Author

gunicorn is not a dependency anymore and I can't see where it's being installed. You might be able to get away with running the fastapi run app/main.py --port 8000 command instead.

Good call @paulespinosa - I made this change as you suggested. It's using a virtual env there now because there was an issue running either of the fastapi and uvicorn commands as such in the entrypoint.sh. They could run with poetry run but this caused module references to fail while resolving from import paths. This approach worked as expected in the incubator deployment currently running at https://qa.homeunite.us, but open to any alternative approaches if this looks familiar to anyone.

@paulespinosa
Copy link
Member

gunicorn is not a dependency anymore and I can't see where it's being installed. You might be able to get away with running the fastapi run app/main.py --port 8000 command instead.

Good call @paulespinosa - I made this change as you suggested. It's using a virtual env there now because there was an issue running either of the fastapi and uvicorn commands as such in the entrypoint.sh. They could run with poetry run but this caused module references to fail while resolving from import paths. This approach worked as expected in the incubator deployment currently running at https://qa.homeunite.us, but open to any alternative approaches if this looks familiar to anyone.

It looks good. Nothing off the top of my head can think of doing it any other way. Nice work!

Copy link
Member

@paulespinosa paulespinosa 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. Do you want to add an environment variable to capture the right path to the nginx logs for this PR or leave it for another?


@health_router.get("/nginx-logs", status_code=status.HTTP_200_OK)
def nginx_logs():
with open('/var/log/qa.homeunite.us/nginx-access.log') as f:
Copy link
Member

Choose a reason for hiding this comment

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

This is a good place to introduce a HUU_ENVIRONMENT environment variable in config.Settings.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah good catch, will change this before merging

@tylerthome tylerthome merged commit 1a466e1 into main Oct 22, 2024
0 of 2 checks passed
@tylerthome tylerthome deleted the incubator-initial-gha branch October 22, 2024 00:49
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.

2 participants