Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,16 @@ Selection based on name `hana` and tags `["hana", "database", "relational"]`.
],
```

#### SAP HANA JDBC Client JAR

To include the SAP HANA JDBC client JAR (`ngdbc.jar`) in your app's classpath at staging time, set the following environment variable:

```shell
cf set-env <YOUR_APP> MXRUNTIME_IncludeSAPHanaClient true
```

When enabled, the buildpack fetches the latest `ngdbc.jar` from the Mendix CDN and places it in `model/lib/userlib/`, making it available to the Mendix runtime. If the download fails, staging continues without the JAR and a warning is logged.

### Connect an External File Store

The Mendix Runtime supports multiple external file stores: AWS S3, Azure Storage and Swift (Bluemix Object Storage).
Expand Down
39 changes: 39 additions & 0 deletions buildpack/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,44 @@ def is_version_maintained(version):
return False


_SAP_HANA_CLIENT_CDN_PREFIX = util.BLOBSTORE_BUILDPACK_DEFAULT_PREFIX + "sap-hana-client"


def _is_sap_hana_client_enabled():
return os.environ.get("MXRUNTIME_IncludeSAPHanaClient", "").strip().lower() == "true"


def _get_hana_jar_version():
import requests as req

version_url = util.get_blobstore_url(f"{_SAP_HANA_CLIENT_CDN_PREFIX}/version.txt")
resp = req.get(version_url, timeout=10)
resp.raise_for_status()
return resp.text.strip()


def _stage_hana_client(build_dir):
if not _is_sap_hana_client_enabled():
return

try:
dest = os.path.join(build_dir, "model", "lib", "userlib")
util.mkdir_p(dest)
jar_name = f"ngdbc-{_get_hana_jar_version()}.jar"
jar_url = util.get_blobstore_url(f"{_SAP_HANA_CLIENT_CDN_PREFIX}/{jar_name}")
util.download(jar_url, os.path.join(dest, jar_name))
Comment thread
mayankmendix marked this conversation as resolved.
logging.info(
"SAP HANA client JAR [%s] staged to [%s]",
jar_name,
dest,
)
except Exception:
logging.warning(
"Failed to stage SAP HANA client JAR, continuing deployment...",
exc_info=True,
)


def stage(buildpack_dir, build_path, cache_path):
logging.debug("Creating directory structure for Mendix runtime...")
for name in ["runtimes", "log", "database", "data", "bin"]:
Expand Down Expand Up @@ -85,6 +123,7 @@ def stage(buildpack_dir, build_path, cache_path):
util.set_executable(file_path)

resolve_runtime_dependency(buildpack_dir, build_path, cache_path)
_stage_hana_client(build_path)


FORCED_MXRUNTIME_URL_KEY = "FORCED_MXRUNTIME_URL"
Expand Down