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

Problems with docker scripts #213

Open
blattms opened this issue Mar 18, 2024 · 16 comments · May be fixed by #214
Open

Problems with docker scripts #213

blattms opened this issue Mar 18, 2024 · 16 comments · May be fixed by #214

Comments

@blattms
Copy link
Member

blattms commented Mar 18, 2024

I am not sure what exactly is happening, but I cannot open the files using the docker scripts. It seems like they are not available there.

I I start the container and try to open main.fodt I get:

(venv) mblatt@frau-mahlzahn:~/opm-reference-manual$ lodocker-open-file-and-update parts/main.fodt 
INFO:werkzeug:172.17.0.1 - - [18/Mar/2024 08:50:11] "POST /open-document-and-update HTTP/1.1" 404 -
Failed to open document parts/main.fodt. Status code: 404
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual$ 

Before that I tried to do this with the script lodocker-run-container parts/main.fodt but the file is not found by libreoffice.

@hakonhagland
Copy link
Collaborator

@blattms Did you try with lodocker-run-container main.fodt ? The filename is relative to the parts folder

@hakonhagland
Copy link
Collaborator

The docker-container just mounts the parts from the host into /home/docker-user/parts in the container. So the container will not now what is the user's current directory on the host when he runs lodocker-run-container. That is why it made sense to have the filename be relative to parts in the container. @blattms Should we change this behavior? For example, if the user run lodocker-run-container parts/main.fodt from the root of the repository, the script could remove the parts when submitting the path to the container

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

Yes:

(venv) mblatt@frau-mahlzahn:~/opm-reference-manual$ lodocker-open-file-and-update main.fodt 
INFO:werkzeug:172.17.0.1 - - [18/Mar/2024 09:55:27] "POST /open-document-and-update HTTP/1.1" 404 -
Failed to open document main.fodt. Status code: 404
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual$ cd parts/
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual/parts$ lodocker-open-file-and-update main.fodt 
INFO:werkzeug:172.17.0.1 - - [18/Mar/2024 09:55:38] "POST /open-document-and-update HTTP/1.1" 404 -
Failed to open document main.fodt. Status code: 404
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual/parts$ 

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

cd ../docker/
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual/docker$ lodocker-run-container main.fodt 
Select a Dockerfile:
1. ubuntu2204-lo7.5.9
2. ubuntu2310-dev
Please enter an integer: 1
INFO:root:git_root: /home/mblatt/opm-reference-manual/venv/lib
access control disabled, clients can connect from any host

(soffice:45): dbind-WARNING **: 09:57:43.583: Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus_0: No such file or directory

(soffice:58): dbind-WARNING **: 09:57:43.976: Couldn't connect to accessibility bus: Failed to connect to socket /run/user/1000/at-spi/bus_0: No such file or directory

image

@hakonhagland
Copy link
Collaborator

$ lodocker-open-file-and-update main.fodt
INFO:werkzeug:172.17.0.1 - - [18/Mar/2024 09:55:27] "POST /open-document-and-update HTTP/1.1" 404 -
Failed to open document main.fodt. Status code: 404

@blattms Did you run lodocker-start-container first? lodocker-open-file-and-update will not work unless the container web server is running

@hakonhagland
Copy link
Collaborator

$ lodocker-open-file-and-update main.fodt

Note that last time we tried lodocker-open-file-and-update there was an issue with page numbers, see:

@blattms #108 (comment)

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

$ lodocker-open-file-and-update main.fodt
INFO:werkzeug:172.17.0.1 - - [18/Mar/2024 09:55:27] "POST /open-document-and-update HTTP/1.1" 404 -
Failed to open document main.fodt. Status code: 404

@blattms Did you run lodocker-start-container first? lodocker-open-file-and-update will not work unless the container web server is running

It is running. The above message is from the server. I can use the browser to got to the page and get a 404 error. The error for a non-running server is different (e.g. can’t establish a connection to the server at localhost:8081.)

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

maybe I need to recreate the docker image because something changed?

@hakonhagland
Copy link
Collaborator

@blattms Yes, right. If the Dockerfile has changed or maybe also if the scripts used by it has changed since you last built the image?

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

Nope. I think it is related to the venv location (mine is normal subdirectory venv):

docker run -v /home/mblatt/opm-reference-manual/venv/lib/parts:/home/docker-user/parts -v /home/mblatt/opm-reference-manual/venv/lib/fonts:/usr/local/share/fonts:ro --rm -e DISPLAY=:0.0 -e LIBREOFFICE_PORT=2002 -e FLASK_PORT=8080 -e LIBREOFFICE_EXE=libreoffice -e LIBREOFFICE_USERDIR=.config/libreoffice/4 -p 8080:8080 -v /tmp/.X11-unix:/tmp/.X11-unix lo-ubuntu2204

Somehow it thinks that files are below venv/lib/-

@hakonhagland
Copy link
Collaborator

hakonhagland commented Mar 18, 2024

Somehow it thinks that files are below venv/lib/-

docker run -v /home/mblatt/opm-reference-manual/venv/lib/parts:/home/docker-user/parts -v /home/mblatt/opm-reference-manual/venv/lib/fonts:/usr/local/share/fonts:ro --rm -e DISPLAY=:0.0 -e LIBREOFFICE_PORT=2002 -e FLASK_PORT=8080 -e LIBREOFFICE_EXE=libreoffice -e LIBREOFFICE_USERDIR=.config/libreoffice/4 -p 8080:8080 -v /tmp/.X11-unix:/tmp/.X11-unix lo-ubuntu2204

@blattms Can you also share the error message you get from running that command?

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

There is no error message. There is an empty directory parts there.

I can fix this easily via removing the directory and putting a symbolic link there to the correct directory:

(venv) mblatt@frau-mahlzahn:~/opm-reference-manual/venv/lib$ rmdir parts/
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual/venv/lib$ ln -s ../../parts/
(venv) mblatt@frau-mahlzahn:~/opm-reference-manual/venv/lib$ cd ../../docker; lodocker-start-container

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

Maybe, this bogus directory was created when I ran lodocker-start-container in the top-level directory? That has to be run in docker subdirectory-

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

I removed venv and recreated it again. Problem persists.
Removed it again and created one in .venv: Problem persist.

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

The last message is probably the root of the problem when using a venv:

$ lodocker-start-container 
Select a Dockerfile:
1. ubuntu2204-lo7.5.9
2. ubuntu2310-dev
Please enter an integer: 1
INFO:root:git_root: /home/mblatt/opm-reference-manual/.venv/lib

It thinks the root directory of the git repository is .venv/lib

@blattms
Copy link
Member Author

blattms commented Mar 18, 2024

This is the problem might be run_container.py#L17

self.git_root = Path(__file__).resolve().parents[3]

I think we should check whether there is .git and otherwise use Path(__file__).resolve().parents[5]

@blattms blattms linked a pull request Mar 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants