Hi Steve,

I’m not super familiar with Docker, so I’m not entirely sure what’s appropriate 
here, but a few thoughts that may help clarify the situation:

Are you trying to have Sphinx be available via a hostname, like your database? 
Or are you trying to have Sphinx talk to the database via its hostname (“db”)?

In the case of the former: Sphinx should accept hostnames as an alternative to 
IP addresses for the `address` setting. Are you finding that’s not the case?

In the case of the latter: Thinking Sphinx picks up the database settings from 
your ActiveRecord connection - thus, it should be using whatever’s in 
`config/database.yml`. Are you finding that’s not the case in the generated 
Sphinx configuration file?

In either case: you may want to ask in this GitHub issue, as others who are 
using Docker and Thinking Sphinx have been sharing their thoughts there:
https://github.com/pat/thinking-sphinx/issues/1010 
<https://github.com/pat/thinking-sphinx/issues/1010>

Also, from a general Sphinx/Thinking Sphinx configuration perspective: the 
mysql41 setting is what you should use for setting Sphinx’s port in TS v3+. The 
`port` setting is a legacy from TS v1/v2, and can make the Sphinx daemon 
confused - best to remove it.

Hope this helps! If you need further clarification, do ask :)

—
Pat

> On 1 Aug 2018, at 7:29 pm, Steve Redka <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> Hello
> 
> I'm trying to dockerize my application. It uses thinking sphinx and I have 
> trouble configuring it.
> 
> In particular, I can't configure it to have a reliable link to container with 
> database. This is my current config/thinking_sphinx.yml file:
>  development: &common
>    min_infix_len: 1
>    charset_table: "0..9, english, U+0021..U+002F"
>    port: 9306
>    address: 172.17.0.1
>    # sql_host: db
>    # mysql41: 9306
>  production:
>    <<: *common
> 
> As you see, it uses direct ip to reference the container. It works on my 
> machine, but may break elsewhere, which ruins the whole reason to use docker. 
> So I want to reference container by its hostname, like it is already done in 
> database.yml:
> 
> common: &common
>   adapter: mysql2
>   encoding: utf8
>   database: sociaball
>   username: <%= ENV['MYSQL_USER'] %>
>   password: <%= ENV['MYSQL_PASSWORD'] %>
>   host: db # Here
> 
> I tried using sql_host and host directives. Also, I tried putting 'db' into 
> clauses and using container name (sociaball_db_1).
> 
> So, is it possible to point to database server by hostname in 
> thinking_sphinx.yml?
> Is it even thinking sphinx issue?
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/thinking-sphinx 
> <https://groups.google.com/group/thinking-sphinx>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to