pantheon-systems / solr-power

A WordPress plugin to connect to Pantheon's Apache Solr search infrastructure, or your own!
https://wordpress.org/plugins/solr-power/
GNU General Public License v2.0
126 stars 61 forks source link

Cert issue in Lando local environment #355

Open cjcodes opened 6 years ago

cjcodes commented 6 years ago

When developing locally with Lando, the certs required for this plugin to work are not installed.

Temporarily, I had to comment out:

(Line numbers come from the latest version released on wp.org.)

I don't yet have recommended solution steps (in crunch mode on a project), but want to create a placeholder issue or perhaps one of y'all has a good quick solution.

Alternatively, we could look into moving this issue over into the Lando repo to have certs included there, but I think it's a solvable problem on this side. (The certs are installed to /certs in the Docker container, but it's called "index.pem," not "binding.pem".)

danielbachhuber commented 6 years ago

Thanks for the report, @cjcodes.

For the public record, I've worked around this issue (error posting schema) by copying the schema.xml file to the correct place on the filesystem. For me, this is ~/solr/solr/conf/schema.xml.

It looks like Lando is defining the PANTHEON_ENVIRONMENT constant as of https://github.com/lando/lando/commit/d600e1cd82c8a391a9e560ac0dccfd9f845aaf66#diff-d02f821273817782be37a9c539342257

joshkoenig commented 6 years ago

We may want to come to a consensus with the Lando team about how best to handle this. Ideally we can supply a slug of configuration that will make it work with their local environment without any hacking needed.

cjcodes commented 6 years ago

@danielbachhuber Indeed copying the schema.xml helps, but there are two other issues I've run into:

  1. Using the post schema button returns a 204 rather than 200, but still works. Maybe we should check for 2XX responses rather than 200?
  2. Can't connect to the Solr instance (even ping doesn't work) because setting CURLOPT_SSLCERT forces verification against a cert that doesn't exist in Lando world.

@joshkoenig I'll hold on any PRs then until I hear from you--I'm happy to code up the solution by detecting PANTHEON_ENVIRONMENT. There's some consolidation and refactoring that could also be useful related to this.

jakebellacera commented 6 years ago

Revisiting this.

I'm running a a local Lando environment with the default pantheon recipe. I'm currently looking into enabling Solr and was having trouble enabling the plugin. After some debugging, I noticed that the post schema task which is ran when the plugin is enabled was returning a 204. Modifying includes/includes/class-solrpower-api.php:134 to allow a 204 response allows the plugin to be installed correctly. Afterwards, I am able to successfully ping and index via the plugin settings and WP CLI.

I did not run into any cert issues. Perhaps this was fixed in a future configuration of the pantheon Lando recipe?