Skip to content

Commit d4dd74f

Browse files
AlexRuiz7Jorgesnchz
authored andcommitted
Rename packages to wazuh-indexer (#69)
* Rename packages to wazuh-indexer * Include VERSION file into packages * Apply Wazuh version to packages names * Improve build.sh script Apply suggestions from ShellCheck
1 parent 8c525f8 commit d4dd74f

28 files changed

+280
-265
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.9.0
1+
4.9.0

buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionArchiveSetupPlugin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private void configureGeneralTaskDefaults(Project project) {
156156
project.getTasks().withType(AbstractArchiveTask.class).configureEach(t -> {
157157
String subdir = archiveTaskToSubprojectName(t.getName());
158158
t.getDestinationDirectory().set(project.file(subdir + "/build/distributions"));
159-
t.getArchiveBaseName().set("opensearch-min");
159+
t.getArchiveBaseName().set("wazuh-indexer-min");
160160
});
161161
}
162162

buildSrc/src/main/java/org/opensearch/gradle/internal/InternalDistributionBwcSetupPlugin.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private void registerBwcArtifacts(Project bwcProject, DistributionProject distri
123123
String expandedDistConfiguration = "expanded-" + projectName;
124124
bwcProject.getConfigurations().create(expandedDistConfiguration);
125125
bwcProject.getArtifacts().add(expandedDistConfiguration, distributionProject.getExpandedDistDirectory(), artifact -> {
126-
artifact.setName("opensearch");
126+
artifact.setName("wazuh-indexer");
127127
artifact.builtBy(buildBwcTask);
128128
artifact.setType("directory");
129129
});
@@ -132,7 +132,7 @@ private void registerBwcArtifacts(Project bwcProject, DistributionProject distri
132132

133133
private void registerDistributionArchiveArtifact(Project bwcProject, DistributionProject distributionProject, String buildBwcTask) {
134134
String artifactFileName = distributionProject.getDistFile().getName();
135-
String artifactName = "opensearch";
135+
String artifactName = "wazuh-indexer";
136136

137137
String suffix = artifactFileName.endsWith("tar.gz") ? "tar.gz" : artifactFileName.substring(artifactFileName.length() - 3);
138138
int archIndex = artifactFileName.indexOf("x64");
@@ -268,7 +268,7 @@ private static class DistributionProject {
268268
baseDir
269269
+ "/"
270270
+ name
271-
+ "/build/distributions/opensearch-min"
271+
+ "/build/distributions/wazuh-indexer-min"
272272
+ separator
273273
+ version
274274
+ "-SNAPSHOT"
@@ -279,7 +279,7 @@ private static class DistributionProject {
279279
} else {
280280
this.distFile = new File(
281281
checkoutDir,
282-
baseDir + "/" + name + "/build/distributions/opensearch-" + version + "-SNAPSHOT" + classifier + "." + extension
282+
baseDir + "/" + name + "/build/distributions/wazuh-indexer-" + version + "-SNAPSHOT" + classifier + "." + extension
283283
);
284284
}
285285
// we only ported this down to the 7.x branch.

distribution/archives/build.gradle

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ import org.opensearch.gradle.JavaPackageType
3333
apply plugin: 'opensearch.internal-distribution-archive-setup'
3434

3535
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, JavaPackageType java) {
36+
version = rootProject.file('VERSION').getText()
3637
return copySpec {
37-
into("opensearch-${version}") {
38+
into("wazuh-indexer-${version}") {
3839
into('lib') {
3940
with libFiles()
4041
}
@@ -81,6 +82,9 @@ CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String pla
8182
pluginsDir.getParent()
8283
}
8384
}
85+
into('') {
86+
with versionFile()
87+
}
8488
from(rootProject.projectDir) {
8589
include 'README.md'
8690
}

distribution/build.gradle

+23-16
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,13 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
357357
}
358358
}
359359

360+
versionFile = {
361+
copySpec {
362+
from(rootProject.file('VERSION'))
363+
fileMode 0644
364+
}
365+
}
366+
360367
modulesFiles = { platform ->
361368
copySpec {
362369
eachFile {
@@ -523,27 +530,27 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
523530
* <dt>path.conf</dt>
524531
* <dd>The default directory from which to load configuration. This is used in
525532
* the packaging scripts, but in that context it is always
526-
* /etc/opensearch. Its also used in bin/opensearch-plugin, where it is
527-
* /etc/opensearch for the os packages but $OPENSEARCH_HOME/config otherwise.</dd>
533+
* /etc/wazuh-indexer. Its also used in bin/opensearch-plugin, where it is
534+
* /etc/wazuh-indexer for the os packages but $OPENSEARCH_HOME/config otherwise.</dd>
528535
* <dt>path.env</dt>
529536
* <dd>The env file sourced before bin/opensearch to set environment
530-
* variables. Think /etc/defaults/opensearch.</dd>
537+
* variables. Think /etc/defaults/wazuh-indexer.</dd>
531538
* <dt>heap.min and heap.max</dt>
532539
* <dd>Default min and max heap</dd>
533540
* <dt>scripts.footer</dt>
534541
* <dd>Footer appended to control scripts embedded in the distribution that is
535542
* (almost) entirely there for cosmetic reasons.</dd>
536543
* <dt>stopping.timeout</dt>
537-
* <dd>RPM's init script needs to wait for opensearch to stop before
544+
* <dd>RPM's init script needs to wait for wazuh-indexer to stop before
538545
* returning from stop and it needs a maximum time to wait. This is it. One
539546
* day. DEB retries forever.</dd>
540547
* </dl>
541548
*/
542549
subprojects {
543550
ext.expansionsForDistribution = { distributionType, jdk ->
544551
final String defaultHeapSize = "1g"
545-
final String packagingPathData = "path.data: /var/lib/opensearch"
546-
final String pathLogs = "/var/log/opensearch"
552+
final String packagingPathData = "path.data: /var/lib/wazuh-indexer"
553+
final String pathLogs = "/var/log/wazuh-indexer"
547554
final String packagingPathLogs = "path.logs: ${pathLogs}"
548555
final String packagingLoggc = "${pathLogs}/gc.log"
549556

@@ -558,8 +565,8 @@ subprojects {
558565
'project.version': version,
559566

560567
'path.conf': [
561-
'deb': '/etc/opensearch',
562-
'rpm': '/etc/opensearch',
568+
'deb': '/etc/wazuh-indexer',
569+
'rpm': '/etc/wazuh-indexer',
563570
'def': '"$OPENSEARCH_HOME"/config'
564571
],
565572
'path.data': [
@@ -568,15 +575,15 @@ subprojects {
568575
'def': '#path.data: /path/to/data'
569576
],
570577
'path.env': [
571-
'deb': '/etc/default/opensearch',
572-
'rpm': '/etc/sysconfig/opensearch',
578+
'deb': '/etc/default/wazuh-indexer',
579+
'rpm': '/etc/sysconfig/wazuh-indexer',
573580
/* There isn't one of these files for tar or zip but its important to
574581
make an empty string here so the script can properly skip it. */
575582
'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; done',
576583
],
577584
'source.path.env': [
578-
'deb': 'source /etc/default/opensearch',
579-
'rpm': 'source /etc/sysconfig/opensearch',
585+
'deb': 'source /etc/default/wazuh-indexer',
586+
'rpm': 'source /etc/sysconfig/wazuh-indexer',
580587
'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; fi',
581588
],
582589
'path.logs': [
@@ -594,14 +601,14 @@ subprojects {
594601
'heap.max': defaultHeapSize,
595602

596603
'heap.dump.path': [
597-
'deb': "-XX:HeapDumpPath=/var/lib/opensearch",
598-
'rpm': "-XX:HeapDumpPath=/var/lib/opensearch",
604+
'deb': "-XX:HeapDumpPath=/var/lib/wazuh-indexer",
605+
'rpm': "-XX:HeapDumpPath=/var/lib/wazuh-indexer",
599606
'def': "-XX:HeapDumpPath=data"
600607
],
601608

602609
'error.file': [
603-
'deb': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log",
604-
'rpm': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log",
610+
'deb': "-XX:ErrorFile=/usr/share/wazuh-indexer/hs_err_pid%p.log",
611+
'rpm': "-XX:ErrorFile=/usr/share/wazuh-indexer/hs_err_pid%p.log",
605612
'def': "-XX:ErrorFile=logs/hs_err_pid%p.log"
606613
],
607614

distribution/docker/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ext.expansions = { Architecture architecture, DockerBase base, boolean local ->
6060
classifier = "linux-\$(arch)"
6161
}
6262

63-
final String opensearch = "opensearch-min-${VersionProperties.getOpenSearch()}-${classifier}.tar.gz"
63+
final String opensearch = "wazuh-indexer-min-${VersionProperties.getOpenSearch()}-${classifier}.tar.gz"
6464

6565
/* Both the following Dockerfile commands put the resulting artifact at
6666
* the same location, regardless of classifier, so that the commands that

distribution/docker/docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
- node.store.allow_mmap=false
1919
volumes:
2020
- ./build/repo:/tmp/opensearch-repo
21-
- ./build/logs/1:/usr/share/opensearch/logs
21+
- ./build/logs/1:/usr/share/wazuh-indexer/logs
2222
ports:
2323
- "9200"
2424
ulimits:
@@ -42,7 +42,7 @@ services:
4242
- node.store.allow_mmap=false
4343
volumes:
4444
- ./build/repo:/tmp/opensearch-repo
45-
- ./build/logs/2:/usr/share/opensearch/logs
45+
- ./build/logs/2:/usr/share/wazuh-indexer/logs
4646
ports:
4747
- "9200"
4848
ulimits:
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
set -e -o pipefail
33

4-
cd /usr/share/opensearch/bin/
4+
cd /usr/share/wazuh-indexer/bin/
55

6-
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/opensearch/logs/console.log
6+
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/wazuh-indexer/logs/console.log

distribution/docker/src/docker/Dockerfile

+12-12
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ RUN set -eux ; \\
4040
mv \${tini_bin} /tini ; \\
4141
chmod +x /tini
4242
43-
RUN mkdir /usr/share/opensearch
44-
WORKDIR /usr/share/opensearch
43+
RUN mkdir /usr/share/wazuh-indexer
44+
WORKDIR /usr/share/wazuh-indexer
4545
4646
${source_opensearch}
4747
4848
RUN tar zxf /opt/opensearch.tar.gz --strip-components=1
49-
RUN sed -i -e 's/OPENSEARCH_DISTRIBUTION_TYPE=tar/OPENSEARCH_DISTRIBUTION_TYPE=docker/' /usr/share/opensearch/bin/opensearch-env
49+
RUN sed -i -e 's/OPENSEARCH_DISTRIBUTION_TYPE=tar/OPENSEARCH_DISTRIBUTION_TYPE=docker/' /usr/share/wazuh-indexer/bin/opensearch-env
5050
RUN mkdir -p config config/jvm.options.d data logs
5151
RUN chmod 0775 config config/jvm.options.d data logs
5252
COPY config/opensearch.yml config/log4j2.properties config/
@@ -74,27 +74,27 @@ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \\
7474
done; \\
7575
(exit \$exit_code)
7676
77-
RUN groupadd -g 1000 opensearch && \\
78-
adduser -u 1000 -g 1000 -G 0 -d /usr/share/opensearch opensearch && \\
79-
chmod 0775 /usr/share/opensearch && \\
80-
chown -R 1000:0 /usr/share/opensearch
77+
RUN groupadd -g 1000 wazuh-indexer && \\
78+
adduser -u 1000 -g 1000 -G 0 -d /usr/share/wazuh-indexer wazuh-indexer && \\
79+
chmod 0775 /usr/share/wazuh-indexer && \\
80+
chown -R 1000:0 /usr/share/wazuh-indexer
8181
82-
WORKDIR /usr/share/opensearch
83-
COPY --from=builder --chown=1000:0 /usr/share/opensearch /usr/share/opensearch
82+
WORKDIR /usr/share/wazuh-indexer
83+
COPY --from=builder --chown=1000:0 /usr/share/wazuh-indexer /usr/share/wazuh-indexer
8484
COPY --from=builder --chown=0:0 /tini /tini
8585
8686
# Replace OpenJDK's built-in CA certificate keystore with the one from the OS
8787
# vendor. The latter is superior in several ways.
8888
# REF: https://github.com/elastic/elasticsearch-docker/issues/171
89-
RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/opensearch/jdk/lib/security/cacerts
89+
RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/wazuh-indexer/jdk/lib/security/cacerts
9090

91-
ENV PATH /usr/share/opensearch/bin:\$PATH
91+
ENV PATH /usr/share/wazuh-indexer/bin:\$PATH
9292

9393
COPY bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
9494

9595
# The JDK's directories' permissions don't allow `java` to be executed under a different
9696
# group to the default. Fix this.
97-
RUN find /usr/share/opensearch/jdk -type d -exec chmod 0755 '{}' \\; && \\
97+
RUN find /usr/share/wazuh-indexer/jdk -type d -exec chmod 0755 '{}' \\; && \\
9898
chmod g=u /etc/passwd && \\
9999
chmod 0775 /usr/local/bin/docker-entrypoint.sh
100100

distribution/docker/src/docker/bin/docker-entrypoint.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fi
4646
# This is also sourced in opensearch-env, and is only needed here
4747
# as well because we use ELASTIC_PASSWORD below. Sourcing this script
4848
# is idempotent.
49-
source /usr/share/opensearch/bin/opensearch-env-from-file
49+
source /usr/share/wazuh-indexer/bin/opensearch-env-from-file
5050

5151
if [[ -f bin/opensearch-users ]]; then
5252
# Check for the ELASTIC_PASSWORD environment variable to set the
@@ -56,7 +56,7 @@ if [[ -f bin/opensearch-users ]]; then
5656
# enabled, but we have no way of knowing which node we are yet. We'll just
5757
# honor the variable if it's present.
5858
if [[ -n "$ELASTIC_PASSWORD" ]]; then
59-
[[ -f /usr/share/opensearch/config/opensearch.keystore ]] || (run_as_other_user_if_needed opensearch-keystore create)
59+
[[ -f /usr/share/wazuh-indexer/config/opensearch.keystore ]] || (run_as_other_user_if_needed opensearch-keystore create)
6060
if ! (run_as_other_user_if_needed opensearch-keystore has-passwd --silent) ; then
6161
# keystore is unencrypted
6262
if ! (run_as_other_user_if_needed opensearch-keystore list | grep -q '^bootstrap.password$'); then
@@ -76,8 +76,8 @@ fi
7676
if [[ "$(id -u)" == "0" ]]; then
7777
# If requested and running as root, mutate the ownership of bind-mounts
7878
if [[ -n "$TAKE_FILE_OWNERSHIP" ]]; then
79-
chown -R 1000:0 /usr/share/opensearch/{data,logs}
79+
chown -R 1000:0 /usr/share/wazuh-indexer/{data,logs}
8080
fi
8181
fi
8282

83-
run_as_other_user_if_needed /usr/share/opensearch/bin/opensearch <<<"$KEYSTORE_PASSWORD"
83+
run_as_other_user_if_needed /usr/share/wazuh-indexer/bin/opensearch <<<"$KEYSTORE_PASSWORD"

0 commit comments

Comments
 (0)