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-5829] feat: Switch to 24.04 base #34

Merged
merged 11 commits into from
Nov 22, 2024
Merged
Changes from 6 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -92,11 +92,11 @@ jobs:
# skopeo
sudo snap install --devmode --channel edge skopeo
sudo snap install yq

- name: Create local image
run: |
version="$(cat rockcraft.yaml | yq .version)"

sudo skopeo \
--insecure-policy \
copy \
34 changes: 16 additions & 18 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
name: charmed-opensearch # the name of your ROCK
base: ubuntu:22.04 # the base environment for this ROCK
base: ubuntu@24.04 # the base environment for this ROCK
license: Apache-2.0

version: '2.17.0' # just for humans. Semantic versioning is recommended
@@ -16,6 +16,8 @@ description: |
platforms: # The platforms this ROCK should be built on and run on
amd64:

run_user: _daemon_

services:
opensearch:
override: replace
@@ -46,51 +48,47 @@ parts:
opensearch-snap:
plugin: nil
stage-snaps:
- opensearch/2/edge
- opensearch/2/edge/core2404
stage-packages:
- curl
- python3
- base-files
- python3-venv
- python3-yaml
- curl
- util-linux
override-prime: |
craftctl default

# opensearch
mkdir -p data
mkdir -p extensions

# enable security monitoring
rocks=usr/share/rocks/
mkdir -p ${rocks}

## for deb packages
dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W > ${rocks}/dpkg.query

## for snap packages
cp snap.opensearch/manifest.yaml ${rocks}
cp snap.opensearch/snapcraft.yaml ${rocks}


non-root-user:
plugin: nil
after: [opensearch-snap]
overlay-script: |
# Create a user in the $CRAFT_OVERLAY chroot
groupadd -R ${CRAFT_OVERLAY} -g 1000 opensearch
useradd -R ${CRAFT_OVERLAY} -M -r -g opensearch -u 1000 opensearch
override-prime: |
craftctl default

# Give permission ot the required folders
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
chown -R 584792:584792 etc/opensearch opt/opensearch usr/share/opensearch var/lib/opensearch usr/share/tmp var/log/opensearch

entry:
plugin: dump
source: scripts
organize:
start.sh: bin/start.sh
set_conf.py: bin/set_conf.py
start.sh: usr/bin/start.sh
set_conf.py: usr/bin/set_conf.py
stage:
- bin/start.sh
- bin/set_conf.py
- usr/bin/start.sh
- usr/bin/set_conf.py
6 changes: 1 addition & 5 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -88,8 +88,4 @@ sed -i "s@=logs/@=${OPENSEARCH_VARLOG}/@" "${OPENSEARCH_PATH_CONF}/jvm.options"

cat "${conf}"

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