Upload
miro-radenovic
View
728
Download
3
Embed Size (px)
DESCRIPTION
deploy your meteor online foro production usage. Speak took at the first meteor day (2014) in Turin, Italy
Citation preview
Deploy Meteor in [email protected]
.
Who is Miro?
• Dev4Side srl - Milano (12 emp)
• 10years of .NET (asp.net)
• 8months with server-side JS
Why meteor
• Fullstack JS
• $11.2 million in funding
• Mongodb
• Reactive
So, you wanna see your meteor project online?
• Deploy – meteor deploy (core)– meteor build (core)– Demeteorizer (from modulus)– MUP (arunoda)
• Host– on meteor.com – on Modulus– Own infrastructure
• Solutions, tuning and tips
meteor deploy
Meteor deploy
Client
[Meteor]
Server
meteor.com
$ meteor deploy myapp.meteor.com• Part of the core• Running on Meteor's infrastructure• The easiest way to deploy your application is to use meteor • Your application is now available at myapp.meteor.com
Meteor deploy
• Galaxy (from trello)
This is MDG's commercial product -- a managed cloud platform for deploying Meteor apps. You have control of the underlying hardware (you own the servers or the EC2 instances, and Galaxy manages them for you).
General Availability for Galaxy will be sometime after 1.0, since we want to focus on Meteor 1.0 and get it out as quickly as possible.
meteor build(meteor bundle)
Meteor build
Client
[Meteor]
Server
[Node.js + deps]
$ meteor build my_directory• Part of the meteor core• Running on your own infrastructure• Generates a fully-contained Node.js application in the form of a tarball
(bundle). • Used also for generating mobile versions (android/ios)• Starts the app with: node main.js• Still not documented in docs.meteor.com
Meteor build – still some deps are missing...
• But if you’ve used a binary npm module, you need to re-install it manually. Just like you are doing it with fibers.
• Actually things are changing from version >0.9
But If you are using demeteorizer, then there is no problem.
demeteorizer
demeteorizer
• Installs via NPM
• Demeteorizer's output is similar to meteor build except that it generates a package.json containing all required dependencies. This allows you to easily run npm install on the destination server, which is especially important for compiled modules.
• Adds package.json
• Installs with npm install -g demeteorizer
demeteorizer
Client
[Meteor]
Server
[Node.js]
$ meteor build my_directory• Running on your own infrastructure• Generates a fully-contained Node.js application in the form of a tarball
(bundle)• Starts the app with: node main.js
Demeteorizer – modulus
• Opensourced by Modulus
• Modulus is a PaaS that officially support Meteor
• Intregrated into CLI moduls deploy
Modulus – how it works
BALANCER
servo1
servo2
servo3
http req
MUPProduction Quality Meteor
Deployments
MUP
Client
[Meteor]
Server
[ubuntu/debian
opensolaris]
• Installs via NPM• Developed by Arunoda• Single command server setup• Single command deployment• Autostarts app (upstart and forever)• Access, logs from the terminal (supports log tailing)• Support for multiple meteor deployments
Mup – why is cool
• Deploys on AWS EC2
• Rebuilds platform dependent NPM modules
• Uses JSON for muliple deployment paths (can manipulate them via gruntjs)
• Supports meteor.settings
• Env vars are in json
How I launched my project on line
• problem– We want to serve many users, from everyware
– We want to scale easy
– Backgrounds and heavy loads are moved outside meteor.
• solution– Platform: AWS + compose.io
– Deployment: gruntjs + mup
AWS + Compose configuration
HA PROXY
EC2ubuntu
EC2ubuntu
EC2ubuntu
CLOUDFRONTCDN
S3Static assets
Meteor callsmongoDb
OpLog Enabled
tips
• Use MongoDb with OpLog
– Compose is a good start
• Don’t serve static content via nodejs
• Use balancer that supports
– Sticky session when websockets not work.
– Leastconn algorithm
– Client timeouts > 30 sec
Haproxy.confdefaultsmode httptimeout connect 60stimeout server 60stimeout client 60stimeout check 5s
frontend public#binding port 80bind *:80default_backend apps
backend apps#load balancing algorithmbalance leastconn
#using JSESSIONID as the cookiecookie JSESSIONID insert nocache
#adding serverserver host1 host1.example.com cookie host1server host2 host2.example.com cookie host2server host3 host3.example.com cookie host3
#Link: https://meteorhacks.com/how-to-scale-meteor.html
deployment
• Use Gruntjs for your deployment steps
– Create a .deploy folder in your meteor proj
– Run tests, before deployment
– Compile Scss to css
– Upload statics to CDN (S3)
– Add private local npm modules
– Edit MUP json conf files before deploying
• And finally, use mup for the upload
deployment
..and make sure your deployments to Test and Production enviroments requires minimum manual operations...