Skip to content

Commit

Permalink
Use scripts instead of direct commands in java opts
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremsekerci committed Feb 3, 2025
1 parent 512ba1f commit 7dc42b7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion buildpack/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def stage(buildpack_dir, build_path, cache_path):
os.path.join(buildpack_dir, "etc", "m2ee", "m2ee.yaml"),
os.path.join(build_path, ".local", "m2ee.yaml"),
)
shutil.copytree(
os.path.join(buildpack_dir, "etc", "scripts"),
os.path.join(build_path, ".local", "scripts"),
dirs_exist_ok=True
)

resolve_runtime_dependency(buildpack_dir, build_path, cache_path)


Expand Down Expand Up @@ -614,7 +620,7 @@ def _pre_process_m2ee_yaml():
f"s|BUILD_PATH|{os.getcwd()}|g; "
f"s|RUNTIME_PORT|{util.get_runtime_port()}|; "
f"s|ADMIN_PORT|{util.get_admin_port()}|; "
f"s|PYTHONPID|{os.getpid()}|",
f"s|PYTHONPID|{os.getpid()}|", # TODO Replace in new scripts
".local/m2ee.yaml",
]
)
Expand Down
5 changes: 3 additions & 2 deletions etc/m2ee/m2ee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ m2ee:
[
"-Dfile.encoding=UTF-8",
"-Djava.io.tmpdir=/tmp",
"-XX:OnError=/home/vcap/app/on_error_script.sh",
"-XX:OnOutOfMemoryError=/home/vcap/app/on_oom.sh",
"-XX:OnError=/home/vcap/app/.local/scripts/on_error.sh",
"-XX:OnOutOfMemoryError=/home/vcap/app/.local/scripts/on_out_of_memory_error.sh",
]
# TODO Replace with BUILD_PATH

jetty:
max_form_content_size: 10485760
Expand Down
2 changes: 2 additions & 0 deletions etc/scripts/on_error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "### THIS IS ON ERROR SCRIPT ###"
# TODO Write actual signal command
2 changes: 2 additions & 0 deletions etc/scripts/on_out_of_memory_error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
echo "### THIS IS ON OOM SCRIPT ###"
# TODO Write actual signal command

0 comments on commit 7dc42b7

Please sign in to comment.