This page describes how to consigure a vRealize engineer development machine to work with **vRealize Development Tools**. # Install and Configure ## Prerequisites - [vRealize Developer Tools](https://marketplace.visualstudio.com/items?itemName=vmware-pscoe.vrealize-developer-tools) - Java 8 ([official installation guide](https://www.java.com/en/download/help/download_options.xml)) - Maven 3.5+ ([official installation guide](https://maven.apache.org/install.html)) - Development vRealize Automation Tenant configured with development vRealize Orchestrator - Tenant administrator user - Workstation can access vRA server on port 443 - Development vRealize Orchestrator - vRO administrator user - vRO appliance root user - Workstation can access vRO server on ports [443 or 8281], 8283 ## Configuration There are several things that need to be in place before you can use the toolchain to work with vRO content. ### Keystore Java keystore is used for signing packages build time. #### Create private key and certificate The process creates an archive called **archetype.keystore-1.0.0** (artifact name + version) containing the generated files (**archetype.keystore**, **cert.pem**, **private_key.pem** ). The archive needs to be deployed on the artifact manager. ```sh mkdir -p ~/cert/archetype.keystore-1.0.0 cd ~/cert/archetype.keystore-1.0.0 ## Create the certificates and fill in the required country,state,location,organization details ... openssl req -newkey rsa:2048 -new -x509 -days 3650 -keyout private_key.pem -out cert.pem keytool -genkey -v -keystore archetype.keystore -alias _dunesrsa_alias_ -keyalg RSA -keysize 2048 -validity 10000 cd ~/cert zip archetype.keystore-1.0.0.zip -r archetype.keystore-1.0.0 ``` `Note:` Its very important to note that "Email" field should be EMPTY, otherwise the vRO import will break with 400 OK error `Note:` JKS is a propriatary format specific to the particular JVM provider. When running above commands, ensure the keytool used is the one under the JVM that Maven would use (check with `mvn -v`). #### Deploy the keystore artifact The artifact should be deployed to any path as long as the **settings.xml** file points to it. Example: - artifact group ID: com.clientname.build - artifact ID: archetype.keystore - artifact version: 1.0.0 - **keystorePassword** and **vroKeyPass** passwords need to be replaced with the values used during the key generation process above - settings section: ```xml com.clientname.build archetype.keystore target/${keystoreArtifactId}-${keystoreVersion}/archetype.keystore 1.0.0 {{keystorePassword}} target/${keystoreArtifactId}-${keystoreVersion}/private_key.pem target/${keystoreArtifactId}-${keystoreVersion}/cert.pem {{vroKeyPass}} ``` The artifact can be pushed from the root directory via the following command: ``` jfrog rt u --recursive true --flat false ./ {name-of-repository} ``` ### Global Configuration (_settings.xml_) Firstly, you will need to configure Maven. There are a number of properties that must be set through profiles in the settings.xml file, as they are environment specific: - keystorePassword - Required. This is the password for the keystore used for signing vRO packages. - keystoreLocation - Required. This is the location of the keystore. You can either hardcode a location on the machine executing the build. - snapshotRepositoryUrl - Required. This is the url of the snapshot maven repository. - releaseRepositoryUrl - Required. This is the url of the release maven repository. Could be the same as snapshotRepositoryUrl. The recommended approach is to keep a settings XML file under SCM to be used by developers and a modified version with credentials for the Artifactory deployed on the CI server directly (i.e. not accessible by everyone). Furthermore, in the example, bundling (i.e. should the bundle.zip be produced upon build) is moved to a separate profile and developers/CI can choose whether to create the bundle or not by including the "-Pbundle" command line argument to the maven invocation. ```xml {vro_username} {native+maven+encrypted+pass} corp-dev-vro {vra_username} {native+maven+encrypted+pass} corp-dev-vra packaging {keystore_password} {keystore_location} bundle false artifactory false central central http://{artifactory-hostname}/artifactory/{release_repository} true central-snapshots central-snapshots http://{artifactory-hostname}/artifactory/{snapshot_repository} false central central http://{artifactory-hostname}/artifactory/{release_repository} true central-snapshots central-snapshots http://{artifactory-hostname}/artifactory/{snapshot_repository} http://{artifactory-hostname}/artifactory/{release_repository} http://{artifactory-hostname}/artifactory/{snapshot_repository} corp-dev {vro_host} {vro_port} {vro_username} {vro_password} corp-dev-vro {basic|vra} {auth_host} {auth_port} {vro_tenant} {vra_host} {vra_port} {vra_tenant} corp-dev-vra {vra_username} {vra_password} artifactory packaging ``` `Note:` {vro_username} is usually taking the form of `username`@`domain`. For vRO8 embedded in vRA8 with BASIC for {vro_auth} it will be required that only `username` part is specified for successful authentication. ### Signing vRO packages are signed. In order to be able to use the toolchain, you have to have a keystore and configure it in the settings.xml file both for the developers and the CI. #### Keystore located on the building machine You must have the keystore file accessible on the machine and set the **keystoreLocation** and **keystorePassword** properties through the settings.xml. ### Bundling There is a built-in bundling capabilities that are described in a Maven profile. You can decide to not only package a vRO/vRA project, but also to create a `*-bundle.zip` with all its dependencies. This will create an archive with the following structure: ```sh vro/ # all vRO packages. If the current project is vRO, its package will be here as well. vra/ # all vRA packages. IF the current project is vRA, its package will be here as well. repo/ # JARs that comprise the bundle installer - a CLI tool that is capable of importing the whole bundle to a target environment. bin/ # shells for invoking the bundle installer CLI. installer # Bash executable version of the installer for Linux/Unix/macOS intasller.bat # Batch exectable version of the installer for Windows ``` The bundle is produced as a separate artifact during `mvn package`. To produce it, you need to add the `-Pbundle-with-installer` profile: ``` $ mvn clean deploy -Pbundle-with-installer ``` To learn more about the bundle installer, check [vRealize Build Tools - Bundle Installer](./Using-the-Bundle-Installer.md) for more information. ### Security All API calls from the toolchain (i.e. the client) verify the SSL certificate returned by vRO/vRA (i.e. the server). If you are using self-signed or third-party signed certificates, you may need to add those certificates or their CA certificates to the default JAVA keystore, i.e. `JAVA_HOME/lib/security/cacerts`. **This is the recommended approach.** The other option, **applicable ONLY for development environments**, is to ignore certificate checks by passing a flag.