OpenEnergyPlatform / oeplatform

Repository for the code of the Open Energy Platform (OEP) website. The OEP provides an interface to the Open Energy Family
http://openenergyplatform.org/
GNU Affero General Public License v3.0
61 stars 19 forks source link

Licence file not found during install #1638

Closed ebroda closed 1 month ago

ebroda commented 1 month ago

This is about missing or wrong documentation of the install process. I'll provide a draft pull request about my findings, as far as I can do it afterwards and as it runs for me from a green field.

Description of the issue

After getting oeplatform to run in Docker, I now wanted it to run locally. So I created a venv for oeplatform and followed the instructions given in Installation.

I want to have the database in Docker, but the oeplatform locally.

Now I got stuck in step 3.2.1 Django setup.

(oep-venv) brd@x:~/OEP$ python manage.py migrate
ERROR:root:The licenses files was not found in /home/[...]/OEP/static/data_licenses/licenses.json
Traceback (most recent call last):
[...]
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/[...]/OEP/login/urls.py", line 10, in <module>
    from login import views
  File "/home/[...]/OEP/login/views.py", line 29, in <module>
    from login.utilities import validate_open_data_license
  File "/home/[...]/OEP/login/utilities.py", line 49, in <module>
    LICENSES = create_license_id_set()
  File "/home/[...]/OEP/login/utilities.py", line 36, in create_license_id_set
    licenses = read_spdx_licenses_from_static()
  File "/home/[...]/OEP/login/utilities.py", line 31, in read_spdx_licenses_from_static
    raise e
  File "/home/[...]/OEP/login/utilities.py", line 24, in read_spdx_licenses_from_static
    with open(json_file_path, "r", encoding="utf-8") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/[...]/OEP/static/data_licenses/licenses.json'

As I know that the docker process works and builds a valid image, I had a look in Dockerfile and docker-entrypoint.sh and found the missing puzzle piece:

It's necessary to call before:

python manage.py collectstatic --noinput 

Afterwards it's fine:

(oep-venv) brd@x:~/OEP$ python manage.py collectstatic --noinput 

327 static files copied to '/home/[...]/OEP/static'.
(oep-venv) brd@x:~/OEP$ python manage.py alembic upgrade head
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
[...]

Took here alembic upgrade first, as it's given in docker/USAGE.md.

And, big point, to avoid #1622, step 4 (oeo) needs to be done in advance because else the collectstatic leads to an

ImportError: The oeo release files in '/home/[...]/OEP/ontologies/oeo' are missing! The app can`t start. Please refer to the documentation: https://openenergyplatform.github.io/oeplatform/install-and-documentation/install/installation/#4-setup-the-openenergyontology-integation

And then we have #1626 again, as

python manage.py compress

is missing in the docs.

Ideas of solution

Include missing term in documentation. I'll also continue to document problems and findings during the process.

Context and Environment

Workflow checklist

jh-RLI commented 1 month ago

I have just re-run the installation setps and also found the issues mentioned and more.

I chose the route with manual database installation and noticed that the postgresql+postGIS installation steps are not completely covered by the external links. I also had to set the password for the default database user "postgres" because otherwise no connection to the db could be established.

In addition to adding the missing terms, I will reorganise some paragraphs so that the user is smoothly guided through the links/steps for both options (the manual and Docker-based installation). As I will be giving an installation workshop tomorrow, I will work on it beforehand. :)

Thanks for the hint & your time!

ebroda commented 1 month ago

I added a few updates regarding docker in #1644, if these are merged, I think this issue can be closed.