Skip to content

External JS/CSS libs via CDNs where possible #231

Description

@justb4

GHC uses several common external JS/CSS libs like Leaflet. These libs are downloaded and assembled during build time via paver setup. For several reasons it is more optimal to use hosted CDN-versions of these libs:

  • in general faster loading (optimized CDNs, multiple origins)
  • less complex build, also in case of partial failures
  • easier to move to PyPi
  • no silent failures in Docker builds

For the latter it appeared today some libs (select2 and Leaflet) were missing in the Docker image running https://demo.geohealthcheck.org. Inspecting the Build on Docker Hub revealed:

---> pavement.setup
mkdir path('/GeoHealthCheck/instance')
mkdir path('/GeoHealthCheck/instance/data')
copy path('/GeoHealthCheck/GeoHealthCheck/config_main.py') path('/GeoHealthCheck/instance/config_site.py')
pip install -r requirements.txt
move path('/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-3.3.7-1/dist') path('/GeoHealthCheck/GeoHealthCheck/static/lib/dist')
move path('/GeoHealthCheck/GeoHealthCheck/static/lib/startbootstrap-sb-admin-2-3.3.7-1/vendor') path('/GeoHealthCheck/GeoHealthCheck/static/lib/vendor')
Traceback (most recent call last):
File "/venv/lib/python2.7/site-packages/paver/tasks.py", line 201, in _run_task
return do_task()
File "/venv/lib/python2.7/site-packages/paver/tasks.py", line 198, in do_task
return func(**kw)
File "pavement.py", line 117, in setup
zipstr = StringIO(urlopen(select2).read())
File "/usr/local/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python2.7/urllib2.py", line 435, in open
response = meth(req, response)
File "/usr/local/lib/python2.7/urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python2.7/urllib2.py", line 473, in error
return self._call_chain(*args)
File "/usr/local/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.7/urllib2.py", line 556, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 502: Bad Gateway

This may be due to some temporary failure on either Docker Hub or else. Triggering a new build with same GH version on DockerHub rendered success.

Also JQueryUI is currently part of GHC in GitHub and needs to be moved as well to a CDN version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions