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

Frontend + Backend Integrated Deployment (K8s only) #45

Merged
merged 4 commits into from
Dec 3, 2021

Conversation

ikreymer
Copy link
Member

@ikreymer ikreymer commented Dec 2, 2021

In support of #19, this combines the frontend + backend running on a single domain.
The backend and frontend run on separate services and can be deployed independently, though currently with the same helm chart.
The backend is then run entirely from /api endpoint, eg. /api/docs

Contains:

  • Creating custom nginx container with own Docker image, which simply contains the frontend files
  • Splitting nginx container into own k8s service, which can be deployed separately (but requires image update)
  • Configuring backend to serve via /api prefix
  • Configuring ingress to point to backend service for /api prefix.
  • Support for --set frontend_only=1 and --set backend_only=1 helm chart settings to redeploy only one or the other.

Questions/TODO:

  • The frontend image packages main.js and index.html, although there's a bunch of other chunks that are build. Probably need to set up a production build of the frontend to make this more robust? @SuaYoo
  • Investigate if makes sense to have separate helm chart for frontend, which doesn't need any backend config options

package frontend + config into new nginx-based image
chart: support '--set backend_only=1' and '--set frontend_only=1' to only force deploy one or the other
remove unused files, openapi env var
backend: set --root-path to /api in uvicorn
@ikreymer ikreymer requested a review from SuaYoo December 2, 2021 07:23
@SuaYoo
Copy link
Collaborator

SuaYoo commented Dec 2, 2021

Created #46 for frontend prod build settings

FROM nginx

COPY ./index.html /usr/share/nginx/html
COPY ./dist/main.js /usr/share/nginx/html
Copy link
Collaborator

Choose a reason for hiding this comment

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

#46

Copy link
Collaborator

@SuaYoo SuaYoo 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, a few comments:

  • Did you manually delete frontend/src/__generated__? If so, what was the reason?
  • Per discord convo, frontend isn't running in local docker yet

@ikreymer
Copy link
Member Author

ikreymer commented Dec 2, 2021

Looks good, a few comments:

  • Did you manually delete frontend/src/__generated__? If so, what was the reason?

Yes, oops, that was my mistake! I think I saw generated and thought it was something I added by accident, will revert.

  • Per discord convo, frontend isn't running in local docker yet

yep, will see can fix before merging

@SuaYoo SuaYoo self-requested a review December 3, 2021 17:57
@ikreymer ikreymer merged commit 05c1129 into main Dec 3, 2021
@ikreymer ikreymer deleted the frontend-backend-combine branch December 7, 2021 05:34
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.

None yet

2 participants