How do you create your own MODL file

@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

9 Likes