Install JPS Using CLI Method

In this guide, we’ll walk through the process of installing a JPS (Java Package Store) package via the Command Line Interface (CLI). Such packages can include steps for creating new environments with predefined customizations or executing actions on existing instances.

Let’s begin by understanding the appropriate install method, which executes the JPS packages and encompasses all of its parameters.


~/jelastic/marketplace/jps/install --jps {jps} [--envName {envName}] [--settings {settings}] [--nodeGroup {nodeGroup}] [--displayName {displayName}] [--region {region}] [--envGroups {envGroups}] [--ownerUid {ownerUid}] [--logsPath {logsPath}] [--loggerName {loggerName}] [--skipNodeEmails {skipNodeEmails}]

The parameters enclosed in square brackets [ ] are optional:

  • jps: link to your manifest file or its body
  • specific settings for jpsType: install manifests (new environments):
    • [displayName]: alias for the created environment
    • [envGroups]: list of env groups the created environment should be included in (specified as a JSON array, e.g., [“mygroup”, “group/subgroup”])
  • specific settings for jpsType: update manifests (add-ons for existing environments):
    • [nodeGroup]: environment layer the add-on should be applied to (bl, cp, cache, sqldb, nosqldb, storage, vps, build, or your custom one for Docker containers)
  • envName: name of the newly created/target environment for the application/add-on installation, respectively
  • [settings]: list of settings required by the package (specified as a JSON object with key/value pairs)
  • [ownerUid]: user ID of the shared account where the JPS package should be installed
  • [loggerName]: name displayed next to the timestamp of each operation in the JPS installation log file (learn more about loggerName
  • [logsPath]: path to the file to log JPS installation flow (cs.log by default)
  • [skipNodeEmails]: enables (true, by default) or disables (false) email notifications about new nodes creation by this package (learn more about skipNodeEmails)

Save $100 in the next
5:00 minutes?

Register Here

Now, let’s proceed to real case examples:

  1. TimeZone Change Add-on Installation via URL
  2. JPS Installation Using Configuration File with Parameters

TimeZone Change Add-on Installation via URL

The TimeZone Change add-on facilitates easy switching of the timezone on any container to the desired one. The sources and manifest file of the add-on can be found in the JPS Collection repository on GitHub.

1. Install the platform CLI and log into your account if you haven’t done so already. Refer to the overview guide for the necessary steps.

2. Invoke the Install method with the required parameters:


~/jelastic/marketplace/jps/install --jps {jps} --envName {envName} --settings {settings} --nodeGroup {nodeGroup}

Install TimeZone change Add-on

Here’s the script for installing the TimeZone Change add-on:

  • {jps} – Link to the TimeZone Change add-on manifest file: https://raw.githubusercontent.com/jelastic-jps/time-zone-change/master/manifest.jps
  • {envName} – Name of your existing environment, for example, my-app
  • {settings} – According to the manifest, this add-on requires you to provide one additional parameter – the desired timezone. For instance: {“dashboard_url”:”America/New_York”}
  • {nodeGroup} – Target layer of the environment, such as cp

If there are no issues, the script will respond with “result”: 0 (indicating operation success).

After executing the script, you can verify the detailed result in the /var/log/jpsaddon.log file. Let’s read it.


~/jelastic/environment/file/read --envName {envName} --path "/var/log/jpsaddon.log" --nodeGroup {nodeGroup}

After checking, you will notice that the timezone has been successfully set to the one specified in the previous step, which in our case is America/New_York. As a result, the local time on the corresponding containers is adjusted to match this new timezone.

Installed Successfully

JPS Installation Using Configuration File with Parameters

If necessary, you can consolidate all the parameters within a single file and reference it when executing a CLI method.

1. Begin by creating a JSON file (using any preferred editor) with the required parameters. In our case, we’ll execute a simple JPS, which logs the value of the provided parameter.


{
"jps": {
"type": "update",
"name": "JPS Example",
"onInstall": {
"log": "${settings.param1}"
}
},
"envName": "my-app",
"settings": {
"param1": "value1"
},
"nodeGroup": "cp"
}

Create JSON file

Tip: You can provide a URL to your manifest file instead of specifying it explicitly in the jps parameter, similar to the TimeZone example.

2. Next, invoke the Install method using the created configuration file.


~/jelastic/marketplace/jps/install --myparams {myparams.json}

Install methods

Tip: If needed, you can explicitly provide a parameter to redefine the value inside the file. For example, it is possible to change the environment name without modifying the configuration file itself:


~/jelastic/marketplace/jps/install --myparams {myparams.json} --envName {envName}

3. You can verify that the value of the provided parameter was successfully logged by accessing the platform console at https://app.{platformDomain}/console.

Verify added parameter

Frequently made calls can be made simpler and more automated by using the configuration files that contain a set of predetermined parameters.

Save $100 in the next
5:00 minutes?

Register Here