-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from foxdalas/add_tests
Fix #16 issue
- Loading branch information
Showing
10 changed files
with
233 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:alpine as build | ||
|
||
RUN apk add git | ||
|
||
WORKDIR /app | ||
COPY go.mod go.sum /app/ | ||
RUN go mod download | ||
COPY . . | ||
RUN apk add alpine-sdk | ||
RUN go build . | ||
|
||
FROM alpine:3.15 | ||
RUN apk --no-cache add ca-certificates | ||
COPY --from=build /app/sphinx_exporter /bin/ | ||
EXPOSE 9247 | ||
ENTRYPOINT ["/bin/sphinx_exporter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3.9" | ||
services: | ||
# exporter: | ||
# container_name: exporter | ||
# command: | ||
# - "--sphinx.address=sphinx" | ||
# - "--sphinx.port=3306" | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile.compose | ||
# ports: | ||
# - "9247:9247" | ||
sphinx: | ||
container_name: sphinx | ||
build: | ||
context: tests/sphinx | ||
ports: | ||
- "3306:3306" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Dockerfile for Sphinx SE | ||
# https://hub.docker.com/_/alpine/ | ||
FROM alpine:3.14 | ||
|
||
# https://sphinxsearch.com/blog/ | ||
ENV SPHINX_VERSION 3.4.1-efbcc65 | ||
|
||
# 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 | ||
|
||
# http://sphinxsearch.com/downloads/sphinx-3.3.1-b72d67b-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" | ||
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 | ||
|
||
# expose TCP port | ||
EXPOSE 3306 | ||
|
||
RUN mkdir -p /opt/sphinx/conf | ||
RUN mkdir -p /opt/sphinx/tests | ||
|
||
COPY docs.xml /opt/sphinx/tests/ | ||
COPY sphinx.conf /opt/sphinx/conf/ | ||
|
||
# allow custom config file to be passed | ||
ARG SPHINX_CONFIG_FILE=/opt/sphinx/conf/sphinx.conf | ||
ENV SPHINX_CONFIG_FILE ${SPHINX_CONFIG_FILE} | ||
|
||
# prepare a start script | ||
RUN echo "exec searchd --nodetach --config \${SPHINX_CONFIG_FILE}" > /opt/sphinx/start.sh | ||
|
||
RUN /opt/sphinx/sphinx-3.4.1/bin/indexer --all --config "/opt/sphinx/conf/sphinx.conf" | ||
|
||
CMD sh /opt/sphinx/start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- http://sphinxsearch.com/docs/current/xmlpipe2.html --> | ||
<sphinx:docset> | ||
<sphinx:schema> | ||
<sphinx:field name="subject"/> | ||
<sphinx:field name="content"/> | ||
<sphinx:attr name="published" type="uint"/> | ||
<sphinx:attr name="author_id" type="uint" bits="16" default="1"/> | ||
</sphinx:schema> | ||
<sphinx:document id="1234"> | ||
<content>this is the main content <![CDATA[[and this <cdata> entry | ||
must be handled properly by xml parser lib]]></content> | ||
<published>1012325463</published> | ||
<subject>note how field/attr tags can be | ||
in <b class="red">randomized</b> order</subject> | ||
<misc>some undeclared element</misc> | ||
</sphinx:document> | ||
<sphinx:document id="1235"> | ||
<subject>another subject</subject> | ||
<content>here comes another document, and i am given to understand, | ||
that in-document field order must not matter, sir</content> | ||
<published>1012325467</published> | ||
</sphinx:document> | ||
</sphinx:docset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
/opt/sphinx/sphinx-3.4.1/bin/indexer --all --config "/opt/sphinx/conf/sphinx.conf" | ||
/opt/sphinx/start.sh |
Oops, something went wrong.