Skip to content

Commit 6e94621

Browse files
committed
fess 14.11.0 and opensearch 2.11.0
1 parent 8a092b5 commit 6e94621

File tree

5 files changed

+206
-3
lines changed

5 files changed

+206
-3
lines changed

compose/compose-opensearch2.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
es01:
3-
image: ghcr.io/codelibs/fess-opensearch:2.9.0
3+
image: ghcr.io/codelibs/fess-opensearch:2.11.0
44
container_name: es01
55
environment:
66
- node.name=es01

compose/compose.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
services:
22
fess01:
3-
image: ghcr.io/codelibs/fess:14.10.1
3+
image: ghcr.io/codelibs/fess:14.11.0
44
# build: ./playwright # use Playwright
55
container_name: fess01
66
environment:
77
- "SEARCH_ENGINE_HTTP_URL=http://es01:9200"
88
- "FESS_DICTIONARY_PATH=${FESS_DICTIONARY_PATH:-/usr/share/opensearch/config/dictionary/}"
9-
# - "FESS_PLUGINS=fess-webapp-semantic-search:14.10.0 fess-ds-wikipedia:14.10.0"
9+
# - "FESS_PLUGINS=fess-webapp-semantic-search:14.11.0 fess-ds-wikipedia:14.11.0"
1010
ports:
1111
- "8080:8080"
1212
networks:

fess/14.11/Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM eclipse-temurin:17-jre-focal
2+
3+
ENV FESS_APP_TYPE docker
4+
5+
RUN apt-get update && \
6+
apt-get install -y imagemagick unoconv poppler-utils && \
7+
apt-get clean && rm -rf /var/lib/apt/lists/*
8+
9+
ARG FESS_VERSION=14.11.0
10+
11+
RUN groupadd -g 1001 fess && \
12+
useradd -u 1001 -g fess --system --no-create-home --home /var/lib/fess fess
13+
14+
ARG CACHEBUST=1
15+
RUN set -x && \
16+
curl -LfsSo /tmp/fess-${FESS_VERSION}.deb \
17+
https://github.com/codelibs/fess/releases/download/fess-${FESS_VERSION}/fess-${FESS_VERSION}.deb && \
18+
dpkg -i /tmp/fess-${FESS_VERSION}.deb && \
19+
rm -rf /tmp/fess-${FESS_VERSION}.deb && \
20+
for f in $(find /usr/share/fess/app/WEB-INF/ -type f | grep log4j2.xml) ; do sed -i 's/[^\t]*<!-- //' $f; sed -i 's/\/> -->/\/>/' $f; done && \
21+
mkdir /opt/fess && \
22+
chown -R fess.fess /opt/fess && \
23+
sed -i -e 's#FESS_CLASSPATH="$FESS_CONF_PATH:$FESS_CLASSPATH"#FESS_CLASSPATH="$FESS_OVERRIDE_CONF_PATH:$FESS_CONF_PATH:$FESS_CLASSPATH"#g' /usr/share/fess/bin/fess && \
24+
echo "export FESS_APP_TYPE=$FESS_APP_TYPE" >> /usr/share/fess/bin/fess.in.sh && \
25+
echo "export FESS_OVERRIDE_CONF_PATH=/opt/fess" >> /usr/share/fess/bin/fess.in.sh && \
26+
apt-get clean && rm -rf /var/lib/apt/lists/*
27+
28+
WORKDIR /usr/share/fess
29+
EXPOSE 8080
30+
31+
USER root
32+
COPY run.sh /usr/share/fess/run.sh
33+
ENTRYPOINT /usr/share/fess/run.sh

fess/14.11/run.sh

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#!/bin/bash
2+
3+
temp_dir=/tmp
4+
plugin_dir=/usr/share/fess/app/WEB-INF/plugin
5+
6+
print_log() {
7+
log_level=$1
8+
message=$2
9+
echo '{"@timestamp":"'$(date -u "+%Y-%m-%dT%H:%M:%S.%3NZ")'","log.level": "'${log_level}'","message":"'"${message}"'", "ecs.version": "1.2.0","service.name":"fess","event.dataset":"app","process.thread.name":"bootstrap","log.logger":"run.sh"}'
10+
}
11+
12+
if [[ "x${FESS_DICTIONARY_PATH}" != "x" ]] ; then
13+
sed -i -e "s|^FESS_DICTIONARY_PATH=.*|FESS_DICTIONARY_PATH=${FESS_DICTIONARY_PATH}|" /etc/default/fess
14+
fi
15+
16+
if [[ "x${SEARCH_ENGINE_HTTP_URL}" != "x" ]] ; then
17+
sed -i -e "s|^SEARCH_ENGINE_HTTP_URL=.*|SEARCH_ENGINE_HTTP_URL=${SEARCH_ENGINE_HTTP_URL}|" /etc/default/fess
18+
elif [[ "x${ES_HTTP_URL}" != "x" ]] ; then
19+
print_log WARN "ES_HTTP_URL is deprecated."
20+
sed -i -e "s|^SEARCH_ENGINE_HTTP_URL=.*|SEARCH_ENGINE_HTTP_URL=${ES_HTTP_URL}|" /etc/default/fess
21+
else
22+
SEARCH_ENGINE_HTTP_URL=http://localhost:9200
23+
fi
24+
25+
if [[ "x${SEARCH_ENGINE_TYPE}" != "x" ]] ; then
26+
FESS_JAVA_OPTS="${FESS_JAVA_OPTS} -Dfess.config.search_engine.type=${SEARCH_ENGINE_TYPE}"
27+
elif [[ "x${ES_TYPE}" != "x" ]] ; then
28+
print_log WARN "ES_TYPE is deprecated."
29+
FESS_JAVA_OPTS="${FESS_JAVA_OPTS} -Dfess.config.search_engine.type=${ES_TYPE}"
30+
fi
31+
32+
if [[ "x${SEARCH_ENGINE_USERNAME}" != "x" ]] ; then
33+
FESS_JAVA_OPTS="${FESS_JAVA_OPTS} -Dfess.config.search_engine.username=${SEARCH_ENGINE_USERNAME}"
34+
elif [[ "x${ES_USERNAME}" != "x" ]] ; then
35+
print_log WARN "ES_USERNAME is deprecated."
36+
FESS_JAVA_OPTS="${FESS_JAVA_OPTS} -Dfess.config.search_engine.username=${ES_USERNAME}"
37+
fi
38+
39+
if [[ "x${SEARCH_ENGINE_PASSWORD}" != "x" ]] ; then
40+
FESS_JAVA_OPTS="${FESS_JAVA_OPTS} -Dfess.config.search_engine.password=${SEARCH_ENGINE_PASSWORD}"
41+
elif [[ "x${ES_PASSWORD}" != "x" ]] ; then
42+
print_log WARN "ES_PASSWORD is deprecated."
43+
FESS_JAVA_OPTS="${FESS_JAVA_OPTS} -Dfess.config.search_engine.password=${ES_PASSWORD}"
44+
fi
45+
46+
if [[ "x${FESS_JAVA_OPTS}" != "x" ]] ; then
47+
echo "FESS_JAVA_OPTS=\"${FESS_JAVA_OPTS}\"" >> /etc/default/fess
48+
fi
49+
50+
if [[ "x${PING_RETRIES}" = "x" ]] ; then
51+
PING_RETRIES=3
52+
fi
53+
54+
if [[ "x${PING_INTERVAL}" = "x" ]] ; then
55+
PING_INTERVAL=60
56+
fi
57+
58+
download_plugin() {
59+
plugin_id=$1
60+
plugin_name=$(echo ${plugin_id} | sed -e "s/:.*//")
61+
plugin_version=$(echo ${plugin_id} | sed -e "s/.*://")
62+
if [[ ${plugin_name} == fess-ds-* ]] \
63+
|| [[ ${plugin_name} == fess-ingest-* ]] \
64+
|| [[ ${plugin_name} == fess-script-* ]] \
65+
|| [[ ${plugin_name} == fess-theme-* ]] \
66+
|| [[ ${plugin_name} == fess-webapp-* ]] \
67+
; then
68+
plugin_file="${plugin_name}-${plugin_version}.jar"
69+
if [[ ${plugin_version} == *-SNAPSHOT ]] ; then
70+
metadata_file="${temp_dir}/maven-metadata.$$"
71+
metadata_url="https://oss.sonatype.org/content/repositories/snapshots/org/codelibs/fess/${plugin_name}/${plugin_version}/maven-metadata.xml"
72+
if ! curl -fs -o "${metadata_file}" "${metadata_url}" ; then
73+
print_log ERROR "Failed to download from ${metadata_url}."
74+
return
75+
fi
76+
version_timestamp=$(cat ${metadata_file} | grep "<timestamp>" | head -n1 | sed -e "s,.*timestamp>\(.*\)</timestamp.*,\1,")
77+
version_buildnum=$(cat ${metadata_file} | grep "<buildNumber>" | head -n1 | sed -e "s,.*buildNumber>\(.*\)</buildNumber.*,\1,")
78+
rm -f ${metadata_file}
79+
plugin_file=$(echo ${plugin_file} | sed -e "s/SNAPSHOT/${version_timestamp}-${version_buildnum}/")
80+
plugin_url="https://oss.sonatype.org/content/repositories/snapshots/org/codelibs/fess/${plugin_name}/${plugin_version}/${plugin_file}"
81+
else
82+
plugin_url="https://repo.maven.apache.org/maven2/org/codelibs/fess/${plugin_name}/${plugin_version}/${plugin_file}"
83+
fi
84+
print_log INFO "Downloading from ${plugin_url}"
85+
if ! curl -fs -o "${temp_dir}/${plugin_file}" "${plugin_url}" > /dev/null; then
86+
print_log ERROR "Failed to download ${plugin_file}."
87+
return
88+
fi
89+
if ! curl -fs -o "${temp_dir}/${plugin_file}.sha1" "${plugin_url}.sha1" > /dev/null; then
90+
print_log ERROR "Failed to download ${plugin_file}.sha1."
91+
return
92+
fi
93+
if ! echo "$(cat "${temp_dir}/${plugin_file}.sha1") "${temp_dir}/${plugin_file}|sha1sum -c > /dev/null ; then
94+
print_log ERROR "Invalid checksum for ${plugin_file}."
95+
return
96+
fi
97+
print_log INFO "Installing ${plugin_file}"
98+
rm -f "${temp_dir}/${plugin_file}.sha1"
99+
mv "${temp_dir}/${plugin_file}" "${plugin_dir}"
100+
chown fess:fess "${plugin_dir}/${plugin_file}"
101+
fi
102+
}
103+
104+
start_fess() {
105+
rm -f /usr/bin/java
106+
ln -s /opt/java/openjdk/bin/java /usr/bin/java
107+
touch /var/log/fess/fess-crawler.log \
108+
/var/log/fess/fess-suggest.log \
109+
/var/log/fess/fess-thumbnail.log \
110+
/var/log/fess/fess-urls.log \
111+
/var/log/fess/audit.log \
112+
/var/log/fess/fess.log
113+
chown fess:fess /var/log/fess/fess-crawler.log \
114+
/var/log/fess/fess-suggest.log \
115+
/var/log/fess/fess-thumbnail.log \
116+
/var/log/fess/fess-urls.log \
117+
/var/log/fess/audit.log \
118+
/var/log/fess/fess.log
119+
tail -qF /var/log/fess/fess-crawler.log /var/log/fess/fess-suggest.log /var/log/fess/fess-thumbnail.log /var/log/fess/fess.log /var/log/fess/audit.log 2>/dev/null &
120+
print_log INFO "Starting Fess service."
121+
/etc/init.d/fess start > /dev/null 2>&1
122+
}
123+
124+
wait_app() {
125+
if [[ "x${FESS_CONTEXT_PATH}" = "x" ]] ; then
126+
ping_path=/api/v1/health
127+
else
128+
ping_path=${FESS_CONTEXT_PATH}/api/v1/health
129+
fi
130+
while true ; do
131+
status=$(curl -w '%{http_code}\n' -s -o /dev/null "http://localhost:8080${ping_path}")
132+
if [[ x"${status}" = x200 ]] ; then
133+
error_count=0
134+
else
135+
error_count=$((error_count + 1))
136+
fi
137+
if [[ ${error_count} -ge ${PING_RETRIES} ]] ; then
138+
print_log ERROR "Fess is not available."
139+
exit 1
140+
fi
141+
sleep ${PING_INTERVAL}
142+
done
143+
}
144+
145+
for plugin_id in $FESS_PLUGINS ; do
146+
download_plugin $(echo ${plugin_id} | sed -e "s,/,,g")
147+
done
148+
149+
start_fess
150+
151+
if [[ "x${RUN_SHELL}" = "xtrue" ]] ; then
152+
/bin/bash
153+
else
154+
wait_app
155+
fi

opensearch/2.11/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM opensearchproject/opensearch:2.11.0
2+
3+
ARG ANALYSIS_EXTENSION_PLUGIN=org.codelibs.opensearch:opensearch-analysis-extension:2.11.0
4+
ARG ANALYSIS_FESS_PLUGIN=org.codelibs.opensearch:opensearch-analysis-fess:2.11.0
5+
ARG MINHASH_PLUGIN=org.codelibs.opensearch:opensearch-minhash:2.11.0
6+
ARG CONFIGSYNC_PLUGIN=org.codelibs.opensearch:opensearch-configsync:2.11.0
7+
8+
RUN /usr/share/opensearch/bin/opensearch-plugin install $ANALYSIS_FESS_PLUGIN -b && \
9+
/usr/share/opensearch/bin/opensearch-plugin install $ANALYSIS_EXTENSION_PLUGIN -b && \
10+
/usr/share/opensearch/bin/opensearch-plugin install $MINHASH_PLUGIN -b && \
11+
/usr/share/opensearch/bin/opensearch-plugin install $CONFIGSYNC_PLUGIN -b && \
12+
echo 'configsync.config_path: ${FESS_DICTIONARY_PATH}' >> /usr/share/opensearch/config/opensearch.yml && \
13+
mkdir /usr/share/opensearch/config/dictionary && \
14+
chown opensearch /usr/share/opensearch/config/dictionary
15+

0 commit comments

Comments
 (0)