Skip to content

Commit

Permalink
Merge pull request #204 from Automattic/fix-es
Browse files Browse the repository at this point in the history
fix(elasticsearch): set permissions on startup
  • Loading branch information
sjinks authored May 31, 2024
2 parents 7f763b5 + 30d2673 commit e0a6972
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion features/src/elasticsearch/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "elasticsearch",
"name": "Elasticsearch",
"description": "Sets up Elasticsearch into the Dev Environment",
"version": "1.0.3",
"version": "1.0.4",
"containerEnv": {
"ES_TMPDIR": "/opt/elasticsearch/tmp"
},
Expand Down
2 changes: 1 addition & 1 deletion features/src/elasticsearch/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ "${ENABLED}" = "true" ]; then

if [ -z "${_REMOTE_USER}" ] || [ "${_REMOTE_USER}" = "root" ]; then
ES_USER=elasticsearch
adduser -M -r -d /usr/share/elasticsearch -s /sbin/nologin "${ES_USER}"
useradd -M -r -d /usr/share/elasticsearch -s /sbin/nologin "${ES_USER}"
else
ES_USER="${_REMOTE_USER}"
fi
Expand Down
4 changes: 2 additions & 2 deletions features/src/elasticsearch/service-run.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ ES_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ ${ES_JAVA_OPTS:-}"
export ES_JAVA_HOME ES_JAVA_OPTS

# shellcheck disable=SC2154 # ES_USER and ES_DATADIR are substituted by `install.sh`.
chown -R "${ES_USER}:${ES_USER}" "${ES_DATADIR}/data" /opt/elasticsearch/logs
chown -R "${ES_USER}:${ES_USER}" "${ES_DATADIR}/data" /opt/elasticsearch/config /opt/elasticsearch/logs /opt/elasticsearch/tmp /opt/elasticsearch/plugins
# shellcheck disable=SC2154
exec su-exec "${ES_USER}" /usr/bin/elasticsearch
exec chpst -u "${ES_USER}:${ES_USER}" /usr/bin/elasticsearch

0 comments on commit e0a6972

Please sign in to comment.