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,

(Jingyang Chen) #8

Thank you, I hope you are staying safe and healthy too
I’m using an ubuntu system, but when I do:

sudo apt-get install iofogctl=2.0.0-beta2
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Version ‘2.0.0-beta2’ for ‘iofogctl’ was not found

I also tried 2.0.0, 2.0.0-beta1, etc.

Thank you for your help :wink:

(Pixcell) #9

Hi @Jingyang,

Could you please give us more informations about the Ubuntu distribution you are using ?

Running: lsb_release -a in the terminal should do.

Thanks !

(Jingyang Chen) #10

It gives me:

LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Thank you!

(Pixcell) #11

Thank you !

Running this should get you the latest release of iofogctl

curl -s | sudo bash
sudo apt-get install iofogctl=2.0.0-beta3

The documentation about the new iofogctl can be found at: (The link is not valid yet, but we are working at release 2.0 doc in the next 24hours)

However, please note that version 14 of Ubuntu is not officially supported as of April 2019 (
This is why your apt-get could not find the package, we have updated our release process to produce the packages for Ubuntu 14 (trusty).

Thank you for your patience,

(Jingyang Chen) #12

Hi Pixcell,

I have successfully installed iofog 2.0.0
Just tried to use it to deploy a local ECN, seems like there are some changes when writing the deployment yaml file, saying could not handle kind controlplane, etc.
I will just wait for the release of the new documents. :wink:
Thank you again for the help!!


(Serge Radinovich) #13

The 2.0.0 docs have a staging website. You can start here:

The new YAMLs are explained here:

Take a look at the Platform Deployment section also.

Note that if you have deployed with a previous 2.0.0-beta* iofogctl, it is recommended that you delete the deployment with your previous iofogctl and then redeploy with beta3.


(Jingyang Chen) #14

Hi SergeRadinovich,

Thank you for the document, I have successfully deployed a local ECN.
When I tried to deploy a remote ECN:

sudo iofogctl deploy -f remote-ecn.yml
! Could not handle kind ControlPlane. Skipping document
! Could not handle kind Agent. Skipping document
:heavy_check_mark: Successfully deployed resources

Did I use a wrong kind?


(Serge Radinovich) #15

Yes it looks like you used the wrong kinds.

I recommend reinstalling iofogctl (brew upgrade iofogctl or brew upgrade iofogctl@2.0 on Mac) so that version is 2.0.0-beta4.

Then you should copy and paste the YAML templates for Control Plane and Agent from the website and edit those to avoid further errors.

Let me know how you go. Thanks

(Jingyang Chen) #16

Hi SergeRadinovich,

Hope you are doing well, staying healthy and safe! :wink:

Thank you, I have successfully deployed a remote ECN.
Just one question, I saw when deploying a local controller and local agent, there is actually a docker image being pulled, but when deploying a remote controller and agent, we did not pull a docker image. So why is that? What’s the difference between them?

Thanks a lot in advance!

(Jingyang Chen) #17

Hi SergeRadinovich,

Sorry, one more question. :wink:

I can’t deploy two controller on the same machine or can’t deploy two agents on the same node either?

I tried to deploy two agents on the same node, the previous running agent status just turned to unknow, and even though the status of microservices on the node are still running, they actually stopped functioning.


(Serge Radinovich) #18

When deploying a local ECN, the machine you run the deploy command will pull the images it needs. When deploying to remote machines, those machines will install Controller and Agent using the appropriate Linux package directly on the host.

(Serge Radinovich) #19

A single host can only run a single Agent and/or Controller.

There is simply no need to have more than one per host - is there a particular use case you were trying to achieve that we can help with?

(Jingyang Chen) #20

There was a mistake I made when I deploy, I accidently deployed two agents on the same node, so was just wondering, thank you for the help.

I’m still trying to understand the concept - router, is there any additional document so I can learn more about router? Thank you! :wink: