Skip to content

Commit

Permalink
feat: Update Sphinx to 3.5.1 (#23)
Browse files Browse the repository at this point in the history
* feat: Update to Sphinx 3.5.1

* Revert whitespace change

Co-authored-by: Maciej Brencz <maciej.brencz@gmail.com>

* Make defaults clearer

Co-authored-by: Maciej Brencz <maciej.brencz@gmail.com>

---------

Co-authored-by: Maciej Brencz <maciej.brencz@gmail.com>
  • Loading branch information
reneleonhardt and macbre authored May 16, 2023
1 parent 76bed58 commit 0505e81
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 30 deletions.
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Dockerfile for Sphinx SE
# https://hub.docker.com/_/alpine/
FROM alpine:3.14
FROM --platform=linux/amd64 alpine:3.18

# https://sphinxsearch.com/blog/
ENV SPHINX_VERSION 3.4.1-efbcc65
ENV SPHINX_VERSION 3.5.1-82c60cb

# install dependencies
RUN apk add --no-cache mariadb-connector-c-dev \
postgresql-dev \
wget

# set up and expose directories
RUN mkdir -pv /opt/sphinx/log /opt/sphinx/index
VOLUME /opt/sphinx/index
RUN mkdir -pv /opt/sphinx/logs /opt/sphinx/indexes
VOLUME /opt/sphinx/indexes

# http://sphinxsearch.com/downloads/sphinx-3.3.1-b72d67b-linux-amd64-musl.tar.gz
# http://sphinxsearch.com/downloads/sphinx-3.5.1-82c60cb-linux-amd64-musl.tar.gz
RUN wget http://sphinxsearch.com/files/sphinx-${SPHINX_VERSION}-linux-amd64-musl.tar.gz -O /tmp/sphinxsearch.tar.gz \
&& cd /opt/sphinx && tar -xf /tmp/sphinxsearch.tar.gz \
&& rm /tmp/sphinxsearch.tar.gz

# point to sphinx binaries
ENV PATH "${PATH}:/opt/sphinx/sphinx-3.4.1/bin"
ENV PATH "${PATH}:/opt/sphinx/sphinx-3.5.1/bin"
RUN indexer -v

# redirect logs to stdout
RUN ln -sv /dev/stdout /opt/sphinx/log/query.log \
&& ln -sv /dev/stdout /opt/sphinx/log/searchd.log
RUN ln -sv /dev/stdout /opt/sphinx/logs/query.log \
&& ln -sv /dev/stdout /opt/sphinx/logs/searchd.log

# expose TCP port
EXPOSE 36307
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ PWD = $(shell pwd)
index:
cat ./tests/docs.xml | docker run -i \
-v $(PWD)/tests/sphinx.conf:/opt/sphinx/conf/sphinx.conf \
-v $(PWD)/tests/data:/opt/sphinx/index \
macbre/docker-sphinxsearch \
-v $(PWD)/tests/data:/opt/sphinx/indexes \
--platform linux/amd64 macbre/docker-sphinxsearch \
indexer --config /opt/sphinx/conf/sphinx.conf test_index

start:
docker run --detach --rm \
-v $(PWD)/tests/sphinx.conf:/opt/sphinx/conf/sphinx.conf \
-v $(PWD)/tests/data:/opt/sphinx/index \
-v $(PWD)/tests/data:/opt/sphinx/indexes \
-p 36307:36307 \
--name sphinx_test \
macbre/docker-sphinxsearch
--platform linux/amd64 macbre/docker-sphinxsearch

query:
mysql -h0 -P36307 -e 'show tables'
Expand Down
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ You can use this image in `docker-compose`-powered app:
```yaml
services:
sphinx:
image: macbre/sphinxsearch:3.4.1
image: macbre/sphinxsearch:3.5.1
ports:
- "127.0.0.1:36307:36307" # bind to local interface only!
volumes:
- ./data:/opt/sphinx/index # directory where sphinx will store index data
- ./data:/opt/sphinx/indexes # directory where sphinx will store index data
- ./sphinx.conf:/opt/sphinx/conf/sphinx.conf # SphinxSE configuration file
mem_limit: 512m # match indexer.value from sphinx.conf
```
Expand All @@ -32,25 +32,42 @@ or you can provide your custom config file:
```yaml
services:
sphinx:
image: macbre/sphinxsearch:3.4.1
image: macbre/sphinxsearch:3.5.1
environment:
- SPHINX_CONFIG_FILE=/opt/sphinx/conf/my_custom_file.conf
ports:
- "127.0.0.1:36307:36307" # bind to local interface only!
volumes:
- ./data:/opt/sphinx/index # directory where sphinx will store index data
- ./data:/opt/sphinx/indexes # directory where sphinx will store index data
- ./my_custom_file.conf:/opt/sphinx/conf/my_custom_file.conf # SphinxSE configuration file
mem_limit: 512m # match indexer.value from sphinx.conf
```
1. First, execute `docker-compose run sphinx indexer --all` to prepare indices. Otherwise, you'd end up with `WARNING: index 'test1': prealloc: failed to open /opt/sphinx/index/test1.sph: No such file or directory; NOT SERVING` error.
1. First, execute `docker-compose run sphinx indexer --all` to prepare indices. Otherwise, you'd end up with `WARNING: index 'test_index': prealloc: failed to open /opt/sphinx/indexes/test_index/test_index.sph: No such file or directory; NOT SERVING` error.
2. Then, execute `docker-compose up -d` to run sphinsearch daemon in the background.

Read more at https://lukaszherok.com/post/view/9/Running%20SphinxSearch%20in%20Podman%20container

## [Tags available](https://hub.docker.com/r/macbre/sphinxsearch/tags/)

### `3.4.1`, `latest`
### `3.5.1`, `latest`

```
Sphinx 3.5.1 (commit 82c60cbfe)
Copyright (c) 2001-2023, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)

Built on: Linux alpine314 5.10.131-0-lts #1-Alpine SMP Tue, 19 Jul 2022 15:30:18 +0000 x86_64 Linux
Built with: gcc 10.3.1
Build date: Feb 2 2023
Build type: release
Configure flags: '--enable-dl' '--with-mysql' '--with-pgsql' '--with-unixodbc' 'CXXFLAGS=-DSPHINX_TAG= -DNDEBUG -O3 -g1 -D__MUSL__' 'LDFLAGS=-static-libstdc++ -static-libgcc'
Compiled DB drivers: mysql-dynamic pgsql-dynamic odbc-dynamic
Compiled features: libexpat libstemmer re2 jemalloc
Versions: binlog_format v.10, index_format v.62, udf_api v.23
```
### `3.4.1`
```
Sphinx 3.4.1 (commit efbcc658)
Expand Down
28 changes: 16 additions & 12 deletions tests/sphinx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ source xml
index test_index
{
source = xml
path = /opt/sphinx/index/test_index

# @see http://sphinxsearch.com/docs/2.0.1/conf-blend-chars.html
blend_chars = -
# @see http://sphinxsearch.com/docs/manual-2.3.2.html#conf-blend-chars
blend_chars = -

# CALL SUGGEST
min_infix_len = 3
min_infix_len = 3

# wsparcie dla polskich znaków
# @see http://sphinxsearch.com/wiki/doku.php?id=charset_tables#polish
charset_table = 0..9, A..Z->a..z, a..z, U+0143->U+0144, U+0104->U+0105, U+0106->U+0107, U+0118->U+0119, U+0141->U+0142, U+00D3->U+00F3, U+015A->U+015B, U+0179->U+017A, U+017B->U+017C, U+0105, U+0107, U+0119, U+0142, U+00F3, U+015B, U+017A, U+017C, U+0144
# wsparcie dla polskich znaków
# @see http://sphinxsearch.com/wiki/doku.php?id=charset_tables#polish
charset_table = 0..9, A..Z->a..z, a..z, U+0143->U+0144, U+0104->U+0105, U+0106->U+0107, U+0118->U+0119, U+0141->U+0142, U+00D3->U+00F3, U+015A->U+015B, U+0179->U+017A, U+017B->U+017C, U+0105, U+0107, U+0119, U+0142, U+00F3, U+015B, U+017A, U+017C, U+0144
}

indexer
Expand All @@ -29,11 +28,16 @@ indexer
searchd
{
listen = 36307:mysql41
log = /opt/sphinx/log/searchd.log
query_log = /opt/sphinx/log/query.log
query_log_format = sphinxql
pid_file = /opt/sphinx/searchd.pid
# the defaults are as follows:
# log = /opt/sphinx/logs/searchd.log
# query_log = /opt/sphinx/logs/query.log
# pid_file = /opt/sphinx/searchd.pid

# binlogs
binlog_path = # disable logging
binlog = 0 # disable logging
}

common
{
datadir = /opt/sphinx
}

0 comments on commit 0505e81

Please sign in to comment.