Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-2343] Move to DEB folder structure #19

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 21 additions & 10 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ 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}"

exec /usr/bin/setpriv \
--clear-groups \
--reuid opensearch \
--regid opensearch \
-- /bin/opensearch
-- "${OPENSEARCH_BIN}"/opensearch
Loading