Skip to content

Deploy Angular i18n #133

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

Closed
10 of 14 tasks
wg102 opened this issue Sep 20, 2022 · 6 comments · Fixed by StatCan/aaw-kubeflow-manifests#266
Closed
10 of 14 tasks

Deploy Angular i18n #133

wg102 opened this issue Sep 20, 2022 · 6 comments · Fixed by StatCan/aaw-kubeflow-manifests#266
Assignees
Labels
size/L 4-5 days

Comments

@wg102
Copy link
Contributor

wg102 commented Sep 20, 2022

This is the logical next step of the investigation made in #126

TODOs

Those were included in the original ticket but since not all of them got to fr

  • Take standalone example from repo and integrated it with jupyter-apis repo. Specifically, make k8s folder, taskfile, k3d config, etc. so that we can build jupyter-apis Dockerfile and test locally https://github.com/wg102/k3d-example.

  • Update jupyter-apis Dockerfile to include front-end build logic that aligns with KF 1.6 (i.e. ng build --localize=...). Specifically, we need to update the following lines: https://github.com/StatCan/jupyter-apis/blob/main/Dockerfile#L2-L17

  • Update jupyter-apis Dockerfile base image to be alpine instead of scratch. Reason is that we need to be able to use cp in init container to move static files into stock NGINX container. https://github.com/StatCan/jupyter-apis/blob/main/Dockerfile#L30

  • Remove static file serving logic from golang application (https://github.com/StatCan/jupyter-apis/blob/main/main.go#L250-L263) - reason is that NGINX static file server will handle this concern.

  • Update the jupyter-apis deployment (https://github.com/StatCan/aaw-kubeflow-manifests/blob/aaw-dev-cc-00/kustomize/apps/jupyter-web-app/base/deployment.yaml) to reflect the deployment strategy used in https://github.com/StatCan/aws-js-s3-explorer/blob/main/k8s/s3proxy-deploy.yaml. Specifically:

    • Need to add a stock NGINX container that will serve the application built in the dist folder.
    • Need to add an init container based off of the refactored jupyter-apis Docker image - the purpose of this is to do a recursive copy of the dist static files onto the /etc/nginx/html location of the nginx container (this is the default place that nginx serves static files from).
    • Need to add empty volume that gets mounted to both init container and nginx container.
    • Need to do one of the following:
      • Update the jupyter-apis service so that it forwards traffic to port 80 (or whatever port NGINX listens on by default) on pods behind that service; or
      • Update the NGINX container to serve on port 5000 so that the existing jupyter-web-app-service will continue to forward to the correct port.
    • Apply nginx configuration to the deployment as a configmap that gets mounted to the nginx container as a volume to /etc/nginx/nginx.conf
  • Change anything that references /en or /fr to /jupyter/en and /jupyter/fr because in central dashboard we will access this via /jupyter prefix.

Testing TODO

  • Can we successfully run the 2-container pod (NGINX and golang API) locally (i.e. all AJAX calls from browser are successful, i18n routing works correctly).

Steps:

  1. Get k3d deployment working with manual port-forward on pod.
  2. Modify service so that we are forwarding to the right port (the one ngx in listening on by default, prob 8080)
  3. Refactor aaw kubeflow manifest deployment, to reflect our local k8s manifest folder
  4. Testing against dev.
@wg102
Copy link
Contributor Author

wg102 commented Sep 20, 2022

The current work can be seen in branch https://github.com/StatCan/jupyter-apis/tree/fix-i18n-angular

There is currently an issue that the i18n files needed suche as messages.xlf are not in the right location.

@wg102 wg102 added the size/L 4-5 days label Sep 20, 2022
@wg102
Copy link
Contributor Author

wg102 commented Sep 21, 2022

The image with the jwa + backend seems to finally build. Now it will be to test it locally to try and see if I can use port-forward on local

@wg102
Copy link
Contributor Author

wg102 commented Oct 3, 2022

Trying to figure out how to redirect the url when the api is called so it doesn't send the api call with a /fr or /en suffix. Using this site to test out the result https://nginx.viraptor.info//

rewrite ^/(fr|en)/api/(.*)$ /api/$2 seems to give the expected result on https://nginx-playground.wizardzines.com/

@wg102 wg102 mentioned this issue Oct 5, 2022
@wg102
Copy link
Contributor Author

wg102 commented Oct 5, 2022

We will need to add code to force the en-US to en and such

@wg102
Copy link
Contributor Author

wg102 commented Oct 12, 2022

The Pr for the manifest is ready.

@wg102
Copy link
Contributor Author

wg102 commented Oct 19, 2022

(Adding Collin to reflect his work on this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L 4-5 days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants