Skip to content

Commit

Permalink
Attempt to fix problem with Nexus getting stuck while running with to…
Browse files Browse the repository at this point in the history
…o little memory (#4189)

* Attempt to fix Nexus problem of running with too little memory

* Attempt to fix Nexus problem of running with too little memory

* Update CHANGELOG

* Update templates/shared_services/sonatype-nexus-vm/terraform/vm.tf

Co-authored-by: Marcus Robinson <[email protected]>

---------

Co-authored-by: Tony Wildish <[email protected]>
Co-authored-by: Marcus Robinson <[email protected]>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent a7c9a28 commit 5bccd99
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ BUG FIXES:
* Fix Dockerfile 'as' casting ([#4170](https://github.com/microsoft/AzureTRE/pull/4170))
* Create policy to allow all user to configure color profiles to remove auth dialog. ([#4184](https://github.com/microsoft/AzureTRE/pull/4184))
* Pre configure VS code option to prevent script failure ([#4185](https://github.com/microsoft/AzureTRE/pull/4185))
* Increase size of Nexus VM, and derive Java VM memory limits from machine size ([#4074](https://github.com/microsoft/AzureTRE/issues/4074))
* Enable symlinks to work on Linux VM shared storage ([#4180](https://github.com/microsoft/AzureTRE/issues/4180))
* Upgrade aiohttp version for security fixes ([#4197](https://github.com/microsoft/AzureTRE/pull/4197))
* Fix failing tests, .env missing and storage logs ([#4207](https://github.com/microsoft/AzureTRE/issues/4207))
Expand Down
2 changes: 1 addition & 1 deletion templates/shared_services/sonatype-nexus-vm/porter.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
schemaVersion: 1.0.0
name: tre-shared-service-sonatype-nexus
version: 3.2.1
version: 3.2.2
description: "A Sonatype Nexus shared service"
dockerfile: Dockerfile.tmpl
registry: azuretre
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ while true; do
((docker_pull_timeout--));
done

# Deduce memory available to Java. Either 3/4 of the system RAM, or a set minimum
# shellcheck disable=SC2002
mem_total_mb=$(( $(cat /proc/meminfo | head -1 | awk '{ print $2 }') / 1024 ))
java_mem=2703
if [ $mem_total_mb -gt 4096 ]; then
java_mem=$(( mem_total_mb * 3 / 4 ))
fi

echo "System memory: ${mem_total_mb} MB. Java memory: ${java_mem} MB"

docker run -d -p 80:8081 -p 443:8443 -p 8083:8083 -v /etc/nexus-data:/nexus-data \
-e INSTALL4J_ADD_VM_PARAMS="-Xmx${java_mem}m -Xms${java_mem}m" \
--restart always \
--name nexus \
--log-driver local \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ resource "azurerm_linux_virtual_machine" "nexus" {
resource_group_name = local.core_resource_group_name
location = data.azurerm_resource_group.rg.location
network_interface_ids = [azurerm_network_interface.nexus.id]
size = "Standard_B2s"
size = "Standard_D2s_v3"
disable_password_authentication = false
admin_username = "adminuser"
admin_password = random_password.nexus_vm_password.result
Expand Down

0 comments on commit 5bccd99

Please sign in to comment.