diff --git a/README.md b/README.md index f1ce67b..a484752 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ cd charmed-opensearch-rock ``` #### Installing Prerequisites ```bash -sudo snap install rockcraft --edge --classic --revision=687 +sudo snap install rockcraft --edge --classic sudo snap install docker sudo snap install lxd sudo snap install skopeo --edge --devmode diff --git a/rockcraft.yaml b/rockcraft.yaml index d43d6f1..8a4b826 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -4,7 +4,7 @@ name: charmed-opensearch # the name of your ROCK base: ubuntu:22.04 # the base environment for this ROCK license: Apache-2.0 -version: '2.9.0' # just for humans. Semantic versioning is recommended +version: '2.10.0' # just for humans. Semantic versioning is recommended summary: 'Charmed OpenSearch ROCK OCI.' description: | @@ -23,11 +23,23 @@ services: summary: Start OpenSearch command: "/bin/bash /bin/start.sh" environment: - OPENSEARCH_HOME: / - OPENSEARCH_JAVA_HOME: /jdk - OPENSEARCH_PATH_CONF: /config - OPENSEARCH_TMPDIR: /tmp - OPENSEARCH_PLUGINS: /plugins + OPS_ROOT: /opt/opensearch + + OPENSEARCH_HOME: /usr/share/opensearch + OPENSEARCH_JAVA_HOME: /usr/share/opensearch/jdk + OPENSEARCH_BIN: /usr/share/opensearch/bin + OPENSEARCH_LIB: /usr/share/opensearch/lib + OPENSEARCH_PLUGINS: /usr/share/opensearch/plugins + OPENSEARCH_MODULES: /usr/share/opensearch/modules + + OPENSEARCH_PATH_CONF: /etc/opensearch + OPENSEARCH_PATH_CERTS: /etc/opensearch/certificates + + OPENSEARCH_VARLIB: /var/lib/opensearch + OPENSEARCH_TMPDIR: /usr/share/tmp + OPENSEARCH_VARLOG: /var/log/opensearch + + KNN_LIB_DIR: /usr/share/opensearch/plugins/opensearch-knn/lib parts: opensearch-snap: @@ -67,11 +79,10 @@ parts: useradd -R ${CRAFT_OVERLAY} -M -r -g opensearch -u 1000 opensearch override-prime: | craftctl default - + # Give permission ot the required folders - chown -R 1000:1000 data/ logs/ config/ jdk/ modules/ plugins/ extensions/ performance-analyzer-rca/ - chown -R 1000:1000 lib/tools lib/*.jar - chown -R 1000:1000 bin/opensearch* + mkdir -p var/lib/opensearch usr/share/tmp var/log/opensearch + chown -R 1000:1000 etc/opensearch opt/opensearch usr/share/opensearch var/lib/opensearch usr/share/tmp var/log/opensearch entry: plugin: dump diff --git a/scripts/start.sh b/scripts/start.sh index 789ef88..4797afc 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -81,9 +81,10 @@ fi set_yaml_prop "${conf}" "network.host" "$(network_host)" set_yaml_prop "${conf}" "discovery.seed_hosts" "$(seed_hosts)" -set_yaml_prop "${conf}" "path.data" "/data" -set_yaml_prop "${conf}" "path.logs" "/logs" +set_yaml_prop "${conf}" "path.data" "${OPENSEARCH_VARLIB}/data" +set_yaml_prop "${conf}" "path.logs" "${OPENSEARCH_VARLOG}/logs" set_yaml_prop "${conf}" "plugins.security.disabled" "true" +sed -i "s@=logs/@=${OPENSEARCH_VARLOG}/@" "${OPENSEARCH_PATH_CONF}/jvm.options" cat "${conf}" @@ -91,4 +92,4 @@ exec /usr/bin/setpriv \ --clear-groups \ --reuid opensearch \ --regid opensearch \ - -- /bin/opensearch + -- "${OPENSEARCH_BIN}"/opensearch