0

I installed sphinx search on the server. Now I try to symlink the config for sphinx's searchd to the current deploy's sphinx config file, generated by thinking sphinx. Any idea how to do that? I haven't found a way yet to link to a file within a Dokku deploy. Also, it seems I will need to restart Sphinx and relink the config on every deploy then, as the config might have changed. Any hints/suggestions how to do this?

Nico
  • 881
  • 1
  • 6
  • 19
  • If you can access your VM using a CLI, then check out this answer: http://stackoverflow.com/a/1951752/2430657. From that answer, the command to symlink is: `ln -s /path/to/file /path/to/symlink` – Alexander Mar 31 '16 at 15:19
  • Thanks. Symlinking itself is not the issue though. I don't have the location of the current deploy. Need to find that first. And that keeps changing, so the symlink would have to be renewed for each deploy. – Nico Mar 31 '16 at 16:21

2 Answers2

0

You can use the storage plugin to mount a path in your rails app to a path on disk.

Jose Diaz-Gonzalez
  • 2,066
  • 1
  • 15
  • 19
  • And how can I make sure that sphinx uses the config from the current deploy? I assume I'll have to restart sphinx each time I deploy. As a hack I could do that manually, whenever the sphinx config changes. I guess for automating this I would have to write a dokku plugin? – Nico Apr 01 '16 at 17:59
  • Ah, actually, I don't need to restart sphinx on deploys, but whenever a new config is generated in the persisted storage... I guess that should work, I'll try that! – Nico Apr 01 '16 at 18:09
  • No luck with this so far. I get file path and permission issues. But I'm a bit further using memoris answer. – Nico Apr 05 '16 at 07:42
  • @nico did you manage to get it working ? if yes, can you share how ? thanks man ! – Tiago Almeida Sep 21 '17 at 17:32
  • @tiago we abandoned that project for now, but we had it working as far as I remember. My colleague mainly worked on it, I will ask him. – Nico Sep 29 '17 at 06:50
0

In my case to start sphinx in dokku(0.5.3) I use:
config files: https://gist.github.com/misteral/b6669a08f5daa63fe56e61798fe9a9f0
plugins:
1. dokku-apt - to install sphinx from deb package in app container
2. dokku-logging-supervisord - for start sphinx in app container

memoris
  • 149
  • 2
  • 12
  • You can start sphinx as a custom command in your Procfile and scale it up using the [ps plugin](http://dokku.viewdocs.io/dokku/process-management/), without the need for the logging-supervisord plugin. – Jose Diaz-Gonzalez Apr 04 '16 at 04:44
  • Thanks, I will try it. – memoris Apr 04 '16 at 07:03
  • I think I will try the storage plugin solution first. That way sphinx doesn't need to be reinstalled/restarted for each deploy. – Nico Apr 04 '16 at 14:24
  • I do get thinking sphinx to start searchd and build my indexes, however, when I try to make a search query I get: Can't connect to MySQL server on '127.0.0.1'. Any ideas? – Nico Apr 05 '16 at 07:44
  • Interestingly rake ts:regenerate worked fine, starting searchd. However rake ts:start fails with "Failed to start searchd daemon. Check /app/log/staging.searchd.log." However, that log file doesn't exist. – Nico Apr 05 '16 at 07:54
  • Try to find staging.searchd.log on dokku host if you installed sphinx into host mashine – memoris Apr 06 '16 at 06:57
  • Ah, well, I did get this using your method though, installing sphinx into the container... Although sphinx is still on the host too... – Nico Apr 07 '16 at 04:24
  • Did you install mysql? When i search I get this error: Can't connect to MySQL server on '127.0.0.1' (111) I have installed the mysql dokku plugin and linked it to the app. But maybe i should alos install it via dokku-apt? – Nico Apr 07 '16 at 08:56
  • Ah, actually mysql is not needed. The error is misleading: It only inicates sphix cannot connect to searchd. However, it is running... – Nico Apr 07 '16 at 09:14
  • @Nico check your thinking_sphinx.yml, I am push my version in config gist in first message – memoris Apr 09 '16 at 16:43
  • @memoris: I use your sphinxstart process type + rake task in the procfile which seems to start up fine. However, my app still cannot access sphinx: "Can't connect to MySQL server on '127.0.0.1' (111)". Could it be because it is running with user 27728 like my web and background processes? However all other resources like postgres run on user 999. I'm a bit at a loss here. My sphinx config's listen entry is: listen = 127.0.0.1:9306:mysql41. – Nico May 05 '16 at 18:50