Impediments to rapid development in Edge Micro

kkleva
Participant V

Rapid development is a must since I'm likely going to fail way more than I succeed. Here are a handful of impediments I've hit when building micro gateway plugins.

  • The manual process of calling two commands, one of which requires pasting in a UID, just to load a code change during development. Remember as a Node developer I'm accustom to tools like 'nodemon' so anything more Cntl+S is blasphemy!
  • Logging to stdout (console.log, process.stdout.write) stops working after resetting the microgateway. This makes debugging and iterating more difficult/time-consuming. Any way around this? This also ties into the previous question. Fully restarting the gateway will restore console logging, but it’s not a quick thing to do.
  • Even when sending an `agent proc stop` command, there is often a node process left open. In order to start the proxy again, it is necessary to manually kill this process, otherwise it won't start because the required port is still in use. Is there a better way to cleanly stop the gateway?

Is this just me? Your thoughts are appreciated!

0 6 375
6 REPLIES 6

prabhat
Participant V

1. If you set key and secret as environment variable on terminal where agent would run, it will automatically start gateway. It that case it's just 'npm start'.

2. This is something we need to look into.

3. Likely a bug which we will look into.

Thanks.

With regards to #1, it seems like this would make the initial startup quicker, but would it also not allow you to start in debug mode as described here? Also, for restarting or stopping, I think you would still need to manually copy the UID and send `agent proc -c <cmd> -u <copiedUID>`. This copy/pasting the UID to send commands to the agent process is what I am finding most tedious, especially if I am starting and stopping the gateway a lot, so the UID is always changing.

we got around #3 by making edge a systemd service and using systemd to manage if its running or not. systemd has magic code to handle child processes - so yeah.

prabhat
Participant V

Hi @epackwood For debuggin purpose, @shawn feldman is going to give you a "patch" using which you can connect node debugger to underlying gateway. We will bake that into product in next release.

Regarding stopping/restarting, if you have right environment variables, wouldn't it be easier to simply stop and start the agent (ctrc+c -> npm start) instead of using CLI?

I think that would be a good option, but unfortunately ctrl-c does not seem to be sufficient to shut down all of the gateway node processes for me. Using environment variables and starting with `npm start` opens three node processes. ctrl-c only stops one of them. Of the remaining two, one is automatically restarted by the other when it's killed, so sometimes it takes a couple attempts to correctly kill them both. I'm on windows by the way, so not sure if behavior on *nixes is any different at all.

prabhat
Participant V

Hey Kristopher, We listened to your feedback and some other customers feedback. With Microgateway 2.0 release, there is no longer two process model of agent and gateway. On top of that configurations are namespaced with org and env so that you can run multiple instances on same host. Pls give it a try. @Kristopher Kleva