Deploying a Meteor app, however bears a strong resemblance to deploying other kinds of software, is much easier, especially when you are familiar with working on websocket-based Node.js app. Since it is a must to bring your app into play after all of your effort to develop, I would love to dig deep into what you should take into consideration before deploying. In this blog, I am going to list some of essential stuff like this, including deployment environments, variables, domain name, SSL certificate and CDN.
Deployment environments in Meteor includes three server tiers that are Development, Staging and Production:
- Development: This is where you develop new features for the app and run local tests. If your app runs successfully with the code, it will move to the Staging.
- Staging: This environment is made to resemble Production environment but invisible to users. Here, your application will be checked on all features as well as performance before being released.
- Production: After your app goes through the test in Staging, it is officially deployed for users to interact directly with.
Deployment environments are explained in great detail at:
Environment variables and settings
Make sure environment variables and settings all are available for your deployment process.
- Environment variables comprises a set of dynamic named values ENV_VARS such as MAIL_URL, MONGO_URL, ROOT_URL and NODE_OPTIONS. They can affect the way running process which is, in this case, Meteor. Without environment variables, settings could not be configured when running in production.
One reliable destination for getting variables is https://nodejs.org/api/process.html#process_process_env
- Settings help you store all the important information of your app in each environment and has the form of settings.json. You can create a settings.json file and run it by using the command line
meteor run --settings settings.json.
or put it into the METEOR_SETTINGS environment variable.
Domain name, SSL Certificate and CDN
Remember to register a domain name for your site, so that users can access to your site. Then, it is absolutely necessary for you to generate an SSL (Secure Sockets Layer) certificate.
CDN (Content Delivery Network or Content Distribution Network), in spite of being optional, should be set for your site. With CDN, content and images will be delivered to end-users with a high quality and high performance
Read more at https://guide.meteor.com/deployment.html#cdn.
That brings me to the end of this blog. In the next blog, I am going to show you How to deploy a Meteor app in reality. Stay in touch and I will keep you updated.