From 07d1b6591f33445ee4822e8a0868af691326eab8 Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 18:00:09 +0800 Subject: [PATCH 1/8] Update dependency --- lbbs | 2 +- leafok_bbs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lbbs b/lbbs index 9df433f..b81d4f0 160000 --- a/lbbs +++ b/lbbs @@ -1 +1 @@ -Subproject commit 9df433f89015f7b4525b59229bc1fb3062be9c60 +Subproject commit b81d4f011035082ebedd5404b9f24f22c19f8975 diff --git a/leafok_bbs b/leafok_bbs index 1f81af7..0200ff4 160000 --- a/leafok_bbs +++ b/leafok_bbs @@ -1 +1 @@ -Subproject commit 1f81af7197fc75076b5c94fea1882362ef05f314 +Subproject commit 0200ff49e2306d1f89d416db478604ea81a0d835 From 70c35243adf845f804448f911f91c6082c34e6fe Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 20:59:49 +0800 Subject: [PATCH 2/8] Update README --- README.md | 7 ++++++- README.zh_CN.md | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 578646e..faa9cc0 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,14 @@ docker compose pull docker compose up -d ``` +### Update Solr data from database, on demand or periodically +```bash +docker exec -it lbbs-combo-php-1 /usr/local/bin/export_xml_to_solr.sh +``` + ## Copyright -Copyright (C) 2004-2026 Leaflet +Copyright (C) 2001-2026 Leaflet ## License diff --git a/README.zh_CN.md b/README.zh_CN.md index b08c034..7e3855c 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -29,10 +29,15 @@ docker compose pull docker compose up -d ``` +### 根据需要或定期从数据库更新 Solr 数据 +```bash +docker exec -it lbbs-combo-php-1 /usr/local/bin/export_xml_to_solr.sh +``` + ## 版权 -版权所有 (C) 2004-2026 Leaflet +版权所有 (C) 2001-2026 Leaflet ## 许可证 -本程序是自由软件;您可以依据自由软件基金会发布的 [GNU 通用公共许可证](LICENSE) 条款重新发布和/或修改本程序;许可证版本为第 3 版,或者(您可选)任何更高版本。 \ No newline at end of file +本程序是自由软件;您可以依据自由软件基金会发布的 [GNU 通用公共许可证](LICENSE) 条款重新发布和/或修改本程序;许可证版本为第 3 版,或者(您可选)任何更高版本。 From 841baa6cafbd6e9855be1b3782df79c9a86c6aea Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 21:01:26 +0800 Subject: [PATCH 3/8] Add Solr container related configuration and script files --- Dockerfile/dockerfile.apache.testing | 4 +++- Dockerfile/dockerfile.php.testing | 8 ++++++++ conf/solr.conf.php | 10 ++++++++++ docker-compose.yml | 21 +++++++++++++++++++++ script/export_xml_to_solr.sh | 17 +++++++++++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 conf/solr.conf.php create mode 100644 script/export_xml_to_solr.sh diff --git a/Dockerfile/dockerfile.apache.testing b/Dockerfile/dockerfile.apache.testing index 0ce8620..f060e2b 100644 --- a/Dockerfile/dockerfile.apache.testing +++ b/Dockerfile/dockerfile.apache.testing @@ -24,7 +24,8 @@ COPY ./leafok_bbs/manage /var/www/html/manage RUN mkdir -p /var/www/html/bbs/cache \ /var/www/html/bbs/upload \ /var/www/html/bbs/images/face/upload_photo \ - /var/www/html/conf /var/www/html/stat + /var/www/html/conf /var/www/html/stat \ + /var/www/html/export_xml # Copy the composer binary from the installer stage into your final image COPY --from=composer_installer /usr/local/composer/vendor /var/www/html/vendor @@ -34,6 +35,7 @@ COPY ./conf/site.conf.php /var/www/html/conf/site.conf.php COPY ./conf/smtp.conf.php /var/www/html/conf/smtp.conf.php COPY ./leafok_bbs/TODO/conf/badwords.conf /var/www/html/conf/badwords.conf COPY ./leafok_bbs/TODO/conf/deny_reg.conf /var/www/html/conf/deny_reg.conf +COPY ./conf/solr.conf.php /var/www/html/conf/solr.conf.php COPY ./data/eula.txt /var/www/html/bbs/doc/eula.txt diff --git a/Dockerfile/dockerfile.php.testing b/Dockerfile/dockerfile.php.testing index 45163b3..2de9724 100644 --- a/Dockerfile/dockerfile.php.testing +++ b/Dockerfile/dockerfile.php.testing @@ -4,6 +4,7 @@ FROM php:8.4-fpm # Install PHP extensions RUN apt-get update && apt-get install -y \ libfreetype-dev libjpeg62-turbo-dev libpng-dev \ + libcurl4-openssl-dev libxml2-dev \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) gd mysqli \ && rm -rf /var/lib/apt/lists/* @@ -14,3 +15,10 @@ COPY ./leafok_bbs/Dockerfile/php.ini /usr/local/etc/php/php.ini # Set ownership to www-data user and group RUN mkdir -p /var/lib/php/sessions \ && chown -R www-data:www-data /var/lib/php/sessions + +# Install the solr extension via PECL +RUN pecl install solr \ + && docker-php-ext-enable solr + +COPY ./script/export_xml_to_solr.sh /usr/local/bin/export_xml_to_solr.sh +RUN chmod +x /usr/local/bin/export_xml_to_solr.sh diff --git a/conf/solr.conf.php b/conf/solr.conf.php new file mode 100644 index 0000000..6fa78dd --- /dev/null +++ b/conf/solr.conf.php @@ -0,0 +1,10 @@ + "solr", + "port" => "8983", + // "login" => "username", + // "password" => "password", + // "auth" => "HTTPBasicAuth", + "path" => "/solr/lbbs", + ); diff --git a/docker-compose.yml b/docker-compose.yml index 505cf19..f827061 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,23 @@ services: - --innodb-buffer-pool-size=64M - --max-connections=15 + solr: + image: solr + platform: ${RUN_PLATFORM} + restart: unless-stopped + volumes: + - solr-data:/var/solr + - ./solr-config/conf:/opt/solr/server/solr/configsets/lbbs/conf + environment: + SOLR_OPTS: "-Dsolr.config.lib.enabled=true" + SOLR_JAVA_MEM: "-Xms256m -Xmx512m" + command: + - solr-precreate + - lbbs + - /opt/solr/server/solr/configsets/lbbs + networks: + - app-network + apache: image: leafok/lbbs-apache:testing platform: ${RUN_PLATFORM} @@ -33,6 +50,7 @@ services: - apache-logs:/usr/local/apache2/logs depends_on: - php + - solr networks: - app-network @@ -107,6 +125,9 @@ volumes: mysql-data: # Volume for persistent storage of mysql data driver: local + solr-data: + # Volume for persistent storage of solr data + driver: local www-data: # Volume for persistent storage of web data driver: local diff --git a/script/export_xml_to_solr.sh b/script/export_xml_to_solr.sh new file mode 100644 index 0000000..f416461 --- /dev/null +++ b/script/export_xml_to_solr.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +php /var/www/html/manage/export_article.php 2>/dev/null | +while read file; do + echo $file + curl http://solr:8983/solr/lbbs/update -X POST -H 'Content-type:text/xml' \ + --data-binary @/var/www/html/export_xml/$file.xml 2>/dev/null + if [ $? -ne 0 ]; then + echo "Solr update failed!" + exit 2 + fi +done + +if [ $? -ne 0 ]; then + echo "Export XML data failed!" + exit 1 +fi From f9dc540aaee59904d74705e883eb3d26777c7e3d Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 21:35:20 +0800 Subject: [PATCH 4/8] Update dependency --- leafok_bbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leafok_bbs b/leafok_bbs index 0200ff4..3229c0b 160000 --- a/leafok_bbs +++ b/leafok_bbs @@ -1 +1 @@ -Subproject commit 0200ff49e2306d1f89d416db478604ea81a0d835 +Subproject commit 3229c0bcba40b083cc4442e231ca5961b7c5a7ca From 4b7dc87622c37dbbb01588f3889ee26ea1e56051 Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 22:34:23 +0800 Subject: [PATCH 5/8] Add Solr configset for lbbs --- solr-config/conf/managed-schema.xml | 180 +++++ solr-config/conf/solrconfig.xml | 1028 +++++++++++++++++++++++++++ solr-config/conf/stopwords.txt | 14 + solr-config/conf/synonyms.txt | 29 + 4 files changed, 1251 insertions(+) create mode 100644 solr-config/conf/managed-schema.xml create mode 100644 solr-config/conf/solrconfig.xml create mode 100644 solr-config/conf/stopwords.txt create mode 100644 solr-config/conf/synonyms.txt diff --git a/solr-config/conf/managed-schema.xml b/solr-config/conf/managed-schema.xml new file mode 100644 index 0000000..d2b3eee --- /dev/null +++ b/solr-config/conf/managed-schema.xml @@ -0,0 +1,180 @@ + + + + id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/solr-config/conf/solrconfig.xml b/solr-config/conf/solrconfig.xml new file mode 100644 index 0000000..d6703b2 --- /dev/null +++ b/solr-config/conf/solrconfig.xml @@ -0,0 +1,1028 @@ + + + + + + + + + 9.12 + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.lock.type:native} + + + + + + + + + + + + + + + + + + + + + ${solr.ulog.dir:} + + + + + ${solr.autoCommit.maxTime:15000} + false + + + + + + ${solr.autoSoftCommit.maxTime:3000} + + + + + + + + + + + + + + ${solr.max.booleanClauses:1024} + + + ${solr.query.minPrefixLength:-1} + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + explicit + 10 + + + + + + + explicit + json + true + + + + + + + _text_ + + + + + + + text_general + + + + + + default + _text_ + solr.DirectSolrSpellChecker + + internal + + 0.5 + + 2 + + 1 + + 5 + + 4 + + 0.01 + + + + + + + + + + + + default + on + true + 10 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + [^\w-\.] + _ + + + 1000 + true + + + + + + + yyyy-MM-dd['T'[HH:mm[:ss[.SSS]][z + yyyy-MM-dd['T'[HH:mm[:ss[,SSS]][z + yyyy-MM-dd HH:mm[:ss[.SSS]][z + yyyy-MM-dd HH:mm[:ss[,SSS]][z + [EEE, ]dd MMM yyyy HH:mm[:ss] z + EEEE, dd-MMM-yy HH:mm:ss z + EEE MMM ppd HH:mm:ss [z ]yyyy + + + + + java.lang.String + text_general + + *_str + 256 + + + true + + + java.lang.Boolean + booleans + + + java.util.Date + pdates + + + java.lang.Long + java.lang.Integer + plongs + + + java.lang.Number + pdoubles + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/solr-config/conf/stopwords.txt b/solr-config/conf/stopwords.txt new file mode 100644 index 0000000..ae1e83e --- /dev/null +++ b/solr-config/conf/stopwords.txt @@ -0,0 +1,14 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/solr-config/conf/synonyms.txt b/solr-config/conf/synonyms.txt new file mode 100644 index 0000000..eab4ee8 --- /dev/null +++ b/solr-config/conf/synonyms.txt @@ -0,0 +1,29 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +#some test synonym mappings unlikely to appear in real input text +aaafoo => aaabar +bbbfoo => bbbfoo bbbbar +cccfoo => cccbar cccbaz +fooaaa,baraaa,bazaaa + +# Some synonym groups specific to this example +GB,gib,gigabyte,gigabytes +MB,mib,megabyte,megabytes +Television, Televisions, TV, TVs +#notice we use "gib" instead of "GiB" so any WordDelimiterGraphFilter coming +#after us won't split it into two words. + +# Synonym mappings can be used for spelling correction too +pixima => pixma + From 8154c1fe8f7426ab16390d41265cc603d709e1e5 Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 22:36:17 +0800 Subject: [PATCH 6/8] Add Dockerfile for lbbs-solr:testing --- Dockerfile/dockerfile.solr.testing | 13 +++++++++++++ docker-compose.yml | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 Dockerfile/dockerfile.solr.testing diff --git a/Dockerfile/dockerfile.solr.testing b/Dockerfile/dockerfile.solr.testing new file mode 100644 index 0000000..1c19b0a --- /dev/null +++ b/Dockerfile/dockerfile.solr.testing @@ -0,0 +1,13 @@ +FROM solr:9.10 AS base + +# Start from the official Solr slim image +FROM solr:9.10-slim + +# Copy the composer binary from the installer stage into your final image +COPY --from=base /opt/solr/modules/analysis-extras/lib/lucene-analysis-smartcn-*.jar /opt/solr/modules/analysis-extras/lib/ + +# Copy custom Solr configuration +COPY ./solr-config /opt/solr/server/solr/configsets/lbbs + +# Set environment variable to enable config library +ENV SOLR_CONFIG_LIB_ENABLED="true" diff --git a/docker-compose.yml b/docker-compose.yml index f827061..4d1fc7b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,14 +20,15 @@ services: - --max-connections=15 solr: - image: solr + image: leafok/lbbs-solr:testing platform: ${RUN_PLATFORM} restart: unless-stopped + build: + context: . + dockerfile: Dockerfile/dockerfile.solr.testing volumes: - solr-data:/var/solr - - ./solr-config/conf:/opt/solr/server/solr/configsets/lbbs/conf environment: - SOLR_OPTS: "-Dsolr.config.lib.enabled=true" SOLR_JAVA_MEM: "-Xms256m -Xmx512m" command: - solr-precreate From 4b33aa6ac113164b95b6d7868cfa96b31affaa6e Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 22:58:08 +0800 Subject: [PATCH 7/8] Add build and publish for lbbs-solr:testing --- .github/workflows/docker-publish.yml | 14 ++++++++++++++ build.sh | 2 ++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 358a2eb..dbdb615 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -15,6 +15,7 @@ on: env: DOCKERHUB_PLATFORMS: linux/amd64,linux/arm64 + SOLR_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/lbbs-solr APACHE_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/lbbs-apache PHP_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/lbbs-php BBSD_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/lbbs-bbsd @@ -50,6 +51,19 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Build the Docker image (solr) + id: push-solr + uses: docker/build-push-action@v5 + with: + platforms: ${{ env.DOCKERHUB_PLATFORMS }} + context: . + file: Dockerfile/dockerfile.solr.testing + push: true + tags: | + ${{ env.SOLR_IMAGE }}:testing-${{ env.BUILD_DATE }} + ${{ env.SOLR_IMAGE }}:testing + labels: ${{ steps.meta.outputs.labels }} + - name: Build the Docker image (apache) id: push-apache uses: docker/build-push-action@v5 diff --git a/build.sh b/build.sh index bcd8b02..56f2f05 100644 --- a/build.sh +++ b/build.sh @@ -20,10 +20,12 @@ fi docker buildx inspect multi-platform-builder --bootstrap +docker buildx build . --platform=$DOCKER_PLATFORMS --file Dockerfile/dockerfile.solr.testing --tag leafok/lbbs-solr:testing docker buildx build . --platform=$DOCKER_PLATFORMS --file Dockerfile/dockerfile.apache.testing --tag leafok/lbbs-apache:testing docker buildx build . --platform=$DOCKER_PLATFORMS --file Dockerfile/dockerfile.php.testing --tag leafok/lbbs-php:testing docker buildx build . --platform=$DOCKER_PLATFORMS --file Dockerfile/dockerfile.bbsd.testing --tag leafok/lbbs-bbsd:testing +docker buildx build . --platform=$RUN_PLATFORM --file Dockerfile/dockerfile.solr.testing --tag leafok/lbbs-solr:testing --load docker buildx build . --platform=$RUN_PLATFORM --file Dockerfile/dockerfile.apache.testing --tag leafok/lbbs-apache:testing --load docker buildx build . --platform=$RUN_PLATFORM --file Dockerfile/dockerfile.php.testing --tag leafok/lbbs-php:testing --load docker buildx build . --platform=$RUN_PLATFORM --file Dockerfile/dockerfile.bbsd.testing --tag leafok/lbbs-bbsd:testing --load From eb377c688eb69f31ad85d57113316fa8ea4a774c Mon Sep 17 00:00:00 2001 From: Leaflet Date: Thu, 22 Jan 2026 23:14:20 +0800 Subject: [PATCH 8/8] Update dependency --- leafok_bbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leafok_bbs b/leafok_bbs index 3229c0b..599917b 160000 --- a/leafok_bbs +++ b/leafok_bbs @@ -1 +1 @@ -Subproject commit 3229c0bcba40b083cc4442e231ca5961b7c5a7ca +Subproject commit 599917b33a16f81fda0974a087513c2f67f1ad97