Advanced project and environment management
Configuration files
Global Project Configuration
The 2 main things that define a project are its name and its home folder. Projects and environments as such are defined in the central Hop configuration file hop-config.json
. By default this file lives in the config/
folder of your Hop client distribution. You can change that folder by setting the HOP_CONFIG_FOLDER
environment variable on your system.
projectsConfig
In hop-config.json
, you’ll find a "projectsConfig"
section. By default it contains the following:
{
"projectsConfig" : {
"enabled" : true,
"projectMandatory" : true,
"environmentMandatory" : false,
"defaultProject" : "default",
"defaultEnvironment" : null,
"standardParentProject" : "default",
"standardProjectsFolder" : null,
"projectConfigurations" : [ {
"projectName" : "default",
"projectHome" : "config/projects/default",
"configFilename" : "project-config.json"
}, {
"projectName" : "samples",
"projectHome" : "config/projects/samples",
"configFilename" : "project-config.json"
} ],
"lifecycleEnvironments" : [ ],
"projectLifecycles" : [ ]
}
}
As you can see the standard Hop client distribution defines 2 projects: default and samples.
Project Configuration
Every project has extra metadata and settings stored in a project configuration file called
. For the samples project this would be project-config.json
.config/projects/samples/project-config.json
project-config.json
Let’s take a look at it:
{
"metadataBaseFolder" : "${PROJECT_HOME}/metadata",
"unitTestsBasePath" : "${PROJECT_HOME}",
"dataSetsCsvFolder" : "${PROJECT_HOME}/datasets",
"enforcingExecutionInHome" : true,
"parentProjectName" : "default",
"config" : {
"variables" : [ ]
}
}
Environment configuration
Hop enviroments and their home folders are stored in the hop configuration file 'hop-config.json'. That file lives by default in the config folder of the Hop installation. System property HOP_CONFIG_FOLDER
can also be used to point to a different folder
environmentConfig
{
"environmentConfig" : {
"enabled" : true,
"openingLastEnvironmentAtStartup" : true,
"environmentConfigFilename" : "environment.json",
"environmentFolders" : {
"Project 1 - DEV" : "/projects/one/dev/",
"Project 1 - UAT" : "/projects/one/uat/",
"Project 1 - PRD" : "/projects/one/prd/",
"Project 2 - DEV" : "/projects/two/dev/",
"Project 2 - UAT" : "/projects/two/uat/",
"Project 2 - PRD" : "/projects/two/prd/",
}
}
Command Line Project Configuration
In addition to the Hop Gui and configuration files, all aspects of and operations on projects and environments can be managed through the Hop Conf command line tool.
Configuration on the command line
The
script offers many options to edit environment definitions.hop-conf
Creating an environment
-
Windows
-
Linux, macOS
hop-conf.bat --environment-create \
--environment hop2 \
--environment-project hop2
--environment-purpose=Development \
--environment-config-files="C:\<YOUR_ENV_FILE_PATH>\env-variables.json"
Expected output:
C:\<YOUR_PATH>\hop>echo off
===[Environment Settings - hop-conf.bat]===================================
Java identified as "C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java"
HOP_OPTIONS=-Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows -DHOP_PLATFORM_RUNTIME=Conf
-DHOP_AUTO_CREATE_CONFIG=Y
Command to start Hop will be:
"C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java" -classpath lib\core\*;lib\beam\*;lib\swt\win64\*
-Djava.library.path=lib\core;lib\beam -Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows
-DHOP_PLATFORM_RUNTIME=Conf -DHOP_AUTO_CREATE_CONFIG=Y org.apache.hop.config.HopConfig --environment-create
--environment hop2 --environment-project hop2 --environment-purpose Development
--environment-config-files "C:\<YOUR_ENV_FILE_PATH\env-variables.json"
===[Starting HopConfig]=========================================================
Creating environment 'hop2'
Environment 'hop2' was created in Hop configuration file C:\<YOUR_PATH>\hop\config\hop-config.json
Warning: referenced project 'hop2' doesn\'t exist
Found existing environment configuration file: C:\<YOUR_ENV_FILE_PATH>\variables.json
Purpose: Development
Project name: hop2
Config file: C:\<YOUR_ENV_FILE_PATH>\env-variables.json
$ sh hop-conf.sh \
--environment-create \
--environment hop2 \
--environment-project hop2 \
--environment-purpose=Development \
--environment-config-files=<YOUR_ENV_FILE_PATH>/env-variables.json
Expected output:
Creating environment 'hop2'
Environment 'hop2' was created in Hop configuration file <YOUR_PATH>/hop/config/hop-config.json
Warning: referenced project 'hop2' doesn't exist
Found existing environment configuration file: <YOUR_ENV_FILE_PATH>/env-variables.json
hop2
Purpose: Development
Project name: hop2
Config file: <YOUR_ENV_FILE_PATH>/env-variables.json
As you can see from the log, an empty file was created to set variables in:
{ }
Setting variables in an environment
This command adds a variable to the environment configuration file:
-
Windows
-
Linux, macOS
hop-conf.bat --config-file "C:\<YOUR_ENV_FILE_PATH>\env-variables.json" --config-file-set-variables "DB_HOSTNAME=localhost,DB_PASSWORD=abcd"
Expected output:
C:\<YOUR_PATH\hop>echo off
===[Environment Settings - hop-conf.bat]===================================
Java identified as "C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java"
HOP_OPTIONS=-Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows -DHOP_PLATFORM_RUNTIME=Conf -DHOP_AUTO_CREATE_CONFIG=Y
Command to start Hop will be:
"C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java" -classpath lib\core\*;lib\beam\*;lib\swt\win64\*
-Djava.library.path=lib\core;lib\beam -Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows
-DHOP_PLATFORM_RUNTIME=Conf -DHOP_AUTO_CREATE_CONFIG=Y org.apache.hop.config.HopConfig
--config-file "C:\<YOUR_ENV_FILE_PATH>\env-variables.json"
--config-file-set-variables "DB_HOSTNAME=localhost,DB_PASSWORD=abcd"
===[Starting HopConfig]=========================================================
Configuration file 'C:\<YOUR_ENV_FILE_PATH>/env-variables.json' was modified.
./hop-conf.sh --config-file <YOUR_ENV_FILE_PATH>/env-variables.json --config-file-set-variables DB_HOSTNAME=localhost,DB_PASSWORD=abcd
Expected output:
Configuration file '<YOUR_ENV_FILE_PATH>/env-variables.json' was modified.
If you look at the file env-variables.json
, you’ll see that the variables were added:
{
"variables" : [ {
"name" : "DB_HOSTNAME",
"value" : "localhost",
"description" : ""
}, {
"name" : "DB_PASSWORD",
"value" : "abcd",
"description" : ""
} ]
}
Please note that you can add descriptions for the variables as well with the --describe-variable
option. Please run hop-conf without options to see all the possibilities.
Deleting an environment
The following example deletes an environment from the Hop configuration file:
-
Windows
-
Linux, macOS
hop-conf.bat -ed --environment hop2
Expected output:
C:\<YOUR_PATH>\hop>echo off
===[Environment Settings - hop-conf.bat]===================================
Java identified as "C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java"
HOP_OPTIONS=-Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows -DHOP_PLATFORM_RUNTIME=Conf -DHOP_AUTO_CREATE_CONFIG=Y
Command to start Hop will be:
"C:\Program Files\Microsoft\jdk-11.0.17.8-hotspot\\bin\java" -classpath lib\core\*;lib\beam\*;lib\swt\win64\* -Djava.library.path=lib\core;lib\beam -Xmx2048m -DHOP_AUDIT_FOLDER=.\audit -DHOP_PLATFORM_OS=Windows -DHOP_PLATFORM_RUNTIME=Conf -DHOP_AUTO_CREATE_CONFIG=Y org.apache.hop.config.HopConfig -ed --environment hop2
===[Starting HopConfig]=========================================================
Lifecycle environment 'hop2' was deleted from Hop configuration file C:\<YOUR_PATH>\hop\config\hop-config.json
./hop-conf.sh -ed --environment hop2
Expected output:
Lifecycle environment 'hop2' was deleted from Hop configuration file <YOUR_PATH>/hop/config/hop-config.json
Projects Plugin configuration
There are various options to configure the behavior of the
plugin itself. In Hop configuration file Projects
we can find the following options:hop-config.json
{
"projectMandatory" : true,
"environmentMandatory" : false,
"defaultProject" : "default",
"defaultEnvironment" : null,
"standardParentProject" : "default",
"standardProjectsFolder" : "/home/matt/test-stuff/"
}
Option | Description | hop-conf option |
---|---|---|
projectMandatory | This will prevent anyone from using hop-run without specifying a project |
|
environmentMandatory | This will prevent anyone from using hop-run without specifying an environment |
|
defaultProject | The default project to use when none is specified |
|
defaultEnvironment | The default environment to use when none is specified |
|
standardParentProject | The standard parent project to propose when creating new project |
|
standardProjectsFolder | The folder to which you’ll browse by default in the GUI when creating new projects |
|