iris-edu / yasmine-stationxml-editor

GNU General Public License v3.0
13 stars 4 forks source link

Resolves #3 #6

Closed autumnjohnson closed 2 years ago

fabienengels commented 2 years ago

Hi,

I build the image using the following command :

docker build -t yasmine-backend .

Then launched the container with the following command :

docker run -it --rm -p 8080:80 yasmine-backend

Then I tried to access the web server using my browser (http://127.0.0.1:8080) and I got a blank page. Looking at the logs, I see a 404 error :

2022-03-08 09:24:23,428 - ERROR - web - Could not open static file '/opt/YASMINE/src/yasmine/static/js/yasmine/microloader.js'
ERROR:tornado.general:Could not open static file '/opt/YASMINE/src/yasmine/static/js/yasmine/microloader.js'

The absence of the file is confirmed by the following test :

>> docker run -it --rm -p 8080:80 yasmine-backend sh
ls -l /opt/YASMINE/src/yasmine/static/js/yasmine/microloader.js
ls: cannot access '/opt/YASMINE/src/yasmine/static/js/yasmine/microloader.js': No such file or directory

The file isn't present in the reposotiry either :

yasmine-stationxml-editor on  test (052f41b9) took 1m20s 
>> find . -name microload.js

I hope I didn't make any mistake in the way I tested as it's the first time I try this project :)

jmsaurel commented 2 years ago

Hello Fabien,

I build the image using the following command :

docker build -t yasmine-backend .

Then launched the container with the following command :

docker run -it --rm -p 8080:80 yasmine-backend

I think those are the instructions to run Yasmine in development mode (used by ISTI dev team) and that you should first compile the frontend which should provide the missing js codes (see Readme in frontend directory).

To run Yasmine in production mode with docker, can you try using the instruction from the upper-level README ? https://github.com/iris-edu/yasmine-stationxml-editor/tree/fix-for-install-failure#installation-using-docker

fabienengels commented 2 years ago

Hi Jean Marie :)

The upper README says nothing about compiling the frontend files in the Docker part or I miss something :) :

### Installation using Docker
1. Install [Docker Engine](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/5)
2. Run `docker-compose up` to build and run the docker containers
3. Visit <http://localhost:1841>
3. Run `docker-compose down` to stop

And it's just about how you launch the containers via Docker compose (which will build the backend image the same way I did).

If the frontend files need to be compiled, I would suggest to add this compilation inside the Dockerfile directly.

jschaeff commented 2 years ago

I hit an error when docker tries to install obspy. Usually, to avoid this, I build obspy in a previous Docker stage, along all python deps. It makes the final image a bit smaller. I'm preparing a PR.

fabienengels commented 2 years ago

I hit an error when docker tries to install obspy. Usually, to avoid this, I build obspy in a previous Docker stage, along all python deps. It makes the final image a bit smaller. I'm preparing a PR.

Isn't something related to your setup ? I had no issue building the image

jschaeff commented 2 years ago

Sorry for the mess in the PR ... Th commit 5e12d61f fixes obspy build. The app seems to work on localhost:1841 but I have to wait a long time before it gets clickable. Then each click ends with an error. Logs do only show:

 yasmine-frontend  | [WRN] java.net.UnknownHostException
fabienengels commented 2 years ago

Maybe it should be better to test in the actual state before jumping from Python 3.6 to 3.10 which may breaks other things and should be a Merge Request on its own.

jmsaurel commented 2 years ago

Sorry, I didn't had time to follow all your conversation (and thanks @fabienengels and @jschaeff for looking at this)

If the frontend files need to be compiled, I would suggest to add this compilation inside the Dockerfile directly.

Here are the instructions to compile the frontend. https://github.com/iris-edu/yasmine-stationxml-editor/tree/main/frontend#using-docker Before compiling the backend.

fabienengels commented 2 years ago

Here are the instructions to compile the frontend. https://github.com/iris-edu/yasmine-stationxml-editor/tree/main/frontend#using-docker Before compiling the backend.

It confirms that the README should be updated or compilation be added to the Docker build process. Unfortunately, on my setup, my sencha is too up to date to test, I got the following error :

>> sencha app build
Sencha Cmd v7.4.0.39
[INF] Using GPL version of Ext JS version 6.2.0.981 from /home/fabien/yasmine-stationxml-editor/frontend/ext.
[INF] The implications of using GPL version can be found here (http://www.sencha.com/products/extjs/licensing).
[INF] Processing Build Descriptor : classic (production environment)

[ERR] /opt/Sencha/Cmd/7.4.0.39/plugin.xml:333: The following error occurred while executing this line:
/home/fabien/yasmine-stationxml-editor/frontend/.sencha/app/init-impl.xml:19: Unable to create javax script engine for javascript
[ERR] A log is available in the file "/home/fabien/yasmine-stationxml-editor/frontend/sencha-error-20220308.log"
[ERR] 
[ERR] The application was last modified by an older version of Sencha Cmd (6.5.3.6).
[ERR] Running "sencha app upgrade" may resolve the error described above.
[ERR] 
autumnjohnson commented 2 years ago

Hello,

The changes to docker-compose.yml included explicit references to both the frontend and backend Dockerfiles. My intention was that these images need not be built individually to enforce consistency; instead, a single docker-compose up should be used as detailed here: https://github.com/iris-edu/yasmine-stationxml-editor/tree/fix-for-install-failure#installation-using-docker.

It looks like some of these comments include references to instructions used in the main branch, which might mean you were attempting to build the "old" code and not that from this pull request. Could you please clarify what errors you were experiencing when building the fix-for-install-failure branch with a single docker-compose up?

jmsaurel commented 2 years ago

Hello @autumnjohnson ,

I just tested the docker compose on the fix-for-install-failure branch and it fails on my computer (Debian 11, docker-compose freshly installed from the Debian repo).

Here is the error I have when running docker-compose up

ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

And here is the result of the command docker-compose version

docker-compose version 1.25.0, build unknown

docker-py version: 4.1.0

CPython version: 3.9.2

OpenSSL version: OpenSSL 1.1.1k  25 Mar 2021
autumnjohnson commented 2 years ago

Hi @jmsaurel,

It appears that the docker-compose version you are using is older than the one specified in the docker-compose.yml file (i.e. 3.8). I removed the version attribute from this file as it is not required and pushed the change. You could pulling the latest changes to the fix-for-install-failure branch and give docker-compose up another try.

However, it now appears that the test test_app is no longer succeeding. I am not sure why because I have not made changes that would have affected that since the last successful run. I will continue looking into this as these tests should be passing.

Thanks, Autumn Johnson

jmsaurel commented 2 years ago

Hi @autumnjohnson ,

I pulled your modifs and retried the doker-compose up command. I have new errors now, and it still doesn't compose, the yml file is still invalid.

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for networks: 'yasmine'
Unsupported config option for volumes: 'yasmine-backend'
Unsupported config option for services: 'yasmine-backend'

Regarding the CI test_app error, this is not related to your modifications, but from Résif modifications on the AROL repository. It's probably a setting that I didn't updated in this branch.

autumnjohnson commented 2 years ago

Hi @jmsaurel,

I checked out the main branch and my previous errors building the docker-compose.yml file are no longer there; this is good news. If building the docker-compose.yml file from the main branch works for you, then I am going to close this pull request with no modifications.

Instead, I will create a new pull request that includes the more minor improvements from this request such as an additional test in the GitHub workflow file and formatting improvements to the READMEs.

Finally, I will move on to implementing installation with conda (as opposed Pythons venv and pip) if this change is still desired and/or required for Windows users in particular.

Thanks, Autumn Johnson

autumnjohnson commented 2 years ago

Hi @jmsaurel,

Some updates to my previous comment:

It does appear that some additional changes from this request are required to build the docker-compose.yml file on GitHub. I will also include those changes in the other pull request mentioned.

In fact, these changes are actually required on my machine as well. I believe I had been using a cached docker-compose image, which is why it appeared to work after I pulled the main branch.

To ensure I understand the situation here: does the docker-compose.yml file from the main branch build successfully on your machine?

jmsaurel commented 2 years ago

To ensure I understand the situation here: does the docker-compose.yml file from the main branch build successfully on your machine?

@autumnjohnson : no it don't build successfully yet when working from the main branch.

It does a lot of things, but finally fails on building obspy, apparently on GSE format support.

docker-compose up

...
  Building wheel for obspy (pyproject.toml): started
  Building wheel for obspy (pyproject.toml): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp2gxj82s7
       cwd: /tmp/pip-install-r7o7ju2o/obspy_8e8d9fd3869b46a8862a711f1fb0db84
...
  error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-vjv09hwh/overlay/lib/python3.6/site-packages/numpy/core/include -I/usr/local/include/python3.6m -c obspy/io/gse2/src/GSE_UTI/gse_functions.c -o build/temp.linux-x86_64-3.6/obspy/io/gse2/src/GSE_UTI/gse_functions.o -MMD -MF build/temp.linux-x86_64-3.6/obspy/io/gse2/src/GSE_UTI/gse_functions.o.d" failed with exit status 127
  ----------------------------------------
  ERROR: Failed building wheel for obspy
...
ERROR: Could not build wheels for obspy, which is required to install pyproject.toml-based projects
ERROR: Service 'yasmine-backend' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
rcasey-earthscope commented 2 years ago
Hi Jean-Marie-

I am very happy to see you and Autumn working together on this.

Is there a good reason for us to have compilable C code for these packages?  Unless you can constrain your C compilation to a very specific version of gcc and operating system, these gcc (ostensibly 'make') builds can see a lot of variability in terms of what will actually compile and link.

If it is a necessity, and it cannot be confined to a container, we will have to make sure that all major Linux operating systems and generations of gcc will build the source code.

Comments?

-Rob

On Apr 6, 2022, at 8:59 AM, Jean-Marie SAUREL @.***> wrote:

To ensure I understand the situation here: does the docker-compose.yml file from the main branch build successfully on your machine?

@autumnjohnson https://github.com/autumnjohnson : no it don't build successfully yet when working from the main branch.

It does a lot of things, but finally fails on building obspy, apparently on GSE format support.

docker-compose up

... Building wheel for obspy (pyproject.toml): started Building wheel for obspy (pyproject.toml): finished with status 'error' ERROR: Command errored out with exit status 1: command: /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp2gxj82s7 cwd: /tmp/pip-install-r7o7ju2o/obspy_8e8d9fd3869b46a8862a711f1fb0db84 ... error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-vjv09hwh/overlay/lib/python3.6/site-packages/numpy/core/include -I/usr/local/include/python3.6m -c obspy/io/gse2/src/GSE_UTI/gse_functions.c -o build/temp.linux-x86_64-3.6/obspy/io/gse2/src/GSE_UTI/gse_functions.o -MMD -MF build/temp.linux-x86_64-3.6/obspy/io/gse2/src/GSE_UTI/gse_functions.o.d" failed with exit status 127

ERROR: Failed building wheel for obspy ... ERROR: Could not build wheels for obspy, which is required to install pyproject.toml-based projects ERROR: Service 'yasmine-backend' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1

— Reply to this email directly, view it on GitHub https://github.com/iris-edu/yasmine-stationxml-editor/pull/6#issuecomment-1090437654, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFL4VN6HXKQGJFLV5JBGBUTVDWYGJANCNFSM5P6UO2TQ. You are receiving this because your review was requested.

autumnjohnson commented 2 years ago

Hi @jmsaurel,

The reason it fails with obspy is because obspy requires gcc to install. Please refer to the pull request for the branch add-docker-compose-test-to-gh-workflow I just initiated, which resolves this error. As soon as you confirm, I will close this pull request without merging.

Moreover, I recommend the following:

  1. Update the docker-compose or docker-engine installation on your machine to the latest version. You are using version 1.25.0 which is quite old.
  2. Run docker-compose down to ensure old containers are stopped
  3. Before you run docker-compose up, run docker-compose build --no-cache to ensure you are working with a clean installation
  4. And, finally, note the new pull request refers to the branch add-docker-compose-test-to-gh-workflow, so pull that instead. Once I close this pull request, this branch will be deleted.
jmsaurel commented 2 years ago

Hi @rcasey-iris , as Autumn says, the C compilation is only an obspy dependency on some modules that we don't use in yasmine. This doesn't upset me too much an shouldn't be a problem.

@autumnjohnson, I tried the branch add-docker-compose-test-to-gh-workflow following your instructions and the compilation seem to have been successful. I switch to that PR for follow-up discussion.