Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Run azurite using pm2 #56

Closed
waygee opened this issue Jun 1, 2017 · 4 comments
Closed

Run azurite using pm2 #56

waygee opened this issue Jun 1, 2017 · 4 comments

Comments

@waygee
Copy link

waygee commented Jun 1, 2017

Is it possible to run azurite using pm2 process manager for nodejs?

I would like to do something like:

cd /dir/where/azurite
pm2 start someprocess.js

Thanks for your help in advance.

@arafato
Copy link
Owner

arafato commented Jun 2, 2017

Good point @waygee ! I do not see a reason why pm2 should not work with Azurite. There are two points, however, that need to be considered IMHO:

  • executing Azurite on multiple cores (resulting in multiple processes) can lead to race conditions since it is not stateless. Azurite stores metadata in an in-memory database which is persisted every 5 seconds to disk.
  • graceful shutdown is not supported yet as SIGINT is not intercepted yet. Happy to add support for that.

Thoughts?

@waygee
Copy link
Author

waygee commented Jun 3, 2017

Thanks for your response @arafato, in regards to the issues you raise:

I intend to run Azurite in a single thread (in forked mode in pm2), so I believe I can get by with the first limitation.

In addition, I am intending to use Azurite in a vagrant virtual machine for dev/testing purposes so I think it would be ok to not have graceful shutdown right away. Thank you for considering to add support for graceful shutdown, it would be very welcome.

I originally opened the issue to get the correct command line syntax for starting azurite using pm2. Can you help supply the actual command that I would need to run?

arafato added a commit that referenced this issue Jun 3, 2017
@arafato
Copy link
Owner

arafato commented Jun 3, 2017

Assuming that Azurite has beed installed globally with $ npm install -g azurite, you can run it with pm2 as follows:
Under Linux you can simply start it with $ pm2 start azurite.
Under Windows there seems to be a bug with starting globally installed packages. See Unitech/pm2#2037 for details. This also affects Azurite.

You can, however, install it locally into some folder. Assuming that we are in c:\\local\folder, execute the following steps:
You install it locally with
npm install azurite
cd node_modules\azurite
pm2 start bin\azurite

@waygee Does this work for you? If not please re-open this issue.

I've also just added support for graceful shutdown. Will be published in the next few days as v0.7.10.

@arafato arafato closed this as completed Jun 3, 2017
@arafato
Copy link
Owner

arafato commented Jun 4, 2017

@waygee just published v0.7.10 which brings support for graceful shutdown for PM2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants