-
Notifications
You must be signed in to change notification settings - Fork 1k
RANGER-5450:OpenSearch docker containerisation for Ranger #809
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
Open
rameeshm
wants to merge
2
commits into
master
Choose a base branch
from
RANGER-5450-patch
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+257
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| ARG RANGER_BASE_IMAGE | ||
| ARG RANGER_BASE_VERSION | ||
| FROM ${RANGER_BASE_IMAGE}:${RANGER_BASE_VERSION} | ||
|
|
||
| ARG OPENSEARCH_VERSION | ||
|
|
||
| VOLUME /etc/keytabs | ||
|
|
||
| COPY ./dist/version /home/ranger/dist/ | ||
| COPY ./downloads/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz /home/ranger/dist/ | ||
|
|
||
| COPY ./scripts/opensearch/ranger-opensearch-setup.sh ${RANGER_SCRIPTS}/ | ||
| COPY ./scripts/opensearch/ranger-opensearch.sh ${RANGER_SCRIPTS}/ | ||
| COPY ./scripts/opensearch/opensearch.yml ${RANGER_SCRIPTS}/ | ||
| COPY ./scripts/opensearch/opensearch-jaas.conf ${RANGER_SCRIPTS}/ | ||
| COPY ./scripts/wait_for_keytab.sh ${RANGER_SCRIPTS}/ | ||
| COPY ./scripts/wait_for_testusers_keytab.sh ${RANGER_SCRIPTS}/ | ||
| COPY ./scripts/kdc/krb5.conf /etc/krb5.conf | ||
|
|
||
| # Create opensearch user and group | ||
| RUN groupadd -g 3002 opensearch && \ | ||
| useradd -u 3002 -g opensearch -G hadoop -s /bin/bash opensearch | ||
|
|
||
| # Extract and setup OpenSearch | ||
| RUN tar xvfz /home/ranger/dist/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz --directory=/opt/ && \ | ||
| ln -s /opt/opensearch-${OPENSEARCH_VERSION} /opt/opensearch && \ | ||
| rm -f /home/ranger/dist/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz && \ | ||
| mkdir -p /opt/opensearch/data /opt/opensearch/logs && \ | ||
| chown -R opensearch:hadoop /opt/opensearch* && \ | ||
| chmod 755 ${RANGER_SCRIPTS}/wait_for_keytab.sh && \ | ||
| chmod 755 ${RANGER_SCRIPTS}/wait_for_testusers_keytab.sh && \ | ||
| chmod 755 ${RANGER_SCRIPTS}/ranger-opensearch-setup.sh && \ | ||
| chmod 755 ${RANGER_SCRIPTS}/ranger-opensearch.sh | ||
|
|
||
| ENV OPENSEARCH_HOME=/opt/opensearch | ||
| ENV PATH=/usr/java/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/opensearch/bin | ||
|
|
||
| ENTRYPOINT [ "/home/ranger/scripts/ranger-opensearch.sh" ] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
dev-support/ranger-docker/docker-compose.ranger-opensearch.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| services: | ||
| ranger-opensearch: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.ranger-opensearch | ||
| args: | ||
| - RANGER_BASE_IMAGE=${RANGER_BASE_IMAGE} | ||
| - RANGER_BASE_VERSION=${RANGER_BASE_VERSION} | ||
| - OPENSEARCH_VERSION=${OPENSEARCH_VERSION} | ||
| - KERBEROS_ENABLED=${KERBEROS_ENABLED} | ||
| image: ranger-opensearch | ||
| container_name: ranger-opensearch | ||
| hostname: ranger-opensearch.rangernw | ||
| volumes: | ||
| - ./dist/keytabs/ranger-opensearch:/etc/keytabs | ||
| - opensearch-data:/opt/opensearch/data | ||
| - opensearch-logs:/opt/opensearch/logs | ||
| stdin_open: true | ||
| tty: true | ||
| networks: | ||
| - ranger | ||
| ports: | ||
| - "9200:9200" | ||
| - "9300:9300" | ||
| depends_on: | ||
| ranger-kdc: | ||
| condition: service_started | ||
rameeshm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ranger: | ||
| condition: service_started | ||
| environment: | ||
| - OPENSEARCH_VERSION=${OPENSEARCH_VERSION} | ||
| - KERBEROS_ENABLED=${KERBEROS_ENABLED} | ||
| - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m | ||
|
|
||
| volumes: | ||
| opensearch-data: | ||
| opensearch-logs: | ||
|
|
||
| networks: | ||
| ranger: | ||
| name: rangernw | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,9 @@ else | |
| then | ||
| tar xvfz downloads/ozone-${OZONE_VERSION}.tar.gz --directory=downloads/ | ||
| fi | ||
| elif [[ $arg == 'opensearch' ]] | ||
| then | ||
| downloadIfNotPresent opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include #92 at the end of the first |
||
| else | ||
| echo "Passed argument $arg is invalid!" | ||
| fi | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
dev-support/ranger-docker/scripts/opensearch/opensearch-jaas.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| Client { | ||
| com.sun.security.auth.module.Krb5LoginModule required | ||
| useKeyTab=true | ||
| storeKey=true | ||
| useTicketCache=false | ||
| keyTab="/etc/keytabs/opensearch.keytab" | ||
| principal="opensearch/[email protected]"; | ||
| }; | ||
|
|
||
| Server { | ||
| com.sun.security.auth.module.Krb5LoginModule required | ||
| useKeyTab=true | ||
| storeKey=true | ||
| useTicketCache=false | ||
| keyTab="/etc/keytabs/HTTP.keytab" | ||
| principal="HTTP/[email protected]"; | ||
| }; | ||
|
|
50 changes: 50 additions & 0 deletions
50
dev-support/ranger-docker/scripts/opensearch/opensearch.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # OpenSearch Configuration | ||
| cluster.name: ranger-opensearch-cluster | ||
| node.name: ranger-opensearch.rangernw | ||
|
|
||
| # Network settings | ||
| network.host: ranger-opensearch.rangernw | ||
| http.port: 9200 | ||
| transport.port: 9300 | ||
|
|
||
| # Discovery settings | ||
| discovery.type: single-node | ||
|
|
||
| # Path settings | ||
| path.data: /opt/opensearch/data | ||
| path.logs: /opt/opensearch/logs | ||
|
|
||
| # Memory settings | ||
| bootstrap.memory_lock: false | ||
|
|
||
| # Disable OpenSearch Security Plugin. | ||
| # Ranger OpenSearch plugin integration is not configured in this image. | ||
| # This can be enabled when Ranger Plugin is configured. | ||
| plugins.security.disabled: true | ||
|
|
||
| # Allow HTTP methods | ||
| http.cors.enabled: true | ||
| http.cors.allow-origin: "http://localhost" | ||
| http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE | ||
| http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization" | ||
|
|
||
| # Kerberos authentication is enabled via JAAS configuration | ||
| # See opensearch-jaas.conf for Kerberos principal and keytab settings | ||
| # JVM is configured with: -Djava.security.auth.login.config and -Djava.security.krb5.conf | ||
|
|
38 changes: 38 additions & 0 deletions
38
dev-support/ranger-docker/scripts/opensearch/ranger-opensearch-setup.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Wait for Kerberos keytabs (enabled by default) | ||
| if [ "${KERBEROS_ENABLED}" != "false" ] | ||
| then | ||
| echo "Kerberos is enabled, waiting for keytabs..." | ||
| ${RANGER_SCRIPTS}/wait_for_keytab.sh opensearch.keytab | ||
rameeshm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ${RANGER_SCRIPTS}/wait_for_keytab.sh HTTP.keytab | ||
| ${RANGER_SCRIPTS}/wait_for_testusers_keytab.sh | ||
| else | ||
| echo "Kerberos is disabled" | ||
| fi | ||
|
|
||
| # Copy configuration files | ||
| cp ${RANGER_SCRIPTS}/opensearch.yml ${OPENSEARCH_HOME}/config/ | ||
| cp ${RANGER_SCRIPTS}/opensearch-jaas.conf ${OPENSEARCH_HOME}/config/ | ||
|
|
||
| # Set ownership | ||
| chown -R opensearch:hadoop ${OPENSEARCH_HOME}/ | ||
|
|
||
| echo "OpenSearch setup completed successfully" | ||
|
|
||
38 changes: 38 additions & 0 deletions
38
dev-support/ranger-docker/scripts/opensearch/ranger-opensearch.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| if [ ! -e ${OPENSEARCH_HOME}/.setupDone ] | ||
rameeshm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| then | ||
| if "${RANGER_SCRIPTS}"/ranger-opensearch-setup.sh; | ||
| then | ||
| touch "${OPENSEARCH_HOME}"/.setupDone | ||
| else | ||
| echo "OpenSearch Setup Script didn't complete proper execution." >&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| # Start OpenSearch as opensearch user with Kerberos enabled by default | ||
| if [ "${KERBEROS_ENABLED}" != "false" ]; then | ||
| echo "Starting OpenSearch with Kerberos authentication enabled..." | ||
| su -c "cd ${OPENSEARCH_HOME} && OPENSEARCH_JAVA_OPTS=\"${OPENSEARCH_JAVA_OPTS} -Djava.security.krb5.conf=/etc/krb5.conf -Djava.security.auth.login.config=/opt/opensearch/config/opensearch-jaas.conf\" ./bin/opensearch" opensearch | ||
| else | ||
| echo "Starting OpenSearch without Kerberos..." | ||
| su -c "cd ${OPENSEARCH_HOME} && ./bin/opensearch" opensearch | ||
| fi | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.