Meteor

Meteor is a complete open source platform for building web and mobile apps in pure JavaScript. It focuses problematics around real time web to emphasize the most fluent experience possible.

Getting started tutorial

Deploy your first Meteor application: URL

Deploy an existing application like Telescope: URL

Meteor app detection

The directory .meteor should be present at the root of your project

Meteor dependencies installation

  • Using meteor embedded dependency management (with meteor add and meteor update)
  • npm using meteorhacks:npm package. This package requires some custom actions to be setup, please follow the documentation at this page

Meteor app startup

A script named .start-meteor-app is automatically generated after the build of your application. Its role is to start correctly your application.

Generated .start-meteor-app:

cd .app-build/bundle/programs/server
exec node boot.js program.json

The buildpack also generate a .release file

default_process_types:
  web: ./.start-meteor-app

If no Procfile exists, the web type of the .release will be executed by default. If your wish to write your own Procfile don’t forget to keep this line for your web process, otherwise your application may not boot.

Configuration

Meteor settings

If you have a settings.json or a config/settings.json file that you usually run with meteor --settings settings.json, you have nothing to do it will be handled by our deployment system, but this method is deprecated.

Storing configuration data like credentials in a file present in your GIT repository is not recommended. We advise you to use the environment variable METEOR_SETTINGS, the variable is automatically read by Meteor and it stays out of your code repository. You have to set the content of this environment variable (with our CLI or through your web dashboard) to match the content of your settings.json file. Furthermore, using this method allows you to manage easily multiple environment of the same app.

If you’re using a settings.json file, here is the method to migrate to an environment-based setup:

$ echo 'settings.json' >> .gitignore
$ git rm --cached settings.json
$ git add .gitignore
$ git commit -m "Add settings file to gitignore to avoid having credentials in code"
$ scalingo env-set METEOR_SETTINGS="$(cat settings.json)"
$ git push scalingo master

Built-in mobile integration

If you need to use your application as a backend for your Android and/or iOS application, don’t worry. It is done by default by the platform. You need to use Meteor ≥ 1.3, if that’s the case, the flag --server-only will be used to build your app. Finally, your mobile apps will be able to communicate with it without any problem.

Debug build

By default, Meteor minify all your assets to stand in one single javascript file, if you want to make a ‘debug’ build (assets unminified), please defined the following environment variable:

scalingo env-set METEOR_DEBUG_BUILD=true

How to scale Meteor

As a real time framework, the number of scaling constraints is higher than another more classical framework. Each instance is keeping some stateful information and each instance has to be able to get instantly the most up-to-date data. To achieve that, the two common processes used are the sticky sessions and the oplog feature of MongoDB.

Oplog

Oplog is a MongoDB feature which logs all the operations achieved on a MongoDB cluster. Meteor uses this feature to sync different instances of an application.

See also Oplog Observe Driver

It can be enabled from the addon database dashboard. When activated it wil automatically add the MONGO_OPLOG_URL in your application. This variable name is the standard name to configure Meteor. As a result, you juste have to restart your application.

Link to Dashboard

This operation will restart your database instance so your application may raise an exception

Sticky Sessions

The usage of sticky sessions is also know as session affinity

Session affinity is the process of saving on which instance a given user has been routed, in order to use this route again for a given time. Our load balancers have sticky sessions enabled automatically for Meteor apps. A user will keep using the same route during 1 hour.

You have nothing to do except increasing the amount of containers you are using, to do so, open the dashboard of your application and in the containers tab, then you can increase the amount of containers as needed, click on scale and the amount of instances will be scaled instantly.

Buildpack

The deployment of Meteor application is handled by our NodeJS Buildpack which has been modified to manage particularly Meteor application.

  1. It detect Meteor application
  2. Choose the good NodeJS version
  3. Install Meteor runtime
  4. Build project
  5. Prepare runtime environment
schedule 26 Jul 2016