Migrating your Node.js and Meteor apps from Xervo, (formerly Modulus) to NodeChef with zero-downtime

This week, Xervo, (formerly Modulus) announced that it is winding down its service and it will be fully retired on April 28, 2017.

Xervo provided a platform for developers to deploy, host and manage their Node.js, Java and MongoDB applications. The good news is NodeChef is providing Xervo customers a solid alternative for hosting their Node.js and Meteor apps with enterprise grade MongoDB. NodeChef also gives you the option to host your database anywhere.

We have put together this migration document to help with the transition to NodeChef. In this migration guide, you will learn how to clone your Node.js/Meteor app and MongoDB database to NodeChef and test it before directing your production traffic to your NodeChef instance.

Note that this document uses an example app called "catg".

1. Create your App on NodeChef.

Sign up for an account on NodeChef. After signing up, log in to your account. From the dashboard, click on Deployments → Node.js or Meteor. Type in the application name. In this case ‘catg’. Select the size of your app and database containers. If you do not wish to use the NodeChef MongoDB service, select none for the database. Click on the Launch button to create your App.

2. Deploy your code to your container.

You can deploy your app by uploading your project or using the CLI.

For deployments using the CLI, download and install the Nodechef CLI. This can be found in the dashboard. After installing the NodeChef CLI, launch the CLI and log in. The minimum command required to deploy your app is as follows.

deploy -i catg

For Meteor apps, the CLI only deploys the "tar.gz" output of the meteor build command. This file must also be named "catg.tar.gz".

You can also deploy your app from the dashboard by uploading your meteor build output (The tar.gz file generated after you run meteor build) or uploading the contents of your node.js project folder as a zip or tar.gz archive. Click on Deployments → Deployed Apps → Cluster Actions → Deploy app

You can configure your environment variables either from the dashboard from the Task Manager or from the command line on deployment of your code.

3. Migrating and syncing your MongoDB database.

From the Task Manager, Click on DB Actions → Database import. A connection string to your MongoDB database is required. If you wish to keep your NodeChef database in sync with your current database, you must provide the connection string to your local database which contains the "OPLOG" collection. After you enter your connection string, click on start migration to migrate your database. You can migrate your database multiple times before switching over production traffic. You can first migrate the database to test the app and after confirming all app functionality works as expected, you can perform a final migration. Syncing your database with your NodeChef database is recommended as it ensures you do not lose any writes in the process of switching traffic over to NodeChef.

4. Adding your domain.

From the NodeChef dashboard, navigate to the Task Manager, click on App actions → Domains. Enter the domain name you wish to add. NodeChef supports wildcard domains by default. For example if you add the domain "catg.com", incoming traffic with the host header "app.catg.com" will be routed to one of your app containers. NodeChef requires you validate ownership of your domain by setting a TXT record in your DNS settings for the domain catg.com.

5. Switch traffic over to NodeChef.

Point your HOST A record to the IP address of the assigned load balancer. You can find the IP address from the Task Manager → App actions → Custom Domains. In most cases, you will not outright shutdown your current instance with your provider which can result in traffic still hitting your old instance. If you enabled syncing when migrating your database, you can continue to sync the database without finalizing to ensure you do not lose any writes that are committed to your old instance.

6. Setup SSL using Lets encrypt certificates or upload a custom certificate.

For our use case for the catg app, we wish to secure the domains www.catg.com, catg.com and app.catg.com with a free Lets encrypt certificate. Navigate to the Task manager and click on App actions → SSL settings. Enter the domains to be secured and click the save changes button. Note this is a one-time process. After the certificates are issued, they will be renewed forever.

If you wish to upload your own SSL certificates, you can follow the this guide.

In some cases you might want to require all clients connecting to your app use SSL/TLS over HTTP. You can enable this from the Task Manager. Click on App actions → Routing. Under the force SSL option, toggle the check box to Yes and save your changes.


For more information on deploying a Node.js and Meteor app on NodeChef, please check out our extensive node.js hosting documentation. In the meantime if you have any questions or need migration help we invite you to contact us. We look forward to helping you build the future.