-
Notifications
You must be signed in to change notification settings - Fork 2
/
rockcraft.yaml
96 lines (79 loc) · 2.93 KB
/
rockcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# 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
license: Apache-2.0
version: '2.17.0' # just for humans. Semantic versioning is recommended
summary: 'Charmed OpenSearch ROCK OCI.'
description: |
OpenSearch is a community-driven, Apache 2.0-licensed open source search and
analytics suite that makes it easy to ingest, search, visualize, and analyze data.
Developers build with OpenSearch for use cases such as application search,
log analytics, data observability, data ingestion, and more.
platforms: # The platforms this ROCK should be built on and run on
amd64:
services:
opensearch:
override: replace
startup: enabled
summary: Start OpenSearch
command: "/bin/bash /bin/start.sh"
environment:
OPS_ROOT: /opt/opensearch
OPENSEARCH_HOME: /usr/share/opensearch
JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
OPENSEARCH_JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
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:
plugin: nil
stage-snaps:
- opensearch/2/edge
stage-packages:
- curl
- python3
- python3-yaml
- 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
entry:
plugin: dump
source: scripts
organize:
start.sh: bin/start.sh
set_conf.py: bin/set_conf.py
stage:
- bin/start.sh
- bin/set_conf.py