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

Help with Partkeepr attachment location in PartDB #712

Open
GH15ADF opened this issue Sep 16, 2024 · 3 comments
Open

Help with Partkeepr attachment location in PartDB #712

GH15ADF opened this issue Sep 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@GH15ADF
Copy link

GH15ADF commented Sep 16, 2024

This is a question, not really a bug per se.

I just migrated my database from Partkeepr to PartDB without any problems and now I am trying to put the attachment files in the proper directory. However, I am seeing the "file not found" icon in the UI. I attempted to follow the direction in the Migrate from PartKeepr to Part-DB page. The following is the directory structure in the original Partkeepr docker container:

root@9c045c08cb12:/var/www/html# tree -d data
data
|-- files
|   |-- FootprintAttachment
|   |-- PartAttachment
|   |-- ProjectAttachment
|   `-- Temporary
|-- iclogo
|-- images
|   |-- cache
|   |-- footprint
|   |-- iclogo
|   |-- part
|   `-- temp
`-- temp

This is the directory structure in the PartDB docker container:
In PartDB docker container:

root@b89d0034f15c:/var/www/html/uploads# tree -d
.
`-- files
    |-- FootprintAttachment
    |-- PartAttachment
    |-- ProjectAttachment
    `-- Temporary

The other piece of information I will add is that inspecting the Sqlite DB directly, I see %SECURE%/PartAttachment/4dd95690-6a3b-11eb-869a-1fccd4923431.pdf in the path field of one of my imported parts.

I would have attempted to move the files to the corresponding location, but I cannot figure out how to determine what %SECURE% translates into as far as the file system in the docker container
.

To Reproduce
Steps to reproduce the behavior:

  1. Follow steps in PartkeepR Migration instructions
  2. Copy files into directory as specified in Step 4
  3. Restart docker container
  4. Login and search for known part (e.g., NE555)
  5. Observe "file not found" icon in the left column of the results on the attachments tab

Expected behavior
See an icon related to the attachment (e.g., PDF) and be able to select the icon to see the attachment.

Screenshots
2024-09-16 12_17_21-PartDB_file_not_found

Server Side

  • Part-DB Version: 1.14.0
  • PHP Version: 8.2.23
  • Database Server Sqlite 3.40.1

Desktop (please complete the following information):

  • OS: Win 11
  • Browser Firefox
  • Version 130.0

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@GH15ADF GH15ADF added the bug Something isn't working label Sep 16, 2024
@jbtronics
Copy link
Member

The "%SECURE%" placeholder should map to the uploads/ folder in the Part-DB root (as long as you have not changed it).

So the placement of the files should be correct. Do the files have the correct permissions, so that the webserver can access (read and write) them? I would assume that especially with docker, it could be easy to get the permissions wrong.

@GH15ADF
Copy link
Author

GH15ADF commented Sep 25, 2024

Thanks for the info and I confirm that I am running in Docker. After making the permission changes you suggested, I am still seeing "file not found". I did not knowingly change anything including %SECURE%. I'm not even sure I understand how that parameter is set.

As you mentioned, I did not have the correct owner:group on the uploads/ folders and children, so set them to www-data:www-data

root@b89d0034f15c:/var/www/html# ls -la uploads/
total 7927
drwxr-xr-x 3 www-data www-data         4 Sep 13 00:15 .
drwxr-xr-x 1 www-data www-data      4096 Sep  9 19:57 ..
drwxr-xr-x 6 www-data www-data         6 Feb  8  2021 files

I also modified all my directory permissions to 755 which matches the permissions in the public/media folders

root@b89d0034f15c:/var/www/html# tree -dp /var/www/html/uploads/files
[drwxr-xr-x]  /var/www/html/uploads/files
|-- [drwxr-xr-x]  FootprintAttachment
|-- [drwxr-xr-x]  PartAttachment
|-- [drwxr-xr-x]  ProjectAttachment
`-- [drwxr-xr-x]  Temporary

My attachment files permissions are now set to 644 because that is what I see when I inspect my one test attachment to a test part.

############# My test attachment ##################
root@b89d0034f15c:/var/www/html# ls -la /var/www/html/public/media/part/310/testattachment-66e5799bea4fb.pdf
-rw-r--r-- 1 www-data www-data 37832 Sep 14 11:55 /var/www/html/public/media/part/310/testattachment-66e5799bea4fb.pdf
############# attachment file not found part ##################
root@b89d0034f15c:/var/www/html# ls -la /var/www/html/uploads/files/PartAttachment/4dd95690-6a3b-11eb-869a-1fccd4923431.pdf
-rw-r--r-- 1 www-data www-data 1731903 Feb  8  2021 /var/www/html/uploads/files/PartAttachment/4dd95690-6a3b-11eb-869a-1fccd4923431.pdf

Can I look at log entries or turn on logging to troubleshoot? I looked around in /var/log in the Docker container but there is not much there.

@jbtronics
Copy link
Member

In docker container the logs are available via dockers log mechanism. (So you can view them for example with docker logs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants