Search This Blog

Monday, 20 April 2015

A Meteor buildpack for Bluemix to simplify the deployment

I previously blogged about deploying a Meteor application to Bluemix as follows

http://theblasfrompas.blogspot.com.au/2015/04/deploying-simple-meteor-application-to.html

The following Buildpack created by an Internal IBM employee streamlines the process of deployment and avoids the need for ENV variables with the pushed application, here;s how. It's also detailed in the GitHub buildpack URL below.

https://github.com/bancha001/bluemix-buildpack-meteor

1. Create .cfignore to exclude the path 'local' to be uploaded

pas@pass-mbp:~/ibm/software/meteor/simple-todos$ cat .cfignore
.meteor/local


2. Create a manifest.yml which includes an existing MongoDB service as shown below.

---
applications:
- memory: 256M
  domain: mybluemix.net
  path: .
  buildpack: https://github.com/bancha001/bluemix-buildpack-meteor
  host: pas-todo
  name: pas-todo
  disk: 512M
  services:
    - todo-mongo-db
  instances: 1


3. Push the application

pas@pass-mbp:~/ibm/software/meteor/simple-todos$ cf push
Using manifest file /Users/pas/ibm/software/meteor/simple-todos/manifest.yml

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

Creating route pas-todo.mybluemix.net...
OK

Binding pas-todo.mybluemix.net to pas-todo...
OK

Uploading pas-todo...
Uploading app files from: /Users/pas/ibm/software/meteor/simple-todos
Uploading 9.5K, 12 files
Done uploading
OK
Binding service todo-mongo-db to app pas-todo in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
OK

Starting app pas-todo in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
-----> Downloaded app package (216K)
Cloning into '/tmp/buildpacks/bluemix-buildpack-meteor'...
-----> Installing Node
-----> Installing Meteor
Downloading Meteor distribution
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
######################################################################## 100.0%
Meteor 1.1.0.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
sudo: no tty present and no askpass program specified
Couldn't write the launcher script. Please either:
  (1) Run the following as root:
        cp "/home/vcap/.meteor/packages/meteor-tool/1.1.3/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
  (2) Add "$HOME/.meteor" to your path, or
  (3) Rerun this command to try again.
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
-----> Building Meteor application

FAILED
Error performing request: Get https://api.ng.bluemix.net/v2/apps/3c2b4d96-688d-4024-b039-b8153c86c5cc/instances: dial tcp 75.126.70.44:443: i/o timeout

TIP: use 'cf logs pas-todo --recent' for more information
pas@pass-mbp:~/ibm/software/meteor/simple-todos$ clear
pas@pass-mbp:~/ibm/software/meteor/simple-todos$ cf push
Using manifest file /Users/pas/ibm/software/meteor/simple-todos/manifest.yml

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

Creating route pas-todo.mybluemix.net...
OK

Binding pas-todo.mybluemix.net to pas-todo...
OK

Uploading pas-todo...
Uploading app files from: /Users/pas/ibm/software/meteor/simple-todos
Uploading 9.5K, 12 files
Done uploading
OK
Binding service todo-mongo-db to app pas-todo in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
OK

Starting app pas-todo in org pasapi@au1.ibm.com / space dev as pasapi@au1.ibm.com...
-----> Downloaded app package (216K)
Cloning into '/tmp/buildpacks/bluemix-buildpack-meteor'...
-----> Installing Node
-----> Installing Meteor
Downloading Meteor distribution
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
Dropped log message: message too long (>64K without a newline)
######################################################################## 100.0%
Meteor 1.1.0.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
sudo: no tty present and no askpass program specified
Couldn't write the launcher script. Please either:
  (1) Run the following as root:
        cp "/home/vcap/.meteor/packages/meteor-tool/1.1.3/mt-os.linux.x86_64/scripts/admin/launch-meteor" /usr/bin/meteor
  (2) Add "$HOME/.meteor" to your path, or
  (3) Rerun this command to try again.
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
-----> Building Meteor application
-----> Installing 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/.bluemix/app/programs/server/node_modules/fibers
       > node ./build.js
       `linux-x64-v8-3.14` exists; testing
       Binary is fine; exiting
       progress@1.1.8 node_modules/progress
       ip@0.3.2 node_modules/ip
       underscore@1.5.2 node_modules/underscore
       semver@2.2.1 node_modules/semver
       chalk@0.5.1 node_modules/chalk
       ├── escape-string-regexp@1.0.2
       ├── ansi-styles@1.1.0
       ├── 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.5 node_modules/source-map-support
       └── source-map@0.1.29 (amdefine@0.1.0)
       fibers@1.0.1 node_modules/fibers
-----> Building runtime environment
-----> Running extras
       MongoDB Service Binding
  #!/bin/sh
  export ROOT_URL=${ROOT_URL:-http://pas-todo.mybluemix.net}
  export MONGO_URL=${MONGO_URL:-mongodb://IbmCloud_r3baqpa6_2hft49g4_f78kb40a:Wb010LLGN9YHYbPR4DdK5JEpSvTt0GZ0@ds055200.mongolab.com:55200/IbmCloud_r3baqpa6_2hft49g4}
-----> Uploading droplet (14M)

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-todo was started using this command `.bluemix/bin/node .bluemix/app/main.js`

Showing health and status for app pas-todo 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-todo.mybluemix.net
last uploaded: Mon Apr 20 06:51:43 +0000 2015

     state     since                    cpu    memory          disk          details
#0   running   2015-04-20 04:56:09 PM   0.1%   70.6M of 256M   57.8M of 1G



No comments: