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 Client

To include the SAP HANA 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
28 changes: 28 additions & 0 deletions buildpack/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time

import backoff
import requests
from buildpack import util
from lib.m2ee import M2EE as m2ee_class
from lib.m2ee.version import MXVersion
Expand Down Expand Up @@ -56,6 +57,32 @@ def is_version_maintained(version):
return True
return False

def _stage_hana_client(build_dir):
enabled = os.environ.get("MXRUNTIME_IncludeSAPHanaClient", "").strip().lower() == "true"
if not enabled:
return

cdn_prefix = util.BLOBSTORE_BUILDPACK_DEFAULT_PREFIX + "sap-hana-client"
try:
dest = os.path.join(build_dir, "model", "lib", "userlib")
util.mkdir_p(dest)
version_url = util.get_blobstore_url(f"{cdn_prefix}/version.txt")
resp = requests.get(version_url, timeout=10)
resp.raise_for_status()
jar_name = f"ngdbc-{resp.text.strip()}.jar"
jar_url = util.get_blobstore_url(f"{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...")
Expand Down Expand Up @@ -85,6 +112,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
Loading