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

9 Likes

Adding here in case it can help someone, when building the JavaScript portion, if you get an error related to webpack, these commands may help:

nvm install latest
nvm use latest
npm i -g webpack webpack-cli
npm link webpack-cli

Thanks to @Allen_Miller for these pointers.

Cheers,

Nick

2 Likes

I am very new to Ignition Modules development. I want to know which programming languages should I know or learn to be able to develop Ignition Modules?
Can it be written only in Java?

Actually, I am planning to write a module which will have a user interface and do certain tasks - Database operations will be involved in it.
So, what tools and languages can I use to accomplish this?

I come from a C# background. I have used Angular. I was wondering if I could use those.
Any guidance will be appreciated.

Any JVM compatible language. Many IA people are switching to Kotlin. I'm a dinosaur--only Java in my modules.

Thanks much!!
So, that means I can use Jython as well which Ignition uses for scripting?
What do you recommend for UI?

No. Jython does not produce JVM bytecode at compile time.

I was convinced a few years ago that JetBrains IntelliJ (aka IDEA) was the best IDE. Haven't played with any other java IDE since.

Sorry, I think i was not clear when I asked about UI.
I didn't mean IDE for Java.

The module that i am planning will have a User Interface, it will do some tasks - DB operations involved. I meant, what do you recommend using for the User Interface in my Module?

Why are you building a module instead of using Ignition directly?

Let's say I want to manage the "Shipping" area of the plant. So, I want to develop a module for it which will do everything that is required in shipping section of the plant.
I can then import this module for all the plants and configure it as per the needs.

I could do that with Ignition screens and scripting but I want to start building reusable modules which can be used across the plants.

Ah. Your module would need to create custom UI components for the designer, either Vision components (extensions of java Swing), or Perspective components (extensions of React). There are sample projects in the IA examples github repo that provide the framework for such.

(You don't get any other choices.)

Thank you very much. I really appreciate you taking the time to respond.

I'll explore these.