Get Started with Meteor on Scalingo
Requirements
Before doing this tutorial you should have setup your environment:
-
Setup the SSH authentication, it has to be done to let you
push
your application on the platform. - Install ‘scalingo’ Command Line Interface
Initialize your application
# Install Meteor
$ curl https://install.meteor.com | /bin/sh
# Create your app
$ meteor create my-app
$ cd my-app
# Add everything in the Git repository
$ git init .
$ git commit -m "Init meteor application"
Create your application and provision a Scalingo for MongoDB® database
The Meteor framework uses extensively MongoDB® as a database. Hence you need to provision a new instance of this database to your application.
$ scalingo create my-app
Git repository detected: remote scalingo added
→ 'git push scalingo master' to deploy your app
$ scalingo --app my-app addons-add mongodb mongo-sandbox
-----> Addon mongodb has been provisionned
ID: my-app-7247
Modified variables: [MONGO_URL SCALINGO_MONGO_URL]
Message from addon provider: Database successfully created
Deploy your application!
$ git push scalingo master
Access your application
…
Waiting for your application to boot...
<-- https://my-app.osc-fr1.scalingo.io -->
Now you can have fun with meteor and all its real-time feature. Of course, we support WebSocket!
Additional steps
Setup of MAIL_URL
Meteor is automatically reading the address of the email server it will send
emails from the environment variable MAIL_URL
. The URL has the following
structure:
smtp://user:password@host:port
To add the environment variable, run the following command or add it through your dashboard.
scalingo env-set MAIL_URL=<smtp_url>
More information in the official Meteor documentation.
Snippet to send an email with Meteor
recipient = "user@example.com"
Email.send({
from: process.env.EMAIL_FROM,
to: recipient,
subject: "Test email to " + recipient,
text: "Hello " + recipient + "\n\nThis is a simple test email\n"
});
Automatically Meteor will use the MAIL_URL
server address and send the email.
Use of an external SMTP server
Scalingo is not an email server provider, as this is an entirely other job we encourage you to use services specialized into that. Here is a list containing a few actors on the market of email as a service:
This list is not exclusive, but all of them will work perfectly with Scalingo.
In each case, create an account, register a new sending domain and sending
address and build the MAIL_URL
from the credentials given by the provider.