-
Notifications
You must be signed in to change notification settings - Fork 12
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
serve static files from CDN #41
Comments
Note: Main data files (JSON) are already served from GCS storage, which scales extremely well. We can upload assets too, I guess? |
@hnykda I am checking the deploy action in pythonapp.yml. I should add the gsutil cp there? I will need some more description :) |
Yes, it should be there on a deploy step. The command is IMO equivalent to the `push_to_bucket The hard part seems to be actually rendering templates with different static URL paths for static files (I asked about it here encode/starlette#884). In the first case, I propose to use something like:
|
@jez4 I just realized that I did something in the past (it's not in master anymore): https://github.com/epidemics/covid/pull/122/files ^ you IMO want to take this and move it to the deploy branch only (so it's iterated only on deploy) and in addition of setting that public access and cache control actually uploading everything gzipped. |
I should use {{ STATIC_URL }} for templates |
I have managed to upload static files to the bucket gzipped. Now the templates. |
The templates are done. Now just to perfect the workflow. I will ask for review afterwards. |
Closed via #333 |
Only if it's actually needed. We could reduce some load on the server if we hosted the static files elsewhere (JS and CSS). That would reduce responsivness of the site (userfriendlines) and reduce cost on compute cost and egress between the client and the server.
https://epidemicforecasting.slack.com/archives/C0100EK7N8N/p1584518497196200?thread_ts=1584472523.152600&cid=C0100EK7N8N
Solution:
gsutil cp -Z -a <somecacheheaders as in epifor> ...
step which would take the content ofsrc/server/static
and upload it to the bucket (for staging and production independently), ideally two way syncstatic_url
to be served from GCS in deployments, maintain the file serving locally, that likely means dealing withurl_for
, maybe https://fastapi.tiangolo.com/tutorial/static-files/ and changing url_for from/static
to something likehttps://storage.googleapis.com/static-covid/static/
The text was updated successfully, but these errors were encountered: