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

Serve static pages from app.yaml #6974

Merged
merged 22 commits into from
Jul 6, 2019
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0bc53bb
create render template method
jameesjohn Jun 19, 2019
df266a2
address review comments
jameesjohn Jun 21, 2019
8b63d34
Merge branch 'develop' of https://github.com/oppia/oppia into static-…
jameesjohn Jun 21, 2019
9106197
address review comments
jameesjohn Jun 21, 2019
6d2cdb9
fix error due to merge
jameesjohn Jun 21, 2019
77fc41d
address review comments
jameesjohn Jun 22, 2019
e3f24b7
serve statics files from app.yaml
jameesjohn Jun 23, 2019
fff201a
address review comments
jameesjohn Jun 24, 2019
9baa459
more on review comments and test issue
jameesjohn Jun 24, 2019
3458a6b
Merge branch 'develop' of https://github.com/oppia/oppia into static-…
jameesjohn Jun 29, 2019
6df30d8
add hases to files in app.yaml
jameesjohn Jun 29, 2019
a209b4e
Merge branch 'develop' of https://github.com/oppia/oppia into static-…
jameesjohn Jul 2, 2019
7ccbf19
create dev app.yaml and prod app.yaml as well as write tests for the …
jameesjohn Jul 3, 2019
04bd338
address review comments and revert package-lock.json
jameesjohn Jul 3, 2019
f27d23b
address review comments
jameesjohn Jul 4, 2019
c6617b5
revert change in constants
jameesjohn Jul 4, 2019
81922b9
remove app.yaml
jameesjohn Jul 4, 2019
9104bca
work on failing e2e tests
jameesjohn Jul 5, 2019
abddd81
fix lint issues
jameesjohn Jul 5, 2019
33c6f79
revert package-lock.json
jameesjohn Jul 5, 2019
d99be7c
Merge branch 'develop' of https://github.com/oppia/oppia into static-…
jameesjohn Jul 6, 2019
bd7eca5
remove other variants of splash page
jameesjohn Jul 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@

# Speed Improvement team.
/app.yaml @vojtechjelinek @seanlip
/app_dev.yaml @vojtechjelinek @seanlip
/core/templates/dev/head/base_components/ @jamesjay4199 @vojtechjelinek
/core/templates/dev/head/pages/Base.ts @vojtechjelinek @seanlip
/core/templates/dev/head/pages/base.html @vojtechjelinek @seanlip
Expand Down
61 changes: 58 additions & 3 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ runtime: python27
api_version: 1
Copy link
Member

Choose a reason for hiding this comment

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

Per our discussion, let's just have one app.yaml file in the codebase so that there's a single source of truth.

@vojtechjelinek FYI we discussed having a template file from which to generate dev/prod, but then we figured that it would be better to just have the "dev" version in the codebase (as we do now) and then do the changes needed to transform it to the "prod" version (like we do with other files/folders). This means that we only have one indirectly-generated file rather than two (which is better, since indirect pipelines like this often lead to errors).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seanlip, should this file still be in the codebase?

Copy link
Member

Choose a reason for hiding this comment

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

No, I don't think so.

threadsafe: false
instance_class: F2
# The "version" line is added here so that MR jobs can run locally (see issue
# #6534 on oppia/oppia).
version: default

builtins:
- appstats: on
Expand Down Expand Up @@ -137,6 +134,64 @@ handlers:
login: admin
script: main_mail.app
secure: always

# STATIC PAGES.
- url: /get_started
static_files: build/templates/head/dist/get-started-page.mainpage.html
upload: build/templates/head/dist/get-started-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /splash
static_files: build/templates/head/dist/splash-page.mainpage.html
upload: build/templates/head/dist/splash-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /splash?c=at0
static_files: build/templates/head/dist/splash_at0.html
upload: build/templates/head/dist/splash_at0.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /splash?c=at1
static_files: build/templates/head/dist/splash_at1.html
upload: build/templates/head/dist/splash_at1.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /teach
static_files: build/templates/head/dist/teach-page.mainpage.html
upload: build/templates/head/dist/teach-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
jameesjohn marked this conversation as resolved.
Show resolved Hide resolved
jameesjohn marked this conversation as resolved.
Show resolved Hide resolved

- url: /.*
script: main.app
secure: always
Expand Down
296 changes: 296 additions & 0 deletions app_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
runtime: python27
api_version: 1
threadsafe: false
instance_class: F2
# The "version" line is added here so that MR jobs can run locally (see issue
# #6534 on oppia/oppia).
version: default

builtins:
- appstats: on
- deferred: on
- remote_api: on

inbound_services:
- warmup
- mail

default_expiration: "10m"
handlers:
# PRODUCTION STATIC
- url: /favicon.ico
static_files: assets/favicon.ico
upload: assets/favicon.ico
secure: always
- url: /robots.txt
static_files: assets/robots.txt
upload: assets/robots.txt
secure: always
- url: /sitemap.xml
static_files: assets/sitemap.xml
upload: assets/sitemap.xml
secure: always
- url: /mapreduce/pipeline/images
static_dir: third_party/gae-mapreduce-1.9.22.0/mapreduce/lib/pipeline/ui/images
secure: always
- url: /build
static_dir: build
secure: always
expiration: "90d"
- url: /third_party/static
static_dir: third_party/static
secure: always
expiration: "90d"

# DEVELOPMENT STATIC
- url: /dist
static_dir: core/templates/dev/head/dist
secure: always
application_readable: true
expiration: "0"
- url: /assets
static_dir: assets
secure: always
application_readable: true
expiration: "0"
# Serve js scripts and css files under core/templates/dev/head.
# This regex allows us to recursively serve js scripts.
# "\1" inserts text captured by the capture group in the URL pattern.
- url: /templates/dev/head/(.*\.(css))$
static_files: core/templates/dev/head/\1
upload: core/templates/dev/head/(.*\.(css))$
secure: always
expiration: "0"
- url: /templates/dev/head/(.*\.(js))$
static_files: local_compiled_js/core/templates/dev/head/\1
upload: local_compiled_js/core/templates/dev/head/(.*\.(js))$
secure: always
expiration: "0"
- url: /templates/dev/head/(.*\.(html))$
static_files: core/templates/dev/head/\1
upload: core/templates/dev/head/(.*\.(html))$
secure: always
expiration: "0"
application_readable: true
- url: /third_party/generated
static_dir: third_party/generated
secure: always
expiration: "0"
- url: /extensions/interactions/(.*)/static/(.*\.(css|png))
static_files: extensions/interactions/\1/static/\2
upload: extensions/interactions/(.*)/static/(.*\.(css|png))
secure: always
expiration: "0"
- url: /extensions/interactions/(.*)/static/(.js)
static_files: extensions/interactions/\1/static/\2
upload: local_compiled_js/extensions/interactions/(.*)/static/(.js)
secure: always
expiration: "0"
- url: /extensions/(interactions|rich_text_components)/(.*)/directives/(.*\.(html))
static_files: extensions/\1/\2/directives/\3
upload: extensions/(interactions|rich_text_components)/(.*)/directives/(.*\.(html))
secure: always
expiration: "0"
# Serve js scripts for gadgets, interactions, rich_text_components, custom ckeditor plugins
# and objects under extensions in dev mode. This regex allows us to recursively serve js
# scripts under the three specified directories. "\1" and "\2" insert capture
# groups from the url pattern.
- url: /extensions/(interactions|rich_text_components|objects|classifiers|ckeditor_plugins)/(.*\.(png))$
static_files: extensions/\1/\2
upload: extensions/(interactions|rich_text_components|objects|classifiers|ckeditor_plugins)/(.*\.(png))$
secure: always
expiration: "0"
- url: /extensions/(interactions|rich_text_components|objects|classifiers|ckeditor_plugins)/(.*\.(js))$
static_files: local_compiled_js/extensions/\1/\2
upload: local_compiled_js/extensions/(interactions|rich_text_components|objects|classifiers|ckeditor_plugins)/(.*\.(js))$
secure: always
expiration: "0"
- url: /extensions/visualizations/(.*\.html)
static_files: extensions/visualizations/\1
upload: extensions/visualizations/(.*\.html)
secure: always
expiration: "0"
- url: /extensions/objects/templates/(.*\.html)
static_files: extensions/objects/templates/\1
upload: extensions/objects/templates/(.*\.html)
secure: always
expiration: "0"

# DYNAMIC
- url: /mapreduce(/.*)?
script: mapreduce.main.APP
login: admin
secure: always
- url: /mapreduce/worker(/.*)?
script: mapreduce.main.APP
login: admin
secure: always
- url: /cron/.*
login: admin
script: main_cron.app
secure: always
- url: /task/.*
login: admin
script: main_taskqueue.app
secure: always
- url: /_ah/mail/.*
login: admin
script: main_mail.app
secure: always

# STATIC PAGES.
- url: /get_started
static_files: core/templates/dev/head/dist/get-started-page.mainpage.html
upload: core/templates/dev/head/dist/get-started-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /splash
static_files: core/templates/dev/head/dist/splash-page.mainpage.html
upload: core/templates/dev/head/dist/splash-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /splash?c=at0
static_files: core/templates/dev/head/dist/splash_at0.html
upload: core/templates/dev/head/dist/splash_at0.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /splash?c=at1
static_files: core/templates/dev/head/dist/splash_at1.html
upload: core/templates/dev/head/dist/splash_at1.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"
- url: /teach
static_files: core/templates/dev/head/dist/teach-page.mainpage.html
upload: core/templates/dev/head/dist/teach-page.mainpage.html
http_headers:
Pragma: no-cache
Strict-Transport-Security: 'max-age=31536000; includeSubDomains'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: '1; mode=block'
secure: always
expiration: "0"

- url: /.*
script: main.app
secure: always

libraries:
- name: jinja2
version: '2.6'
- name: PIL
version: '1.1.7'
# This is needed for sending requests to a mailgun HTTPS URL.
- name: ssl
version: '2.7.11'
- name: webapp2
version: '2.5.2'

env_variables:
PYTHONHTTPSVERIFY: 1

skip_files:
# .pyc and .pyo files
- ^(.*/)?.*\.py[co]$
# Unix hidden files whose names begin with a dot
- ^(.*/)?\..*$
# Karma test files
- ^(.*/)Spec.js$
# Typescript files
- ^(.*/)?.*\.ts$
# Typescript output log file
- ^(.*/)tsc_output_log.txt$
# Other folders to ignore
- tests/
- scripts/
- integrations/
- integrations_dev/
- node_modules/
# Some third_party static scripts are directly imported, namely: jquery,
# jqueryui, angularjs, jqueryui-touch-punch, MathJax, code-mirror,
# ui-codemirror, d3js, midi-js, ui-map, guppy, skulpt, math-expressions.
# We exclude some of the scripts that are not directly imported in order to
# reduce deployed file count.
# TODO(sll): Find a more structured way of doing this.
- third_party/static/angular-audio-1.7.4
- third_party/static/angular-scroll-1.0.0
- third_party/static/angular-toastr-1.7.0
- third_party/static/bower-material-0.6.0-rc1
- third_party/static/fontawesome-free-5.8.1-web
- third_party/static/guppy-b5055b/site
- third_party/static/guppy-b5055b/test
- third_party/static/MathJax-2.7.5/docs
- third_party/static/MathJax-2.7.5/fonts
- third_party/static/MathJax-2.7.5/localization/ast
- third_party/static/MathJax-2.7.5/localization/bcc
- third_party/static/MathJax-2.7.5/localization/bg
- third_party/static/MathJax-2.7.5/localization/br
- third_party/static/MathJax-2.7.5/localization/ca
- third_party/static/MathJax-2.7.5/localization/cdo
- third_party/static/MathJax-2.7.5/localization/cs
- third_party/static/MathJax-2.7.5/localization/cy
- third_party/static/MathJax-2.7.5/localization/da
- third_party/static/MathJax-2.7.5/localization/de
- third_party/static/MathJax-2.7.5/localization/eo
- third_party/static/MathJax-2.7.5/localization/es
- third_party/static/MathJax-2.7.5/localization/fa
- third_party/static/MathJax-2.7.5/localization/fi
- third_party/static/MathJax-2.7.5/localization/fr
- third_party/static/MathJax-2.7.5/localization/gl
- third_party/static/MathJax-2.7.5/localization/he
- third_party/static/MathJax-2.7.5/localization/ia
- third_party/static/MathJax-2.7.5/localization/it
- third_party/static/MathJax-2.7.5/localization/ja
- third_party/static/MathJax-2.7.5/localization/kn
- third_party/static/MathJax-2.7.5/localization/ko
- third_party/static/MathJax-2.7.5/localization/lb
- third_party/static/MathJax-2.7.5/localization/lki
- third_party/static/MathJax-2.7.5/localization/lt
- third_party/static/MathJax-2.7.5/localization/mk
- third_party/static/MathJax-2.7.5/localization/nl
- third_party/static/MathJax-2.7.5/localization/oc
- third_party/static/MathJax-2.7.5/localization/pl
- third_party/static/MathJax-2.7.5/localization/pt
- third_party/static/MathJax-2.7.5/localization/pt-br
- third_party/static/MathJax-2.7.5/localization/qqq
- third_party/static/MathJax-2.7.5/localization/ru
- third_party/static/MathJax-2.7.5/localization/scn
- third_party/static/MathJax-2.7.5/localization/sco
- third_party/static/MathJax-2.7.5/localization/sl
- third_party/static/MathJax-2.7.5/localization/sv
- third_party/static/MathJax-2.7.5/localization/tr
- third_party/static/MathJax-2.7.5/localization/uk
- third_party/static/MathJax-2.7.5/localization/vi
- third_party/static/MathJax-2.7.5/localization/zh-hans
- third_party/static/MathJax-2.7.5/test
- third_party/static/MathJax-2.7.5/unpacked
- third_party/static/messageformat-2.0.5
- third_party/static/ng-img-crop-0.3.2
- third_party/static/nginfinitescroll-1.0.0
- third_party/static/perfectscrollbar-0.6.16
- third_party/static/rangy-1.3.0
- third_party/static/widget
4 changes: 2 additions & 2 deletions core/controllers/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ def mock_get_current_time(unused_cls):
def test_redirect_oppia_test_server(self):
# The old demo server redirects to the new demo server.
self.get_html_response(
'https://oppiaserver.appspot.com/splash', expected_status_int=301)
'https://oppiaserver.appspot.com/about', expected_status_int=301)
self.get_html_response(
'https://oppiatestserver.appspot.com/splash')
'https://oppiatestserver.appspot.com/about')


class EscapingTests(test_utils.GenericTestBase):
Expand Down
Loading