fix
This commit is contained in:
@@ -76,23 +76,25 @@ services:
|
|||||||
|
|
||||||
|
|
||||||
opensearch:
|
opensearch:
|
||||||
image: opensearchproject/opensearch:3.2.0
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: opensearch.Dockerfile
|
||||||
# No port mapping - only accessible within the Docker network
|
# No port mapping - only accessible within the Docker network
|
||||||
environment:
|
environment:
|
||||||
- cluster.name=storycove-opensearch
|
- cluster.name=storycove-opensearch
|
||||||
- node.name=opensearch-node
|
- node.name=opensearch-node
|
||||||
- discovery.type=single-node
|
- discovery.type=single-node
|
||||||
- bootstrap.memory_lock=false
|
- bootstrap.memory_lock=false
|
||||||
- "OPENSEARCH_JAVA_OPTS=-Xms128m -Xmx256m"
|
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx1g"
|
||||||
- "DISABLE_INSTALL_DEMO_CONFIG=true"
|
- "DISABLE_INSTALL_DEMO_CONFIG=true"
|
||||||
- "DISABLE_SECURITY_PLUGIN=true"
|
- "DISABLE_SECURITY_PLUGIN=true"
|
||||||
- "DISABLE_PERFORMANCE_ANALYZER_AGENT_CLI=true"
|
- "DISABLE_PERFORMANCE_ANALYZER_AGENT_CLI=true"
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 512M
|
memory: 2G
|
||||||
reservations:
|
reservations:
|
||||||
memory: 256M
|
memory: 1G
|
||||||
ulimits:
|
ulimits:
|
||||||
memlock:
|
memlock:
|
||||||
soft: -1
|
soft: -1
|
||||||
@@ -102,18 +104,6 @@ services:
|
|||||||
hard: 65536
|
hard: 65536
|
||||||
volumes:
|
volumes:
|
||||||
- opensearch_data:/usr/share/opensearch/data
|
- opensearch_data:/usr/share/opensearch/data
|
||||||
command: >
|
|
||||||
bash -c "
|
|
||||||
echo 'Starting OpenSearch with debug output...'
|
|
||||||
echo 'Java version:'
|
|
||||||
java -version
|
|
||||||
echo 'Memory info:'
|
|
||||||
free -h
|
|
||||||
echo 'Disk space:'
|
|
||||||
df -h
|
|
||||||
echo 'Starting OpenSearch...'
|
|
||||||
exec /usr/share/opensearch/opensearch-docker-entrypoint.sh opensearch
|
|
||||||
"
|
|
||||||
networks:
|
networks:
|
||||||
- storycove-network
|
- storycove-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
53
opensearch.Dockerfile
Normal file
53
opensearch.Dockerfile
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Custom OpenSearch Dockerfile with Java 21 for compatibility
|
||||||
|
FROM amazoncorretto:21-alpine AS java-base
|
||||||
|
|
||||||
|
# Download and extract OpenSearch
|
||||||
|
FROM java-base AS opensearch-builder
|
||||||
|
WORKDIR /tmp
|
||||||
|
RUN apk add --no-cache curl tar && \
|
||||||
|
curl -L https://artifacts.opensearch.org/releases/bundle/opensearch/3.2.0/opensearch-3.2.0-linux-x64.tar.gz | \
|
||||||
|
tar -xz && \
|
||||||
|
mv opensearch-3.2.0 /usr/share/opensearch
|
||||||
|
|
||||||
|
# Final runtime image
|
||||||
|
FROM java-base
|
||||||
|
WORKDIR /usr/share/opensearch
|
||||||
|
|
||||||
|
# Create opensearch user
|
||||||
|
RUN addgroup -g 1000 opensearch && \
|
||||||
|
adduser -u 1000 -G opensearch -s /bin/sh -D opensearch
|
||||||
|
|
||||||
|
# Copy OpenSearch from builder stage
|
||||||
|
COPY --from=opensearch-builder --chown=opensearch:opensearch /usr/share/opensearch /usr/share/opensearch
|
||||||
|
|
||||||
|
# Install necessary packages
|
||||||
|
RUN apk add --no-cache bash curl
|
||||||
|
|
||||||
|
# Debug: Check Java installation and set correct paths
|
||||||
|
RUN which java && java -version && \
|
||||||
|
ls -la /usr/lib/jvm/ && \
|
||||||
|
ln -sf /usr/lib/jvm/java-21-amazon-corretto /usr/lib/jvm/default-jvm
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto
|
||||||
|
ENV OPENSEARCH_JAVA_HOME=/usr/lib/jvm/java-21-amazon-corretto
|
||||||
|
ENV PATH=$PATH:$JAVA_HOME/bin
|
||||||
|
|
||||||
|
# Create required directories and disable security plugin
|
||||||
|
RUN mkdir -p /usr/share/opensearch/data && \
|
||||||
|
mkdir -p /usr/share/opensearch/logs && \
|
||||||
|
echo "plugins.security.disabled: true" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||||
|
echo "discovery.type: single-node" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||||
|
echo "cluster.name: storycove-opensearch" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||||
|
echo "node.name: opensearch-node" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||||
|
echo "bootstrap.memory_lock: false" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||||
|
echo "network.host: 0.0.0.0" >> /usr/share/opensearch/config/opensearch.yml && \
|
||||||
|
rm -rf /usr/share/opensearch/plugins/opensearch-performance-analyzer && \
|
||||||
|
chown -R opensearch:opensearch /usr/share/opensearch
|
||||||
|
|
||||||
|
USER opensearch
|
||||||
|
|
||||||
|
EXPOSE 9200 9300
|
||||||
|
|
||||||
|
# Use direct startup command since we're using the tarball distribution
|
||||||
|
ENTRYPOINT ["/usr/share/opensearch/bin/opensearch"]
|
||||||
Reference in New Issue
Block a user