docker-compose.yml
version: "3"
services:
webserver:
build:
context: ./bin/${PHPVERSION}
container_name: '${COMPOSE_PROJECT_NAME}-${PHPVERSION}'
restart: 'always'
ports:
- "${HOST_MACHINE_UNSECURE_HOST_PORT}:80"
- "${HOST_MACHINE_SECURE_HOST_PORT}:443"
links:
- database
volumes:
- ${DOCUMENT_ROOT-./www}:/var/www/html
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/php.ini
- ${VHOSTS_DIR-./config/vhosts}:/etc/apache2/sites-enabled
- ${LOG_DIR-./logs/apache2}:/var/log/apache2
- ${XDEBUG_LOG_DIR-./logs/xdebug}:/var/log/xdebug
environment:
APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT-/var/www/html}
PMA_PORT: ${HOST_MACHINE_PMA_PORT}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
HOST_MACHINE_MYSQL_PORT: ${HOST_MACHINE_MYSQL_PORT}
XDEBUG_CONFIG: "client_host=host.docker.internal remote_port=${XDEBUG_PORT}"
extra_hosts:
- "host.docker.internal:host-gateway"
database:
build:
context: "./bin/${DATABASE}"
container_name: '${COMPOSE_PROJECT_NAME}-${DATABASE}'
restart: 'always'
ports:
- "127.0.0.1:${HOST_MACHINE_MYSQL_PORT}:3306"
volumes:
- ${MYSQL_INITDB_DIR-./config/initdb}:/docker-entrypoint-initdb.d
- ${MYSQL_DATA_DIR-./data/mysql}:/var/lib/mysql
- ${MYSQL_LOG_DIR-./logs/mysql}:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: '${COMPOSE_PROJECT_NAME}-phpmyadmin'
links:
- database
environment:
PMA_HOST: database
PMA_PORT: 3306
PMA_USER: root
PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
UPLOAD_LIMIT: ${UPLOAD_LIMIT}
MEMORY_LIMIT: ${MEMORY_LIMIT}
ports:
- '${HOST_MACHINE_PMA_PORT}:80'
volumes:
- /sessions
- ${PHP_INI-./config/php/php.ini}:/usr/local/etc/php/conf.d/php-phpmyadmin.ini
redis:
container_name: '${COMPOSE_PROJECT_NAME}-redis'
image: redis:latest
ports:
- "127.0.0.1:${HOST_MACHINE_REDIS_PORT}:6379"
sphinx:
image: jc21/sphinxsearch
ports:
- 127.0.0.1:9306:9306
- 9312:9312
volumes:
- "./sphinx.conf:/etc/sphinx/"
- "./data:/var/lib/sphinx"
sphinx.confsource base
{
type = mysql
sql_host = database
sql_user = *****
sql_pass = ******
sql_db = ****
sql_port = 3306
}
source bcc : base
{
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER SET utf8
sql_query = SELECT * FROM pages
sql_field_string = page_name
sql_field_string = page_description
sql_field_string = Link
}
index index_bcc
{
source = bcc
docinfo = extern
path = /var/lib/sphinx/data/index_bcc
min_word_len = 2
min_prefix_len = 2
expand_keywords = 1
morphology = lemmatize_en_all
}
indexer
{
mem_limit = 100M
}
searchd
{
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
pid_file = /var/run/sphinx/searchd.pid
listen = 9312
listen = 9306:mysql41
}
common
{
lemmatizer_base = /var/lib/sphinx/dict
}
Делаю запрос
// Создадим объект - клиент сфинкса и подключимся к нашей службе
$cl = new SphinxClient();
$cl->SetServer( "localhost", 9312 );
// Собственно поиск
$cl->SetMatchMode( SPH_MATCH_ANY ); // ищем хотя бы 1 слово из поисковой фразы
$result = $cl->Query($query, 'index_bcc'); // поисковый запрос
В ответ получаю
Query failed: connection to localhost:9312 failed (errno=111, msg=Connection refused).
или
Query failed: connection to localhost:9312 failed (errno=101, msg=Network is unreachable).
Видимо с портами что то не так?