You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by rk...@apache.org on 2023/10/25 22:59:32 UTC

[incubator-sdap-nexus] 01/01: Install nexusproto from PyPI w/ option to build from source

This is an automated email from the ASF dual-hosted git repository.

rkk pushed a commit to branch SDAP-488-nexusproto-docker
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git

commit 7d494a2b97b9308c934d3bbc9aa976ac1877d854
Author: rileykk <ri...@jpl.nasa.gov>
AuthorDate: Wed Oct 25 15:58:42 2023 -0700

    Install nexusproto from PyPI w/ option to build from source
---
 CHANGELOG.md                              |  1 +
 docker/nexus-webapp/Dockerfile            |  2 ++
 docker/nexus-webapp/install_nexusproto.sh | 33 +++++++++++++++++++------------
 docs/build.rst                            | 20 +++++++++++++++++++
 4 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e848427..01d6272 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - SDAP-39: When querying for tiles by polygon, use the poly's bounding box with the bbox methods instead of using Solr's polygon search
 - Status code for results endpoint if execution id is not found fixed to be `404` instead of `500`.
 - Ensured links in the `/job` endpoint are https
+- SDAP-488: Workaround to build issue on Apple Silicon (M1/M2). Image build installs nexusproto through PyPI instead of building from source. A build arg `BUILD_NEXUSPROTO` was defined to allow building from source if desired
 ### Security
 
 ## [1.1.0] - 2023-04-26
diff --git a/docker/nexus-webapp/Dockerfile b/docker/nexus-webapp/Dockerfile
index 79381f5..515d6ab 100644
--- a/docker/nexus-webapp/Dockerfile
+++ b/docker/nexus-webapp/Dockerfile
@@ -76,6 +76,8 @@ RUN cd /usr/lib && ln -s libcom_err.so.2 libcom_err.so.3 && \
 # Change REBUILD_CODE if you want tell Docker not to use cached layers from this line on
 ARG REBUILD_CODE=0
 
+ARG BUILD_NEXUSPROTO
+
 ARG APACHE_NEXUSPROTO=https://github.com/apache/incubator-sdap-nexusproto.git
 ARG APACHE_NEXUSPROTO_BRANCH=master
 
diff --git a/docker/nexus-webapp/install_nexusproto.sh b/docker/nexus-webapp/install_nexusproto.sh
index ce44c70..08d1894 100755
--- a/docker/nexus-webapp/install_nexusproto.sh
+++ b/docker/nexus-webapp/install_nexusproto.sh
@@ -13,23 +13,30 @@
 # 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.
+
 set -e
 
-APACHE_NEXUSPROTO="https://github.com/apache/incubator-sdap-nexusproto.git"
-MASTER="master"
+if [ ! -z ${BUILD_NEXUSPROTO+x} ]; then
+  echo 'Building nexusproto from source...'
+
+  APACHE_NEXUSPROTO="https://github.com/apache/incubator-sdap-nexusproto.git"
+  MASTER="master"
 
-GIT_REPO=${1:-$APACHE_NEXUSPROTO}
-GIT_BRANCH=${2:-$MASTER}
+  GIT_REPO=${1:-$APACHE_NEXUSPROTO}
+  GIT_BRANCH=${2:-$MASTER}
 
-mkdir nexusproto
-pushd nexusproto
-git init
-git pull ${GIT_REPO} ${GIT_BRANCH}
+  mkdir nexusproto
+  pushd nexusproto
+  git init
+  git pull ${GIT_REPO} ${GIT_BRANCH}
 
-./gradlew pythonInstall --info
+  ./gradlew pythonInstall --info
 
-./gradlew install --info
+  ./gradlew install --info
 
-rm -rf /root/.gradle
-popd
-rm -rf nexusproto
+  rm -rf /root/.gradle
+  popd
+  rm -rf nexusproto
+else
+  pip install nexusproto
+fi
diff --git a/docs/build.rst b/docs/build.rst
index bc1be2e..9dcd17a 100644
--- a/docs/build.rst
+++ b/docs/build.rst
@@ -89,6 +89,16 @@ From the ingester root directory, run:
 
   docker build . -f granule_ingester/docker/Dockerfile -t sdap-local/sdap-granule-ingester:${INGESTER_VERSION}
 
+.. note::
+
+  The granule ingester installs `nexusproto <https://github.com/apache/incubator-sdap-nexusproto>`_ as part of its build process. By default, it installs from `PyPI <https://pypi.org/project/nexusproto/>`_.
+
+  It is possible to build and install directly from source by defining ``--build-arg BUILD_NEXUSPROTO=...`` in the command line.
+  (The value you set is irrelevant; it just needs to be set). You can further define the source repository and branch to build from by
+  defining ``--build-arg APACHE_NEXUSPROTO=...`` and ``--build-arg APACHE_NEXUSPROTO_BRANCH=...``
+
+  Note: Building does not currently work on Apple Silicon (M1/M2). (`SDAP-488 <https://issues.apache.org/jira/browse/SDAP-488>`_)
+
 Build the Solr & Webapp Components
 ======
 
@@ -137,6 +147,16 @@ Now we can build the webapp with:
 
   docker build . -f docker/nexus-webapp/Dockerfile -t sdap-local/sdap-nexus-webapp:${NEXUS_VERSION}
 
+.. note::
+
+  The webapp installs `nexusproto <https://github.com/apache/incubator-sdap-nexusproto>`_ as part of its build process. By default, it installs from `PyPI <https://pypi.org/project/nexusproto/>`_.
+
+  It is possible to build and install directly from source by defining ``--build-arg BUILD_NEXUSPROTO=...`` in the command line.
+  (The value you set is irrelevant; it just needs to be set). You can further define the source repository and branch to build from by
+  defining ``--build-arg APACHE_NEXUSPROTO=...`` and ``--build-arg APACHE_NEXUSPROTO_BRANCH=...``
+
+  Note: Building does not currently work on Apple Silicon (M1/M2). (`SDAP-488 <https://issues.apache.org/jira/browse/SDAP-488>`_)
+
 Verify Successful Build
 ====