abelardopardo / ontask_b

A platform offering teachers and educational designers the capacity to use data to personalise the learner experience.
https://ontasklearning.org
MIT License
41 stars 36 forks source link

During deployment of V6.0.1 several static resources were in the wrong root. #167

Closed firewuff closed 4 years ago

firewuff commented 4 years ago

Post deploy several directories of static content were located in the wrong location. This appears to be related to recent changes in the structure of the directories. There were no errors encountered during the deploy but it was apparent from missing CSS/ scripts that this had occured. it was worked around by symlinking the directories (below). Deployment scripts probably need updating to gather the static content in the correct directory.

Essentially all directories in /site/static/ needed to be symlinked to <ontask_base_dir/static/

` root@task:/opt/ontask/static# lrwxrwxrwx 1 ontask ontask 31 Sep 20 15:54 action -> /opt/ontask/site/static/action/ lrwxrwxrwx 1 ontask ontask 29 Sep 20 15:54 admin -> /opt/ontask/site/static/admin lrwxrwxrwx 1 ontask ontask 50 Sep 20 15:54 bootstrap_datepicker_plus -> /opt/ontask/site/static/bootstrap_datepicker_plus/ lrwxrwxrwx 1 ontask ontask 32 Sep 20 15:54 dataops -> /opt/ontask/site/static/dataops/ lrwxrwxrwx 1 ontask ontask 40 Sep 20 15:54 django_auth_lti -> /opt/ontask/site/static/django_auth_lti/ lrwxrwxrwx 1 ontask ontask 42 Sep 20 15:54 django_extensions -> /opt/ontask/site/static/django_extensions/ lrwxrwxrwx 1 ontask ontask 39 Sep 20 15:54 django_tables2 -> /opt/ontask/site/static/django_tables2/ lrwxrwxrwx 1 ontask ontask 38 Sep 20 15:54 import_export -> /opt/ontask/site/static/import_export/ lrwxrwxrwx 1 ontask ontask 27 Sep 20 15:54 js -> /opt/ontask/site/static/js/ lrwxrwxrwx 1 ontask ontask 39 Sep 20 15:54 rest_framework -> /opt/ontask/site/static/rest_framework/ drwxr-xr-x 6 ontask ontask 49 Sep 14 20:10 site lrwxrwxrwx 1 ontask ontask 35 Sep 20 15:55 summernote -> /opt/ontask/site/static/summernote/ lrwxrwxrwx 1 ontask ontask 30 Sep 20 15:55 table -> /opt/ontask/site/static/table/ lrwxrwxrwx 1 ontask ontask 33 Sep 20 15:54 workflow -> /opt/ontask/site/static/workflow/

`

abelardopardo commented 4 years ago

Hi @firewuff

Are you sure about this problem? Currently there are two possible scenarios:

1) The server is running in development with DEBUG=True in the env file (in this case, the static files are served by django's appilcation django.contrib.staticfiles.

2) The server is running in production. In this case the Web server (Apache, nginx or similar) needs to be configured so that the URL defined in STATIC_URL serves directly a folder with the content in /site/static

If the server is running using 'runserver' with DEBUG=False, the static files are not served with the right application and the URLs are not found. I wonder if this could be your case?

firewuff commented 4 years ago

@abelardopardo The server was running in production and the WebServer configured correctly. There are 2 paths in our installation /opt/ontask/static/site and /opt/ontask/site/static which seem to have a split of the required files, hence the need to Symlink.

root@task:/opt/ontask/static/site# ls css ico img js root@task:/opt/ontask/static/site# cd /opt/ontask/site/static/ root@task:/opt/ontask/site/static# ls action bootstrap_datepicker_plus django_auth_lti django_tables2 js rest_framework site table admin dataops django_extensions import_export logs scheduler summernote workflow root@task:/opt/ontask/site/static#

abelardopardo commented 4 years ago

Ok. I'll look into this. None of our current deployments has shown this, but we need to look in more detail though.

abelardopardo commented 4 years ago

I am still struggling to replicate this error. In the upcoming version (candidate 6.1) I've rearranged the folders so that they don't have such confusing names, here is the final structure:

1) /static is a source folder. All files in there are under version control. None o these files should be accessed directly by the web server.

2) /site is an initially empty folder that is populated with the required files through the command "manage.py collectstatic" This folder and only the content on this folder should be the one accessed by the web server.

3) The content in /site folder is created by:

In your message you are saying that you need additional files in the folder /static. This means the server is pointing to that folder, to serve the static content, and it is incorrect. It should point to the folder /site/static

I hope this helps to clarify the glitch. If not, post again.