TL;DR : Below, a link to a test instance of the current version of the dokuwiki app (code can be found here :
https://github.com/ndarilek/dokuwiki-sandstorm and here :
https://github.com/ndarilek/dokuwiki) :
https://littleroot.sandcats.io/shared/6ekxjHfAeblnRxgRUxfUAAS8QwDv5X757SmOPnBDwFQ
Howdy !
I am currently trying to continue the work of Nolan Darilek (
http://thewordnerd.info/) on porting Dokuwiki as a Sandstorm app. I am fairly new to both Sandstorm and Dokuwiki, but find them equally awesome, and couldn't be happier if I could get them working together properly.
If I should present Sandstorm in a few words, it is a neat piece of software that allows you to easily make your own personal cloud from secure containerized (a little bit similar to what Docker does) instances of already existing webapps, centralizing all authentication, and crazy configuration stuff. The people who made it explain it way better than me on their website,
https://sandstorm.io/ .
The link provided high above to a working instance will give you a rough idea of what this is all about. And you will quickly see the last problem we are encountering : whereas all media types like .pdf are distributed perfectly, images are not (please go ahead and try clicking on the main page of the provided instance).
After a few hours of research, and some mails exchanged with Nolan, I would like to share with you the foundings we made, what we tried, and what result it got us : still no images :D . Therefore, I believe we are in dire need of your lights.
So first thing to know is, the Nginx rules are created here :
https://github.com/ndarilek/dokuwiki-sandstorm/blob/master/.sandstorm/setup.sh#L42
According to Nolan, they're mostly lifted from Doku's Nginx example. There are a few places where he has added in $args to include query parameters, even though they aren't in the docs, but that doesn't seem to have fixed it.
To help you understand the scenario, here are the steps I followed to test :
- Through the media manager, uploaded a random pdf and jpg file, then clicked on the links provided. I then get respectively redirected to an url of the form https://<randomStuff>.<myDomain>.sandcats.io/_media/<filename>.pdf and https://<randomStuff>.<myDomain>.sandcats.io/_media/<filename>.jpg. The pdf file is properly accessible, but the jpg one gets nginx to return a "404 Not Found" error.
- Tried to find where the images and files are stored in the app with the following command on my server (executed from the root) : find . -name triangle\*
and it seems they are in :
/opt/sandstorm/var/sandstorm/grains/<grain_id>/sandbox/lib/dokuwiki/data/media/
- Funny thing is there seems to be no "_media" folder, so I don't fully understand where it gets its data. Is that some trick from nginx ? Or am I confusing some stuff ?
It seems all media files go in the "/opt/sandstorm/var/sandstorm/grains/<grain_id>/sandbox/lib/dokuwiki/data/media/" folder (and previous "versions" of the files, since its a wiki, in "/opt/sandstorm/var/sandstorm/grains/<grain_id>/sandbox/lib/dokuwiki/data/media_attic/)", I found no other occurence of them with the "find" command I used previously (if I have to be precise : I ran the command while the application was running and I was displaying both the pdf and 404 page of the image). But they are definitively present in this folder, both of them, valid files.
I also googled "dokuwiki images not displaying" and found what I think might be an interesting lead : The xsendfile option might not be properly configured:
https://www.dokuwiki.org/faq:brokenimages . Tried changing it, it just broke more stuff when not set to 0 (no more css).
I may have found another interestig clue when visiting a website provided on the discussion (
http://lareunioncoop.org/).
There, the image of the main page has a link of the form :
/lib/exe/fetch.php?w=600&h=400&tok=23ff4a&media=http%3A%2F%2Flareunioncoop.org%2F_media%2Fimg%2F4j0a5108-1-m.jpg
, instead of having a link of the form "/_media/test.jpg", like on sandstorm : it seems to me that images must be obtained through some call to a function "/lib/exe/fetch.php", and can't be attained otherwise.
I tried to make a link of the sort with my triangle.jpg image :
https://<mydomain>.sandcats.io/grain/<sandstormgrainid>/lib/exe/fetch.php?w=600&h=400&tok=d5d829&media=test.jpg
But sadly, it returns a "Bad Request" answer : I must be missing something.
So if anyone has any insight of what might be the problem, I would be more than happy to hear them out :) .
Please do not hesitate to ask for precisions I might have forgotten, or anything, really, I'll answer as soon as possible !
Thank you so much for your attention,
Littleroot.