Best practices for operational management of microgateway (edgemicro) on Windows

Not applicable

Hello! We are new to the Apigee ecosystem and are working to set up an Apigee Edge topology that includes the deployment of the Microgateway within our network (on-prem).

Based on my initial usage of this component, it appears to run under the user that is currently logged in. When I "configure" the microgateway, it generates (and then uses) files that are stored in my profile (i.e. c:\users\username\.edgemicro\*). And, once you launch the microgateway, it just sits running in the command window in which it was launched. I'm not sure how a "team" can support this model. Especially since (as an example) I'm going on vacation next week and the microgateways are all running under my profile.

So on to the questions:

1. What is the best practice to support multiple people managing this environment?

2. How can another user manage it if a different user started it?

3. How do we ensure it launches when the server boots up?

4. Do you REALLY have to run configure (and get new keys) when you want to change the configuration? Or can you just directly edit the YML that gets created (and stuck in your profile LOL) and then stop/start?

5. Any other recommendations for how to manage this in a production environment?

Thanks!

Kevin

Solved Solved
1 3 2,149
1 ACCEPTED SOLUTION

Not applicable

Hi, Kevin.

  1. You can run everything under a service account, make changes to the configuration in a source control system, and deploy to %USERPROFILE%/.edgemicro when you're ready to release. Everyone can even use the same configuration locally for testing if you prefer.
  2. You can run the microgateway as a Windows Service and manage it like you would any other Windows Service.
  3. You can AutoStart the Windows Service.
  4. You only have to run configure when you want to get a new key/secret pair. You can just edit the YAML and restart for local config changes.
  5. Again, you can manage this like any other Windows Service.

In addition to what @clatimer1 mentioned, you can try using nssm, a tool I've used in the past. Here's an example command of how to install the service:

nssm install "Apigee Edge Microgateway" "C:\Program Files\nodejs\node.exe" """C:\Users\Kevin Swiber\AppData\Roaming\npm\node_modules\edgemicro\cli\edgemicro""" start -o <org> -e <env> -k <key> -s <secret>

Replace the directory paths with valid values pointing to the location of your Node.js executable and the location of your edgemicro installation. Replace <org>, <env>, <key>, and <secret> with the right values for your configuration.

TIP: If you're running this under your Local System account, you need to place the .edgemicro directory with the configuration under C:\Windows\System32\config\systemprofile.

If you want to capture output from the Apigee Edge Microgateway Windows service, please follow the instructions here: http://nssm.cc/usage#io

Let me know if that works.

Cheers,

Kevin Swiber

View solution in original post

3 REPLIES 3

Not applicable

Hi Kevin,

Take a look at the windows-node npm, this will let you create a service wrapper around node.js programs. You should be able to then manage it along with other services that launch at startup. It also gives you access to other service features such as running as Admin, launching at startup, and having a common place where team members with access can manage the service.

Chris

Not applicable

Hi, Kevin.

  1. You can run everything under a service account, make changes to the configuration in a source control system, and deploy to %USERPROFILE%/.edgemicro when you're ready to release. Everyone can even use the same configuration locally for testing if you prefer.
  2. You can run the microgateway as a Windows Service and manage it like you would any other Windows Service.
  3. You can AutoStart the Windows Service.
  4. You only have to run configure when you want to get a new key/secret pair. You can just edit the YAML and restart for local config changes.
  5. Again, you can manage this like any other Windows Service.

In addition to what @clatimer1 mentioned, you can try using nssm, a tool I've used in the past. Here's an example command of how to install the service:

nssm install "Apigee Edge Microgateway" "C:\Program Files\nodejs\node.exe" """C:\Users\Kevin Swiber\AppData\Roaming\npm\node_modules\edgemicro\cli\edgemicro""" start -o <org> -e <env> -k <key> -s <secret>

Replace the directory paths with valid values pointing to the location of your Node.js executable and the location of your edgemicro installation. Replace <org>, <env>, <key>, and <secret> with the right values for your configuration.

TIP: If you're running this under your Local System account, you need to place the .edgemicro directory with the configuration under C:\Windows\System32\config\systemprofile.

If you want to capture output from the Apigee Edge Microgateway Windows service, please follow the instructions here: http://nssm.cc/usage#io

Let me know if that works.

Cheers,

Kevin Swiber

That nssm tool was sweet! Thank you for sharing.

This works great. I did change the user to "Network Service" so it's not running as an admin (and put the .edgemicro directory in that profile folder) and it all seems to be working great.