Home › Forums › Legacy Support › Support queries › Setup issues › Troubles with WPLMS on Docker Container from Bitnami
- This topic has 14 replies, 4 voices, and was last updated 4 years, 5 months ago by Veronica.
Viewing 15 posts - 1 through 15 (of 15 total)
-
AuthorPosts
-
May 18, 2020 at 3:07 pm #260587lendasdab42SpectatorHi, first of all, I want to thank for your awesome theme, WPLMS is great. My name is Rafael, I'm a PHP Developer and I'm supporting another guys from my company to get Wordpress and WPLMS working. I'm deploying the application on AWS Ec2 Instance. Planning to auto-scale the server on the future, I opted to deploy the application on Docker Containers, so it's way more easy to handle it. I'm using Bitnami Docker Images, which comes with wordpress at latest version and all environment configurations. Well, that being said, I figured out that WPLMS have some problems with absolute path (i.e. php magic constants DIR and FILE when running on Bitnami Wordpress Docker Container from Bitnami. (Which is a trusted library of software packages). I saw this problem when I tried to use vibe-shortcodes. The file wp-content/plugins/vibe-shortcodes/tinymce/get_wp.php fails to request wp-load.php because rely on FILE constant to get the root path to wordpress folder, as the image bellow: get_wp.php This happens because the Wordpress is located on: /opt/bitnami/wordpress but the wp-content folder that is inside is symlinked and the original location is bitnami/wordpress/wp-content. Bitnami do that to allow persist this files when docker container goes down. This is normal, that's how docker works. So, when the FILE constant returns the value from original file location, the require_once is not able to find wp-load.php file, because this file is located on /opt/bitnami/wordpress I fix that problem using the $_SERVER['SCRIPT_FILENAME'] superglobal instead of FILE contant. My get_wp.php is now linke this: changed get_wp.php But to do that It was necessary to hard code this file. Besides, I don't know how many files is using FILE So I think the best thing to do is open this request, explaining the problem and asking more compatibility with Bitnami Wordpress Docker Container. When I'm installing the theme, the same problems occurs, but I worked around to solve.May 18, 2020 at 4:01 pm #260593lendasdab42SpectatorHi, there are some problems with text format on post above. Please ignore the post above and read this one bellow: Well, that being said, I figured out that WPLMS have some problems with absolute path (i.e. php magic constants DIR and FILE) when running on Bitnami Wordpress Docker Container from Bitnami. (Which is a trusted library of software packages). I saw this problem when I tried to use vibe-shortcodes. The file wp-content/plugins/vibe-shortcodes/tinymce/get_wp.php fails to request wp-load.php because rely on __FILE__ constant to get the root path to wordpress folder, as the image bellow: This happens because the Wordpress is located on: /opt/bitnami/wordpress but the wp-content folder that is inside is symlinked and the original location is bitnami/wordpress/wp-content Bitnami do that to allow persist this files when docker container goes down. This is normal, that's how docker works. So, when the __FILE__ constant returns the value from original file location, the require_once is not able to find wp-load.php file, because this file is located on /opt/bitnami/wordpress I fix the problem using the $_SERVER['SCRIPT_FILENAME'] superglobal instead of __FILE__ constant. My get_wp.php is now like this: But to do that It was necessary to hard code this file. Besides, I don't know how many files is using __FILE__ Or you guys can look at wp-config.php and use ABSPATH constant instead of FILE So I think the best thing to do is open this request, explaining the problem and asking more compatibility with Bitnami Wordpress Docker Container. When I'm installing the theme, the same problems occurs, but I do the same workaroud to solve.May 19, 2020 at 2:31 pm #260898Anshuman SahuKeymasterWell this is not at all related to theme . FILE is a traditional magic constant . Even woocommerce and wordpress itself used this contant .Would you recommend them as well to change their code ?June 4, 2020 at 6:31 pm #265894lendasdab42SpectatorHi Alex. You might be right that "this is not at all related to theme" but, my intentions was not to point issues or errors on theme. I just want to help increase more compatibility with all available platforms. Which is a good thing to all of us. Anyway, thank you for support and, please, if it is possible, bring this question to your dev team, I think they will thank you/me to try to help improve wplms :)June 5, 2020 at 1:00 pm #266105Anshuman SahuKeymastersure im sharing this with Mr. vibe .June 5, 2020 at 2:09 pm #266132MrVibeKeymasterThis is something we are also interested in pursuing. Docker and Kubernetes with auto-scalability. Would be interested to know how you're planning to add a persistent storage across docker instances. Can you try following change :
- In Vibe shortcodes the file get_wp.php , use below code.
June 5, 2020 at 2:11 pm #266134MrVibeKeymasterThe FILE constant is recommended by WordPress for getting the plugin url relative to file.June 5, 2020 at 2:12 pm #266135MrVibeKeymasterI do not think we;re including file like above, anywhere. This was standard script for generating shortcode popup generators.June 9, 2020 at 2:06 pm #266986lendasdab42SpectatorHi, Mr.Vibe About the persistence, I suggest you to look this technique to create a docker volume on host. Look, this is exactly how I'm doing by now. https://github.com/bitnami/bitnami-docker-wordpress-nginx#persisting-your-application There's one point of attention: Bitnami stores the wp-content directory on /bitnami/wordpress, wp-config.php too and some other files. but all another files is on /opt/bitnami/wordpress and wp-content is a symlink pointing to /bitnami/wordpress/wp-content. I think they do this because they have an initial shell script that run on when container is bringing up with the command "docker-compose up -d". This shell script could overwrite these files if they were placed in the same location /opt/bitnami. So they created the symlink solution. (that's why I opened this issue). If you allow me, let me share some experience and an overview about my application. despite this, about auto-scalability I will face this situation soon. By now I'm using only one t2.micro instance on aws (1 GB ram, 1vCpu), with a docker and docker-compose to bring up a LEMP stack (Linux, Nginx, MariaDB and PHP). So by now I have 2 main containers: 1 - wordpress 1 - mariadb (and a certbot container to renew my LetsEncrypt certificate automatically) All on the same host, by now. My plans to next week is to move my database to amazon RDS and free cpu and memory from this instance only to wordpress. On the future, I think the persistence with auto-scalling could be done using the aws ECS to manage the scaling and the aws EFS as a shared filesystem across the instances. But it's too early to me to build and opinion about that. I will learn how to do this soon.June 9, 2020 at 2:09 pm #266989lendasdab42SpectatorMr. Vibe, about the code above you've shared with me, I will test it soon and share with you the results.June 9, 2020 at 2:15 pm #266990lendasdab42SpectatorAbout the EFS I mentioned: https://aws.amazon.com/blogs/compute/using-amazon-efs-to-persist-data-from-amazon-ecs-containers/June 10, 2020 at 7:12 pm #267327lendasdab42SpectatorHi, Mr. Vibe About the code you asked me to try, unfortunately not work, I got some errors. Here's the feedback: After click at some options below: the get_wp.php is called and our code throws this error: I've checked why and tried to debug: ABSPATH is not defined yet, maybe due to Wordpress Load Sequence. So I tried to put the abspath hardcoded only to see if the rest of code will run nice: But I have no success with that too, because another error happens: And I couldn't checked this one.June 13, 2020 at 4:15 am #267892MrVibeKeymasterok, just remove the line above and add the direct path to wp-load.php as you can not load a wordpress file without loading the wordpress.June 15, 2020 at 11:37 am #268292lendasdab42SpectatorAll Right. We can close this topic. Thank you.June 16, 2020 at 8:33 am #268510VeronicaModeratorclosing the topic. -
AuthorPosts
Viewing 15 posts - 1 through 15 (of 15 total)
- The topic ‘Troubles with WPLMS on Docker Container from Bitnami’ is closed to new replies.