Search This Blog

Wednesday, 15 April 2015

Deploying a simple Meteor Application To IBM Bluemix

In this post I show what is necessary to deploy a simple Meteor application to IBM Bluemix public instance. In this example we already have a simple Meteor application we have tested and verified using "meteor" itself , running on localhost at port 3000.

1. Lets remove the local DB files, be careful as this will remove the local DB so you should do this when your ready to deploy to Bluemix only.

pas@pass-mbp:~/ibm/software/meteor/myfirst_app$ meteor reset
Project reset.


2. Create a manifest.yml file for the deployed application, the ENV variable ROOT_URL is required and also a buildpack which supports Meteor runtime is being pushed with the application.

applications:
 - name: pas-meteor-firstapp
   memory: 256M
   instances: 1
   path: .
   host: pas-meteor-firstapp
   domain: mybluemix.net
   buildpack: https://github.com/jordansissel/heroku-buildpack-meteor.git
env:
   ROOT_URL: http://pas-meteor-firstapp.mybluemix.net/


3. Push the application as shown below.

pas@pass-mbp:~/ibm/software/meteor/myfirst_app$ cf push -f manifest.yml
Using manifest file manifest.yml

Creating app pas-meteor-firstapp in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
OK

Using route pas-meteor-firstapp.mybluemix.net
Binding pas-meteor-firstapp.mybluemix.net to pas-meteor-firstapp...
OK

Uploading pas-meteor-firstapp...
Uploading app files from: .
Uploading 3.7K, 11 files
Done uploading
OK

Starting app pas-meteor-firstapp in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
-----> Downloaded app package (4.0K)
Cloning into '/tmp/buildpacks/heroku-buildpack-meteor'...

-----> Moving app source into a subdirectory
       Node engine:         0.10.36
       Npm engine:          unspecified
       Start mechanism:     none
       node_modules source: none
       node_modules cached: false
       NPM_CONFIG_PRODUCTION=true
       NODE_MODULES_CACHE=true
       PRO TIP: Use 'npm init' and 'npm install --save' to define dependencies
       See https://devcenter.heroku.com/articles/nodejs-support
       PRO TIP: Include a Procfile, package.json start script, or server.js file to start your app
       See https://devcenter.heroku.com/articles/nodejs-support#runtime-behavior
-----> Installing binaries
       Downloading and installing node 0.10.36...
-----> Building dependencies
       Skipping dependencies (no source for node_modules)
-----> Checking startup method
-----> Finalizing build
       Creating runtime environment
       Exporting binary paths
       Cleaning up build artifacts
       Build successful!
       /tmp/staged/app
       └── (empty)
-----> Fetching Meteor 1.0.3.2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 72.4M  100 72.4M    0     0  14.3M      0  0:00:05  0:00:05 --:--:-- 15.6M
-----> Unpacking Meteor 1.0.3.2
       Meteor 1.0.3.2 is installed
-----> Building Meteor App Bundle
-----> Installing App's NPM Dependencies
       npm WARN package.json meteor-dev-bundle@0.0.0 No description
       npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
       npm WARN package.json meteor-dev-bundle@0.0.0 No README data
       > fibers@1.0.1 install /tmp/staged/app/build/bundle/programs/server/node_modules/fibers
       `linux-x64-v8-3.14` exists; testing
       Binary is fine; exiting
       underscore@1.5.2 node_modules/underscore
       semver@4.1.0 node_modules/semver
       eachline@2.3.3 node_modules/eachline
       └── type-of@2.0.1
       chalk@0.5.1 node_modules/chalk
       ├── ansi-styles@1.1.0
       ├── escape-string-regexp@1.0.3
       ├── supports-color@0.2.0
       ├── has-ansi@0.1.0 (ansi-regex@0.2.1)
       └── strip-ansi@0.3.0 (ansi-regex@0.2.1)
       source-map-support@0.2.8 node_modules/source-map-support
       └── source-map@0.1.32 (amdefine@0.1.0)
-----> Uploading droplet (82M)

0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running

App started


OK

App pas-meteor-firstapp was started using this command `node build/bundle/main.js`

Showing health and status for app pas-meteor-firstapp in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
OK

requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: pas-meteor-firstapp.mybluemix.net
last uploaded: Wed Apr 15 05:13:01 +0000 2015

     state     since                    cpu    memory           disk           details
#0   running   2015-04-15 03:18:18 PM   0.1%   149.2M of 256M   351.1M of 1G


4. Verify application is running

pas@pass-mbp:~/ibm/software/meteor/myfirst_app$ cf app pas-meteor-firstapp
Showing health and status for app pas-meteor-firstapp in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
OK

requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: pas-meteor-firstapp.mybluemix.net
last uploaded: Wed Apr 15 05:13:01 +0000 2015

     state     since                    cpu    memory           disk           details
#0   running   2015-04-15 03:18:18 PM   0.0%   149.2M of 256M   351.1M of 1G


5. Access as shown below.

http://pas-meteor-firstapp.mybluemix.net/


Finally if you need to use a data store which most applications will then you need to define an ENV variable for your MongoDB store as shown below. In this example below I am using a service in the Bluemix catalog for MongoDB itself and

   MONGO_URL: mongodb://zzzzzzzzz:yyyyyyyyyyy


More Information

https://www.meteor.com/install

No comments: