Add a rule for the microservice while deploying


(Jingyang Chen) #1


My microservice follows a rule which is defined in a .json file, when I run the app, I would just add a environment variable to give my microservice the path to find the rule like this - RULES_CONFIGURATION=./config/rules.json. so my microservice can find this rule and when the input matches the rules, some actions would be triggered.

But in iofog where can I define the rules so I don’t need to hardcode the rules in my Docker Image, but change the rules everytime when I deploy my microsrvice.

Thanks a lot in advance.

(Pixcell) #2

Hi @Jingyang,

You can use volumes in your microservice yaml definition to mount volumes into your docker container.
Then, you can use env variables to tell your microservice where to look for the json file.

As of 1.3, we dont have a way to send the files on your Agent yet, but this is coming with 2.0 (In beta stage, to be released soon), so it is up to you to copy the file onto your agent before deploying the microservice.

I hope this resolves your issue,
Let us know if you have any question,


You can also use the ‘config’ section of the micro service yml to configure the location of the json file. Config can also be updated at runtime which could be handy for changing rules. Etc

(Jingyang Chen) #4

Thank you very much for the answer, we have a work around for now, just wondering what is the excepted releasing date of 2.0? Thank you.

(Serge Radinovich) #5

iofogctl 2.0.0-beta2 allows you to deploy volumes to agents and it is released now. You can see installation instructions here (make sure to change 1.3 to 2.0 e.g. brew install iofogctl@2.0:

iofogctl 2.0.0-beta3 will have capability to get, describe, delete, and deploy volumes and that will be out in the next few days or next week most likely.

(Jingyang Chen) #6

Hi hope everything is going well with you guys!

Just tried to install an new iofogctl, just wondering what is the most updated version of iofogctl? I’m using ubuntu system, I used: curl | sudo bash
sudo apt-get install iofogctl
and when I look at the version, it is 1.3.0, is this the most updated iofogctl version?\

Thanks a lot in advance!

(Pixcell) #7

Hi @Jingyang,

Thank you we are all doing good ! We hope you and your loved ones are safe and healthy.

We will investigate why packagecloud gave you 1.3 as the latest (maybe because 2.0 is still in beta version), but should be able to specify

sudo apt-get install iofogctl=2.0.0-beta2

This will install the latest version, it comes with a lot of new features and updates to the YAML specifications. We are aiming to release the documentation by Monday PST. We will let you know when it is available.

Best regards,