How do you create your own MODL file

What are the steps to create a new module?

The shortest answer is reading the whole SDK guide, compile the github templates as reference and a lot of testing.

1 Like

Some parts of the SDK guide are quite outdated, the module tools GitHub page is where I would recommend starting from.

  1. Use the generator to create a skeleton project.
  2. Use the gradle plugin to build/sign the module.
  3. Once you have that working start building off of the skeleton project.
2 Likes

Thank you so much

Thanks

Note that technically all you need to create is a module is at least one .jar file that implements one of our expected hooks and a module.xml file that describes it. How you generate those files is entirely up to you; we have Gradle and Maven plugins to make it easier, but they’re, strictly speaking, not required. @pturmel, at least at one point, used ant and eschewed our tooling entirely.

I say this to clarify that there’s nothing ‘magic’ about our tooling; anything that builds Java should be able to build an Ignition module without too much trouble.

2 Likes

Still do. Though I do use your module-signer.

Will continue to use ant until 7.9 is EOL.

@kingbetty511

I’m replying here because I went through this myself recently and I think my feedback might be helpful compared to someone who has huge amount of module design experience (i.e. my experience building modules is sub-novice).

All of this is basically in the SDK guide, but I will say that while reading the guide is indeed very helpful its not going to get you everything, you’ll have to gather information from multiple sources. Be ready for that up front.

Environment

Install JDK and install intelliJ. The documentation says to install Maven but you actually don’t need to because it is available inside intelliJ. You would use this alot once you get started:

Examples

The examples provided by Ignition are fantastic, at first get your environment set so you can build and install them. Don’t worry about understanding everything, just get to the point where you can create a “modl” file and see what it does after you install it. Two that were extremely helpful to me:

Scripting Function
Webpage Example

Installing Unsigned Modules

To do this, you’ll need to edit this file:

Note that depending on your laptop or company security policy, you may have to adjust the security properties of the file as an administrator in order to edit the file (I had to do this).

Then in the file you add the following text:

wrapper.java.additional.7=-Dignition.allowunsignedmodules=true

After that you have to re-start the Ignition service for the change to go into affect (I use windows). Again for this step, depending on your security policy, you many need administrator rights to do this.

Signing Modules

This is talking about self signing. Anything above that I have not yet done. You need to utilize 2 different things: “keytool” which is provided when you install java and the ignition module signer.

What you get from the module signer git repository has to be build in intelliJ using

mvn-package

Once its built you will have these files available:

At first you need to run the key tool, this is an example of what that looks like. There are more sophisticated and automatic ways of doing this, but this shows the process in CMD.

CD C:\Program Files\Java\jdk-11.0.12\bin
CALL keytool -genkey -noprompt -alias Company -dname "CN=Company , OU=IT, O=Company , L=National, ST=State, C=US correct?" -keyalg RSA -keypass Password -storepass Password -keystore keystore.jks -validity 3650
CALL keytool -export -alias Company -storepass Password -file certificate.crt -keystore keystore.jks -keypass Password
CALL keytool -import -v -trustcacerts -alias Company -file certificate.crt -keystore cacerts.jks -keypass Password -storepass Password
CALL keytool -export -alias Company  -storepass Password -file certificateChain.p7b -keystore cacerts.jks -keypass Password

Once you have done that, you will have these files, which are shown here already moved over into the same directory where the module signer lives:

The to sign the module you do this, again from CMD:

java -jar module-signer-1.0.0-SNAPSHOT-jar-with-dependencies.jar -keystore=keystore.jks -keystore-pwd=Password -alias=Company-alias-pwd=Password -chain=certificateChain.p7b -module-in=C:/Users/N0R01DF/Kafka/kafka-build/target/Kafka-Ignition-Module-unsigned.modl -module-out=C:/Users/N0R01DF/Kafka/kafka-build/target/Kafka-Ignition-Module-signed.modl

Then finally at the end of the yellow brick road you have your signed file and you’re happily on your way.

Building Javascript files (Webpage Example)

This is in the webpage example but it took me a minute or two to figure out which is why I’ll reiterate it here (for windows). You need to install this:

Once that is installed and you have your CMD (in admin mode) pointed at the javescript folder, you do this:

If its the first time and you have no npm installed:

nvm install latest
nvm use latest
# you can also specify a version from nvm list

Then to build the webpage example you do this:

npm run build:prod #r dev

Happy building!

Cheers,

Nick

5 Likes