Stream: containers

Topic: โœ” collection logos, AccessDeniedException


view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 15 2023 at 19:34):

If you try to upload a logo to a collection you get this error: java.nio.file.AccessDeniedException: /opt/payara/../docroot

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 15 2023 at 19:34):

Originally reported here: https://github.com/IQSS/dataverse-docker/issues/85#issuecomment-1590391145

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 15 2023 at 19:35):

[#|2023-06-15T19:31:50.220+0000|WARNING|Payara 5.2022.5|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=99;_ThreadName=http-thread-pool::http-listener-1(4);_TimeMillis=1686857510220;_LevelValue=900;|
/themeAndWidgetsFragment.xhtml @58,239 listener="#{themeWidgetFragment.handleImageFileUpload}": java.lang.RuntimeException: Error creating temp directory
javax.el.ELException: /themeAndWidgetsFragment.xhtml @58,239 listener="#{themeWidgetFragment.handleImageFileUpload}": java.lang.RuntimeException: Error creating temp directory
...
Caused by: java.lang.RuntimeException: Error creating temp directory
at edu.harvard.iq.dataverse.ThemeWidgetFragment.createTempDir(ThemeWidgetFragment.java:96)
at edu.harvard.iq.dataverse.ThemeWidgetFragment.handleImageFileUpload(ThemeWidgetFragment.java:249)
...
Caused by: java.nio.file.AccessDeniedException: /opt/payara/../docroot

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 15 2023 at 19:37):

Here's line 96 above: https://github.com/IQSS/dataverse/blob/9feb865e9fc67ea6ba027cc36e7dbafef1301085/src/main/java/edu/harvard/iq/dataverse/ThemeWidgetFragment.java#L96

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 15 2023 at 19:38):

Related is the note about collection logos at https://guides.dataverse.org/en/5.13/installation/advanced.html#multiple-app-servers

view this post on Zulip Oliver Bertuch (Jun 20 2023 at 08:39):

I created https://github.com/IQSS/dataverse/issues/9662 for this.

view this post on Zulip Oliver Bertuch (Jun 20 2023 at 08:39):

Some poor hardcoded design choices in there...

view this post on Zulip Oliver Bertuch (Jun 20 2023 at 08:40):

Starting hacking on a PR to resolve the tech debt

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 20 2023 at 10:19):

Perfect! Thanks for taking a look!

view this post on Zulip Oliver Bertuch (Jun 20 2023 at 10:19):

Course!

view this post on Zulip Oliver Bertuch (Jun 20 2023 at 10:28):

@Philip Durbin @Don Sizemore I'm tempted to add the idea expressed in https://github.com/IQSS/dataverse/issues/9572 to the scope of this, as we need to check for these configured folders... Would it make sense to combine this?

view this post on Zulip Don Sizemore (Jun 20 2023 at 11:40):

@Oliver Bertuch I think checking for the existence (and ownership/mode) of necessary directories on service launch is a good thing to add.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 20 2023 at 13:05):

At the very least log an error about missing directories, I'd say

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:46):

@Don Sizemore @Philip Durbin here's the first version of this config checking: https://github.com/poikilotherm/dataverse/commit/a4ec3a66e76aa1559aea0c05cedc2da2b38d7b03

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:47):

It does fail deployment on startup if some check is not successful

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 21 2023 at 14:50):

Looks good! I bet the error messages are informative.

@DependsOn("StartupFlywayMigrator") means it gets run after flyway, I assume.

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:51):

I tried to make it as decriptive as possible, even add hints about the JVM setting names

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:51):

Yeah, it happens after Flyway

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:52):

Which also means you will see all those Flyway messages... So you need to scroll up up up up to see the log messages...

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:53):

There's not really a way around that - I'd prefer to have the checking run after flyway if we use it later for DB settings that might need a migration some day.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 21 2023 at 14:56):

I guess I'm used to scrolling up. No big deal. :happy:

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 21 2023 at 14:58):

Green light from me. Wanna run it by #dv-tech?

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:58):

Gimme a sec. Still need to hack the docroot bit

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 14:59):

At least now we can verify things are present and we don't fall over strange configs.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 21 2023 at 15:13):

Who knows, maybe we can add additional pre-flight checks in the future :airplane:

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 15:30):

Yeah I'd love this!

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 21 2023 at 15:43):

There's got to be a flotation/float dad joke here.

view this post on Zulip Oliver Bertuch (Jun 21 2023 at 16:33):

I'm getting there... Lots of places in the code where things are hardcoded where the docroot shall be. Good to change all of them...

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:56):

Oh isn't it just great... :angry:

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:56):

Now I found just another bug in Payara

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:57):

But this time it's failing big time

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:57):

They are using a regex approach for variable substitution in web.xml and other files...

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:58):

(https://github.com/payara/Payara/blob/payara-server-5.2022.5/nucleus/admin/config-api/src/main/java/org/glassfish/config/support/TranslatedConfigView.java for the curious ones)

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:59):

Which means ${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot} is taken apart with their regexes by cutting of /docroot after the second last bracket.

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:59):

Gnaaaah

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 08:59):

I can't believe nobody actually tested this

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 09:02):

Yeah well... Their tests don't cover recursive usage. :rolling_eyes: https://github.com/payara/Payara/blob/payara-server-5.2022.5/nucleus/admin/config-api/src/test/java/org/glassfish/config/support/TranslatedValueTest.java

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 09:05):

But maybe they just forgot to add "no deep nesting allowed" in their docs... https://docs.payara.fish/community/docs/Technical%20Documentation/Payara%20Server%20Documentation/Server%20Configuration%20And%20Management/Configuration%20Options/Variable%20Substitution/Types%20of%20Variables.html

view this post on Zulip Oliver Bertuch (Jun 22 2023 at 09:06):

So this would be a new feature then...

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 22 2023 at 09:46):

Good times

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 22 2023 at 09:47):

Crazy idea: store collection logos in the database

view this post on Zulip Don Sizemore (Jun 23 2023 at 14:58):

Philip Durbin said:

Crazy idea: store collection logos in the database

I support this!

view this post on Zulip Oliver Bertuch (Jun 23 2023 at 15:07):

I don't - storing binary blobs in databases has never been a good idea.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jun 23 2023 at 17:56):

Ok ok. We'll figure it out. :stuck_out_tongue_wink:

view this post on Zulip Thomas van Erven (Jul 10 2023 at 08:01):

Oliver Bertuch said:

Which means ${MPCONFIG=dataverse.files.docroot:${ENV=STORAGE_DIR:.}/docroot} is taken apart with their regexes by cutting of /docroot after the second last bracket.

I think I might have run into this one with dataverse-docker setup; we have a couple of logo's because logo's make management happy (c); I always, always end up copying them in the right spot with right permissions after upload and then it "magically" works.

view this post on Zulip Oliver Bertuch (Jul 10 2023 at 10:44):

Yeah it's just great. I still didn't have the time to come around and file a bug report.

view this post on Zulip Oliver Bertuch (Jul 10 2023 at 10:44):

Could add an env var to the image instead, but it feels kind of dirty to me

view this post on Zulip Oliver Bertuch (Jul 10 2023 at 10:45):

But probably the easiest workaround for now...

view this post on Zulip Oliver Bertuch (Jul 10 2023 at 10:46):

Make it work, file a bug report, create a todo issue to get back to this in our image when resolved upstream

view this post on Zulip Oliver Bertuch (Aug 23 2023 at 09:54):

So I created this: https://github.com/IQSS/dataverse/pull/9819 But it will not be merged for 6.0. Will fight to get it merged for 6.1 as it is a blocker on containers. @Thomas van Erven

view this post on Zulip Thomas van Erven (Sep 06 2023 at 05:34):

Much obliged, I'll owe you a beer once it's solved (though it's honestly a minor amount of work to do so - the main amount of work is in debugging why logo's aren't showing in the first place)

view this post on Zulip Oliver Bertuch (Sep 06 2023 at 05:53):

:beer: :dissolve: - I'll be in for a coke :smiley:

view this post on Zulip Oliver Bertuch (Sep 06 2023 at 05:54):

Yeah, I made the solution harder for myself by adding all the checks on startup... :see_no_evil:

view this post on Zulip Philip Durbin ๐Ÿš€ (Sep 07 2023 at 10:48):

Really we're just waiting for 6.0 to ship before we turn around attention to PRs like this. Thanks for your patience! I think we're close!

view this post on Zulip Philip Durbin ๐Ÿš€ (Oct 13 2023 at 19:28):

Merged! :tada: Configurable docroot via MicroProfile Config #9819

view this post on Zulip Philip Durbin ๐Ÿš€ (Oct 13 2023 at 19:33):

Works great!
Screenshot-2023-10-13-at-3.33.34-PM.png

view this post on Zulip Philip Durbin ๐Ÿš€ (Oct 13 2023 at 19:34):

Thanks, :dataverse_man: @Oliver Bertuch :dataverse_man: !

view this post on Zulip Oliver Bertuch (Oct 16 2023 at 05:51):

I _think_ this is solved now. Marking as such :smile_cat:

view this post on Zulip Notification Bot (Oct 16 2023 at 05:52):

Oliver Bertuch has marked this topic as resolved.


Last updated: Oct 30 2025 at 05:14 UTC