1

I am deploying a Grails application to Cloud Foundry where the Searchable plugin 'compassConnection' is set to use a RAM index. Problem is Cloud Foundry applies some of it's magic auto-configuration to set the 'compassConnection' to use a file-based index instead.

This would be fine if I was using a disk-based index and Cloud Foundry needs to reconfigure to make it work in it's environment but I want the RAM index config left as it is.

Any ideas how I can make this work?

thanks, Olly

Olly
  • 31
  • 3
  • I dont think CF has customisation for the configuration of the searchable plugin. It is just a lib uploaded. It auto-reconfigures datasources of CF services like MongoDB, MySQL, PostgreSQL, etc. Did you bind any such service anyway? – William Gu Jan 09 '13 at 07:18
  • Well there is something in the cloud foundry plugin docs which says it does configure the Lucene index (http://goo.gl/vRO5l - search for 'Searchable'). Is it the actual cloud foundry plugin doing this configuration maybe or Cloud Foundry itself. I will test later by removing that plugin as I don't use it. – Olly Jan 09 '13 at 10:03
  • Ah no wait - I needed the plugin of course for the Mysql auto config. So I think the issue is in the CloudFoundry Grails plugin. Any ideas? – Olly Jan 09 '13 at 23:21

1 Answers1

2

I found the cause of the issue after trawling through the Cloud Foundry plugin source code inside AbstractCloudBeanPostprocessor. The method for populating the compass connection doesn't check if it is a RAM index or not but blindly sets it to a location on disk.

    /**
 * Update the location of the Searchable Lucene index.
 * @param beanFactory the Spring bean factory
 * @param appConfig the application config
 */
protected void fixCompass(ConfigurableListableBeanFactory beanFactory, ConfigObject appConfig) {
    def compassBean = beanFactory.getBeanDefinition('compass')
    String indexLocation = getCompassIndexRootLocation(appConfig) + '/searchable-index'
    appConfig.searchable.compassConnection = indexLocation
    compassBean.propertyValues.addPropertyValue 'compassConnection', indexLocation
    log.debug "Updated Compass connection details: $indexLocation"
}

I think this should really check for presence of RAM index and only set it to disk location. One possible workaround would be to create my own BeanDefinitionRegistryPostProcessor and undo what the cloud foundry plugin does.

Olly
  • 31
  • 3
  • This is very helpful, Olly! I would recommend you filing a request at the Grails JIRA: http://jira.grails.org/browse/GPCLOUDFOUNDRY. Although I am wondering the reason why not the file index? – William Gu Jan 11 '13 at 02:22