Open xet7 opened 6 years ago
From @JamborJan on November 12, 2014 13:21
Hi @dwrensha, thanks for adding the GD option, when will it be possible to update the package via https://sandstorm.io/apps/?
As far as I know re-installing it from there should be enough once it has been updated.
JJ
From @dwrensha on November 12, 2014 14:7
I've uploaded a new spk to my server. You can get it at:
/install/304cb89dd54a6b8d9bf2fbd689488f13?url=http://dwrensha.ws/sandstorm-apps/wordpress.spk
This version includes the GD library, but I've not yet been able to verify that it actually works.
I'm going to see if I can do some other updates and fixes before releasing to the official app list.
From @JamborJan on November 12, 2014 14:18
Thanks a lot. That helped a bit. Plugins still not working, I have to check now what reason is next.
JJ
From @JamborJan on November 12, 2014 14:25
Hi @dwrensha,
Now I saw 2 other requirements:
The version should be no issue but can you tell me something about the JSON support?
JJ
From @dwrensha on November 13, 2014 17:43
Those requirements ought not to cause any trouble. JSON support should be included automatically.
To understand what might be going wrong, I've been trying to get the NextGEN Gallery plugin working in Sandstorm. In that case, at least part of the problem is that the plugin is not completely compatible with the sqlite-integration plugin that we use. I wonder whether your plugin might be hitting a similar problem.
Another possible source of problems is that plugin might be attempting to make HTTP requests from the server. Currently, the Sandstorm app completely disables that capability.
From @JamborJan on November 13, 2014 20:20
Thanks so far. I'll try to find some more details. I let you know when I have more details.
From @JamborJan on November 26, 2014 10:50
A simple look at the log brought the following:
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/plugins/widgetkit/cache/widgetkit-5696fce6.css [HTTP/1.1 404 Not Found 11ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/css/theme.css [HTTP/1.1 404 Not Found 8ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/css/custom.css [HTTP/1.1 404 Not Found 8ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/vendor/uikit/js/addons/search.js [HTTP/1.1 404 Not Found 8ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/js/circlechart.js
When I take a look at the mentioned location I can find the files, e.g.
/opt/sandstorm/var/sandstorm/grains/8K8ETDhsvzGbMe3Baybgh5/sandbox/wordpress/wp-content/themes/yoo_digit_wp/css
So I assume there is an issue accessing the files, is that right? Any idea how to solve this?
JJ
From @JamborJan on November 26, 2014 11:30
As the default shipped templates are working I checked the source folders / files.
Permissions on file level:
My new template:
/opt/sandstorm/var/sandstorm/grains/8K8ETDhsvzGbMe3Baybgh5/sandbox/wordpress/wp-content/themes/yoo_digit_wp/css
-rw-rw-r-- 1 sandstorm sandstorm 169726 Nov 8 22:10 theme.css
Other pre installed templates:
/opt/sandstorm/var/sandstorm/grains/8K8ETDhsvzGbMe3Baybgh5/sandbox/wordpress/wp-content/themes/twentyeleven
-rw-rw---- 1 sandstorm sandstorm 5032 Nov 7 22:51 editor-style.css
Permissions on parent folder level:
drwxrwx--- 7 sandstorm sandstorm 4096 Nov 7 22:51 twentyeleven
drwxrwxr-x 11 sandstorm sandstorm 4096 Nov 8 22:10 yoo_digit_wp
So basically it seems that there are "more" permissions.
What I have seen is that the template is not copied to the www folder when I click the „regenerate public site“ button. When I use one of the default templates they get copied to the www folder.
/opt/sandstorm/var/sandstorm/grains/8K8ETDhsvzGbMe3Baybgh5/sandbox/www/wp-content/themes
So I tried to copy the folder manually:
cp -avr /opt/sandstorm/var/sandstorm/grains/8K8ETDhsvzGbMe3Baybgh5/sandbox/wordpress/wp-content/themes/yoo_digit_wp /opt/sandstorm/var/sandstorm/grains/8K8ETDhsvzGbMe3Baybgh5/sandbox/www/wp-content/themes/yoo_digit_wp
And I realized: the whole wp-content folder is not created in www/ when using a different template then one of the default ones after clicking the „regenerate public site“ button. When I created them manually and copied the folder I solved some error messages but new ones appear. I think there is an issue with publishing the template and plugins.
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/vendor/uikit/js/uikit.js [HTTP/1.1 404 Not Found 26ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/vendor/uikit/js/addons/autocomplete.js [HTTP/1.1 404 Not Found 27ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/vendor/uikit/js/addons/search.js [HTTP/1.1 404 Not Found 30ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/js/social.js [HTTP/1.1 404 Not Found 34ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/js/theme.js [HTTP/1.1 404 Not Found 33ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/plugins/widgetkit/cache/widgetkit-5696fce6.css [HTTP/1.1 404 Not Found 40ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/vendor/uikit/js/addons/autocomplete.js [HTTP/1.1 404 Not Found 20ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/warp/js/social.js [HTTP/1.1 404 Not Found 7ms]
GET https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/themes/yoo_digit_wp/js/theme.js
From @dwrensha on November 27, 2014 15:8
Looks like somehow the URLs are not getting formed properly. This URL
https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/var/wordpress/wp-content/plugins/widgetkit/cache/widgetkit-5696fce6.css
should instead be
https://nvg8nzpdpyxcm3e748sw.pandorica.centur.io/wp-content/plugins/widgetkit/cache/widgetkit-5696fce6.css
That is, the "var/wordpress" part should not show up in a URL.
Is it possible that the plugin is using WP_PLUGIN_DIR
or WP_CONTENT_DIR
somewhere that it should instead be using WP_PLUGIN_URL
or WP_CONTENT_URL
?
See http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
From @JamborJan on November 28, 2014 13:28
Hi @dwrensha ,
The URL you mentioned is not working.
Shouldn't the template be copied to the www folder after clicking the „regenerate public site“ button?
When I use a build in template I get a lot more files including the „wp-content“ directory:
-rw-rw---- 1 sandstorm sandstorm 3675 Nov 28 14:10 index.html
drwxrwx--- 3 sandstorm sandstorm 4096 Nov 28 14:10 wp-content
drwxrwx--- 3 sandstorm sandstorm 4096 Nov 28 14:10 wp-includes
-rw-rw---- 1 sandstorm sandstorm 42 Nov 28 14:10 xmlrpc.php
When I us the template from yootheme.com I only have the following and the „wp-content“ is not there at all and therefor the files cannot be found:
-rw-rw---- 1 sandstorm sandstorm 3302 Nov 28 14:03 index.html
drwxrwx--- 3 sandstorm sandstorm 4096 Nov 28 14:03 wp-includes
When I copy the files there manually it's working (at least partially there are popping up more and more errors and I would have to copy a whole bunch of files to have this done completely manually).
So even if the URL the plugin is looking for is wrong it would make no difference at this point as the files are not there.
I checked the source code of the plugin and found only __DIR__
being used. Is it possible that this „magic constant“ is not properly set?
So from my point of view there are 2 issues:
1) wp-content folder not created / copied after clicking „regenerate public site“ (only when none-default template is used)
2) __DIR__
not properly set
Or am I wrong?
JJ
From @dwrensha on November 28, 2014 15:59
The "Regenerate Public Site" button uses a recursive wget
to crawl the site and create a copy of it as static content. If the wp-content directory is not included in the output, that indicates that there are no links that lead from "/" to anything in "/wp-content".
Maybe the plugin does some linking through javascript? That could possibly confuse wget
.
I've downloaded a copy of the WidgetKit Lite plugin. I'll see if I can debug things from my side.
From @JamborJan on November 28, 2014 16:3
I can send you the template I'm trying to install if you like. I also could provide the widget-kit full version. Let me know how I can help best tracking down this issue.
Thanks! JJ
From @dwrensha on November 28, 2014 22:25
Argh. Looks like the plugin isn't happy with the way the Sandstorm app sets up symlinks. It's assuming that the wp-content directory is a subdirectory of the Wordpress root directory. In our case, the former is "/var/wordpress/wp-content" and the latter is "/sandstorm-read-only", and we have a symlink from "/sandstorm-read-only/wp-content" to "/var/wordpress/wp-content".
The trouble comes when the plugin attempts to transform absolute paths to relative paths by subtracting out the Wordpress root directory.
The following change to widgetkit/helpers/path.php works around the problem:
104c104,106
< $url = $root.'/'.ltrim(preg_replace('/'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this['system']->path), '/').'/i', '', $url, 1), '/');
---
> $replaced = preg_replace('/'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', '/var/wordpress'), '/').'/i', '', $url, 1);
> $replaced = preg_replace('/'.preg_quote(str_replace(DIRECTORY_SEPARATOR, '/', $this['system']->path), '/').'/i', '', $replaced, 1);
> $url = $root.'/'.ltrim($replaced, '/');
This is definitely not a great solution, though.
After making this change, I ran into other problems that seemed related to sqlite.
From @JamborJan on November 28, 2014 22:52
OK, understand. Whats the result of this: further working on making the Sandstorm WordPress port more compatible to most of the templates / plugins out there or stopping at this point?
JJ
From @dwrensha on December 1, 2014 1:2
Alas, Widgetkit is probably not the only plugin that depends on realpath() in this way.
Unfortunately, I don't see a good way to make further progress on this right now.
We would probably be able to make things work out straight out of the box if we: 1) Used mysql instead of sqlite. 2) Copied the whole wordpress directory into /var.
However, these changes would significantly increase resource consumption and (2) would introduce some sticky issues around app upgrading.
To get things to really work well, we may need new Sandstorm features. A union filesystem might help.
From @JamborJan on December 1, 2014 9:26
Okay. Thanks for all your effort @dwrensha. I have to get more into details of how to port different apps with different technologies and maybe I will be able soon to really contribute to this rather than only asking questions.
I will do my "self education" and come back to this topic as soon as I see the chance that I can do something here. I see that there are many more important things in the Sandstorm development than doing this.
JJ
From @JamborJan on July 13, 2015 17:47
Hey @dwrensha I know you guys are pretty busy these days, wanted to ask if it is rather likely or not that a solution like union file system will be introduced or not.
I would love to move some pages to sandstorm but at the moment most of them use themes and the widgetkit from those guys: http://yootheme.com/
If I can help with this let me know.
JJ
From @dwrensha on July 15, 2015 13:22
Unfortunately, I still haven't determined the best path forward here. I think Sandstorm is unlikely to support a union/overlay filesystem (at least any time soon). Another strategy we might take here could be to implement in Sandstorm a notion of "app add-on" so that WordPress plugins could be installed as sub-packages of the main WordPress spk. With this approach, plugins would get installed in read-only app storage without any symlink indirection and we wouldn't see any of the path normalization problems we were seeing above. However, the problem with this approach for WordPress plugins is that they often expect to be able to write to their install directory. E.g. the WidgetKit plugin wants to write to its /cache directory. So to get that to work, it seems that we need to allow add-ons to specify "bind-mounts" into grain storage. So it starts to get complicated.
Hmm. Maybe the best course of action for us right now would be to gather an understanding of what other apps might expect in a notion of "app add-on". If that matches up with what we need here, then perhaps the added complication is justified.
From @JamborJan on July 15, 2015 15:31
Thanks for sharing your thoughts on this topic. It is for sure the best idea to identify a use case which applies to other apps too and to find a proper solution based on that. Sorry when I write the same thing again here with my own words, it helps me understanding the issue and maybe get a better idea of it.
From my point of view the use case seems to be at the moment more or less like that:
Behavior today:
Alternative:
So basically what I see here between the lines: if the actual app vendor would use proper functions to determine paths (nothing hard coded and all symlink friendly) then the issue would not occur. So a real solution is to help the vendor / upstream maintainer fix the issue. But as companies like yootheme might not consider doing this we might get stuck here.
I have no idea what an alternative solution can be, therefor I have too little detailed knowledge of what is really possible and what is simply magic and fairy tales. One of these magic options would be detecting when an app/package is trying to use a function or hard coded paths which is known for delivering a wrong current path when symlinked and replace it / fake the result with the actual path. If something like this would be possible it must be handled in the package of the "mother app" of the plugin. So when the plugin tries to figure out a path the app says "take this: /var/ ...".
Apps which might have this issue:
JJ
From @JamborJan on November 9, 2014 11:13
Hi,
I have an "Critical Issues: No GD library available." in WordPress. I have themes and plugins from http://yootheme.com and they have the requirement to have the web server running with the GD library enabled.
Can this be changed or are there any concerns doing this?
Thanks JJ
Copied from original issue: dwrensha/wordpress-sandstorm#1