How to customize Java Virtual Machine (JVM) and wrapper settings for your Bamboo elastic agents

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

This page will walk you through how to customize Java Virtual Machine (JVM) and wrapper settings for your elastic agents. This can be done using the JVM arguments listed below.

環境

This has been tested on Bamboo 8.2.5 but likely works with other versions.

ソリューション

As mentioned, it is possible to use JVM arguments to customize elastic agents. Below is a non-exhaustive list of standard parameters and their default values.

用途パラメーター既定
Changing an elastic agent home directory (applicationHome, buildWorkingDirectory, localHomeDirectory, sharedHomeDirectory)bamboo.home $USER_HOME/bamboo-agent-home
Adjusting the initial Java heap size of the elastic agentwrapper.java.initmemory256MB
Adjusting the maximum Java heap size of the elastic agentwrapper.java.maxmemory256MB
Changing the default action for the elastic agent supervisor when the JVM fails to respond to its ping requestswrapper.ping.timeout.actionRESTART
Changing the interval at which the JVM is pingedwrapper.ping.timeout30s

Instance startup script

To customize the JVM arguments for your elastic agents, you must edit the elastic image they're using and add the following startup script:

  1. Go to Bamboo administration >> Overview >> Elastic Bamboo >> Image configurations page.
  2. From there, edit the desired elastic image.
  3. Locate the Instance startup script field and use one of the following examples to modify your agent's JVM arguments:

    Linux
    sudo su -c "echo \"export WRAPPER_PROPERTIES='\"-Dwrapper.java.additional.4=-Dbamboo.home=/home/bamboo/new-home\"'\" >> /etc/profile.d/bamboo.sh"
    Windows (Powershell)
    powershell.exe -Command "[System.Environment]::SetEnvironmentVariable(\"WRAPPER_PROPERTIES\", '\" -Dwrapper.java.additional.4=-Dbamboo.home=C:\Bamboo\new-home \"', 'Machine')"
  4. Save the elastic image configuration and start a new elastic agent.
    1. The changes won't affect elastic agents that are running; they will only affect new ones.

JVM parameters are all prefixed by -D, so bamboo.home would be added to the Java command as -Dbamboo.home

With the wrapper properties as -Dbamboo.home we can set a new path for the Bamboo home directory. The applicationHome, buildWorkingDirectory, localHomeDirectory, and sharedHomeDirectory are all set as new Bamboo home paths. However, the currentDirectory will still be pointing to the home dir of the Bamboo user. As a workaround, if we set the environment variable for BAMBOO_HOME, the currentDirectory changes.

最終更新日: 2023 年 10 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.