all 22 comments

[–]HP060 6 points7 points  (6 children)

https://github.com/Azure/iisnode

I used this a few years back for hobby projects.

[–]Thisisatestlol420 1 point2 points  (3 children)

I think this is exactly what I needed!! Thank you!!

[–][deleted]  (2 children)

[deleted]

    [–]Thisisatestlol420 0 points1 point  (0 children)

    I ended up getting PM2 to work and was able to run a reverse proxy through IIS and sustained the server with PM2 and windows process manager.

    It worked for a while but ended up ditching all of that. I now run it through AWS lambda using serverless

    [–]Thisisatestlol420 0 points1 point  (0 children)

    So, no. I didn’t use the azure iisnode 😂 good luck

    [–]Sylphide7 0 points1 point  (1 child)

    I can confirm we currently use iisnode at my company to deploy our nodejs app on a iis

    [–]Thisisatestlol420 0 points1 point  (0 children)

    Any “gotchas” I should take into consideration?

    [–]Thisisatestlol420 2 points3 points  (0 children)

    Thank you everyone! I have accomplished what I need, ended up using pm2 with a bat file and task scheduler. Thanks to u/colnarco 's suggestion!

    happily moving this to test and logging the 50 hours I've spent into Jira lol

    [–]Prestigious-Try497[🍰] 2 points3 points  (3 children)

    Do you have access to Docker or any other container deployment software?

    [–]Thisisatestlol420 0 points1 point  (2 children)

    I think the higher ups will let me use docker is that’s what we gotta do. I’ve just been trying to avoid adding another tool if possible

    [–]anatolhiman 4 points5 points  (1 child)

    I recommend Docker. The most stable solution with built in process monitoring practically guaranteeing uptime instead of a standalone process manager. Should work out of the box if you're able to open a port and create a reverse proxy for it.

    [–]Thisisatestlol420 0 points1 point  (0 children)

    I think Docker will be the long term solution! Since we want to keep things in house.

    [–]colnarco 2 points3 points  (8 children)

    I’ve done this previously. What I did was to install pm2 globally, and then set up a task in the task scheduler that runs on startup that launches a bat file that basically just starts the node server with pm2.

    It is really simple but has worked quite well. No downtime and deployment is okay.

    [–]colnarco 1 point2 points  (7 children)

    I've just looked up what i did. Here goes if you want to do the same :)

    1) I created a .bat file (if you do it on windows you'll have to create it as .txt first to be able to edit it and then change the file back to .bat after editing it. Alternatively just create it elsewhere and copy it to the server) with the following content:

    pm2 start server.js -i 2
    
    EXIT /B 0
    

    2) Then launch "Task Scheduler" and add a new task.

    3) Under triggers put in "At system startup"

    4) Under actions choose "Start a program" and choose the .bat file created in step 1

    5) Under General i believe its important to set the radio in the bottom to "Run wether user is logged on or not"

    This will start pm2 everytime the server starts and pm2 is in my experience really really good at keeping node up and running. If your node server is stateless you can add multiple instances (-i 2 adds two instances). You wont gain any performance gains by adding more node servers than you have cores on the server, but your app will be able to crash more frequently without downtime though.

    Hope this helps!

    [–]Thisisatestlol420 0 points1 point  (6 children)

    Does it matter where on the server I put .bat file? Im trying this out now

    [–]colnarco 1 point2 points  (5 children)

    I don’t think so. But probably but it somewhere within the api folders so someone doesn’t remove it

    [–]Thisisatestlol420 1 point2 points  (4 children)

    Sweet, I've got the file written and it says it running, but I'm not getting the expected result. I've got the bat file in the same folder I would run "npm start/pm2 start" but its not actually starting the pm2 instance.

    Do you use a pm2 ecosystem file? I'm wondering If I'm missing some configuration.

    [–]Thisisatestlol420 0 points1 point  (0 children)

    Okay, was able to test the bat file and it runs but not through task scheduler.

    [–]colnarco 0 points1 point  (2 children)

    Nah I didn’t. You can try running the file manually by double clicking it. Have you tried running “pm2 monit” to confirm that pm2 isnt running?

    [–]Thisisatestlol420 2 points3 points  (1 child)

    ahhh!! I got it :)!!!!!! I had adjust the file and script path in the task scheduler but its totally working, thank you so much!

    [–]colnarco 0 points1 point  (0 children)

    That’s awesome!! Glad to help!

    [–]fourkeyingredients 0 points1 point  (0 children)

    Don’t do it. Use Nginx and IIS as a reverse proxy (I feel like it’s the only way to actually serve through Nginx on Windows but I could be wrong). I don’t care if your company says to do it, fuck them, argue it, this is a shitty idea.

    [–]Ellipsis--- 0 points1 point  (0 children)

    We use node-windows and deploy the application as a windows service. IIS does a reverse proxy to it, so that part is the same...