Meteor backup servers

I have a huge product, which is running up and live.
I am updating the application and introducing new features daily.
By doing so, I have to push the code and because of that my Meteor Server restarts, now here I face a downtime,
Sometimes I have to update Meteor when there is a new release available from MDG. here I face downtime.
I want something that my App never faces a downtime,
There should be a backup server, like if SERVER A is busy or down, the SERVER B should be available in that case, and may there should be a SERVER C.
Is there any possibility to achieve such mechenism?

Whats your CI process like? Are you pushing a tar bundle to a server? Yes you can have several instances of your server running but a simpler solution would be to have to CI process make a build and deploy it once its done. This allows you to keep your present Meteor process running until the CI process is complete. Downtime is minimal (matter of seconds while the new Meteor process is booted up).

@crownglasses Can you please explain what do you mean by CI process?

“continuous integration”. hopefully you’re not manually deploying to servers, you should have a setup where when you merge commits to master or some release branch, a machine will automatically build your code, run tests, and deploy if all tests pass

To add to this, whenever I’ve deployed an update to an app with pm2, there is no downtime. The updated package immediately gets downloaded and reflected on the client.

EDIT: spelling / grammar

Pm2? What is pm2? Do you have some resources about CI specific or not to Meteor?

I have my Meteor Server synced with a Git Repository, whenever I have to update my code or some packages, I simply push the code and pull on main server, by doing that my Meteor Server restarts to use the updated code, and when there is some new package or version updation, in that case I do face a downtime, I don’t know how is this even possible without facing a downtime.

In simple words whenever the Meteor is involved in building, the app does face the downtime, as soon as the Meteor server is restarted, then its up and running again.

FYI, I use --production flag on my live server.

pm2 is like forever, a process manager for node apps. Here is a meteor specific package.

It automatically restarts the process if it does, you can also deploy a new version of your app and restart with pm2 and suffer no downtime etc. My CI is built on what pm2 offers really.

pm2 is great. if you have high resource needs, when you outgrow pm2 you can look into kubernetes for zero-downtime deployments.

however, you can really do this even with a standard nodejs setup. basically you bundle up and deploy your app, ensure it is running successfully, and then redirect internal traffic to the new version of the app. all you need is something like an nginx proxy sitting in front to determine where to send traffic. i created a screencast on how to do this at egghead (https://egghead.io/lessons/setup-an-nginx-proxy-for-a-node-js-app). if you are using docker, this is the related cast (https://egghead.io/lessons/node-js-setup-an-nginx-proxy-for-a-node-js-app-with-docker).

1 Like