Deployment on openshift

Is it possible to deploy meteor 1.1 on openshift ?
I tried the options described in the links below, but failed on both

http://www.tutas-labs.com/deploying-meteor-applications-to-openshift-paas/

Created a new repo based on a few others for easier deployment to openshift.

If anyone else also looking to deploy please give it a shot and share your experience.

Not sure if Openshiftā€™s auto-scaling can be used with meteor, would appreciate any experience or inputs in this regard.

Cheers
Sach!n

I was actually able to deploy a Meteor test app following that Tutas tutorial. I was also able to deploy using your quickstart as well. I like your method better than the Tutas one.

The only thing I havenā€™t been able to get working is setting the METEOR_SETTINGS env variable. I set it using the rhc env-set command, but I still get an error regarding the Slack API when I look at my app in a browser. Is there a better way to using different Meteor settings?

Hi I am not able to deploy using sachinā€™s way.

ā€œgit pull -s recursive -X theirs upstream masterā€

Error:

fatal: unable to connect to github.com:
github.com[0: 192.30.252.121]: errno= No error

So I took the code directly from repo and deployed. Nodejs is in my app now successfully but I am not able to deploy my meteor app.

I did the build got the tar and added in mylocalnodeapp folder but I am not able to see my meteor app running and I donā€™t see any errors. Please let me know if i am doing anything wrong and I am not sure about the updating env variables in meteorshim.js . I am using local mongodb within app. Isnā€™t it similar to deploying to meteor servers earlier without any of these configs?

Please help. Thanks

@sach @wuworkshop

I have used this repo to deploy a Meteor 1.3 app to openshift successfully, try it out, maybe it can help you

also, I have to mention that instead of

git remote add meteor-openshift -m master git@github.com:jeeeyul/meteor-openshift.git

i used

git remote add meteor-openshift -m master https://github.com/jeeeyul/meteor-openshift.git

Also just in case you are trying to use a private domain, this is not possible if you use websockets, since openshift doesnā€™t use your private ssl certificate for websockets, so you can only use the rhcloud domain link (and you have to change the Default DDP port to 8443)

1 Like

Hi Toni,

Thanks for sharing this :slight_smile: . I deployed my app partially i guess. I canā€™t see it running properly I think it is because of mongodb issue. Can u please let me know how to configure mongo? I tried to connect to mongo from putty that didnt work too but i see it running on my app.

TIA.

If you have installed the mongodb cartridge like the instructions, before deploying change this line in meteorshim

process.env.MONGO_URL = process.env.MONGODB_URL || ā€œPLEASE_PROVIDE_A_MONGO_URLā€;

with the proper address of a database connection uri. By default the process.env.MONGODB_URL has no database or users so you should create one to connect.

In order to create a new database, do
rhc port-forward -a yourappName -n yourNamespace(not needed if only one namespace)
you will see something like

Service Local OpenShift


mongod 127.0.0.1:27017 => xxx.yyy.zzz.www:ppp

Then you can connect to the remote database in robomongo or any other mongodb management gui tool (choose your favourite from here )with the ip 127.0.0.1 and the port 27017 in this example.

On robomongo or whatever create a new database with the name that you want (meteor for example) and then look also in the gui to create a new user on that database. Once you have both things done then you can paste
process.env.MONGO_URL = "mongodb://username:password@xxx.yyy.zzz.www:ppp/databasename" in meteorshim.js

As an alternative way If you canā€™t manage, go and create a free database at mLab repeat the same steps of creating a database and a user/password (itā€™s easier since you can do this directly from their website) and then look for this text in your webpage( after clicking on the database)

To connect using a driver via the standard MongoDB URI (whatā€™s this?):
ā€œmongodb://dbuser:dbpassword@xxxxxx.mlab.com:ppppppp/databasenameā€

copy that url to meteorshim replacing the dbuser, dbpassword, xxxxx, ppppp, database name values and voila!

1 Like

Oh yeah :smiley: I got it thanks a lot :beers:

Hi Toni,

I am facing a weird issue:

I deployed my app to Openshift but I am not able to load the desktop version. It is taking forever to load. At the same time I can access it from my phone. Not sure why? :expressionless: any idea

TIA.

Hi @tcastelli,

For the first time I deploy meteor as your approach, itā€™s succeeded, of course, with down mongoDB, my app not work correctly.
Hence, I followed your mongoDb process to create new one.
However, from that on, I always got this error from OpenShift:

remote: Waiting for application port (8080) become available ā€¦
remote: Application ā€˜appnameā€™ failed to start (port 8080 not available)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 576a23da0c1e66eae6000019 (Error activating gear: CLIENT_ERROR: Failed to execute: ā€˜control startā€™ for /var/lib/openshift/576a23da0c1e66eae6000019/nodejs
remote: #IO:0x0000000065f298
remote: #IO:0x0000000065f220
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed

Even I delete everything, start from beginning: add mongoDB url before I run git push, still got those error and fail to deploy.
What could I done wrong?

Im actually using an external db mongo_url from mLab so not sure of what could be wrong. Have you tried using a free database from mLab for example?

Also if you bring more details about the error maybe we can see what is happening,
try with
rhc tail "-n 100" and copy the results of the errors, maybe thereā€™s valuable information of what is going wrong

Your command not work.
However, I maintain to start from fresh again and using external mongoDB (from mLab). My app start (as the first time) and mongoDB not a problem anymore.
From browser console log, I got this error:

Error: [ng:areq] Argument ā€˜InboxCtrlā€™ is not a function, got undefined

Yet, Iā€™m using Angular-Meteor app. Maybe Itā€™d be my problem now, not sure how to survive this.

From your method, I still saw local mongoDB running on server, because I add mongo_url from another site, no need the local anymore, right? I thought I should shut it down, you know, donā€™t want to waste my free server quota. How can I do that?

Thanks @tcastelli.

sorry forgot to tell that you that you must set the application name and domain if you have more than one so it will be
rhc tail "-n 100" -a appName -n domainName
or try without ā€œ-n 100ā€

the ng:areq is indeed something related with angular, which Iā€™m not familiar with so canā€™t help you on that.
To remove the mongo cartridge you can use the command

rhc cartridge remove -a appName -n domainName -c mongodb

Thank @tcastelli,

Iā€™ve created a new topic to ask someone else about deploy angular-meteor on openshift.
Not sure what to do next.

thank you for the great forum thread you guys have createdā€¦ I do not why connection to mongod has refused.
I started using the mongodb catridge but failed , then i also tried the mlab database it also failed to connect.
These are url iam using.
To connect using a driver via the standard MongoDB URI on mlab.
mongodb://:@ds151228.mlab.com:51228/kazi
in the meteorshim.js file iam using the following connection code.

process.env.MONGO_URL =  process.env.MONGODB_URL || "mongodb://user1:123?@ds151228.mlab.com:51228/kazi";

At first i also tried using the mongodb catridge on openshift using this connection string.

process.env.MONGO_URL = process.env.MONGODB_URL || "mongodb://admin:12345iop@http://localhost:27017/hello";

But have trying all these connection url, iam just getting the same errorā€¦

remote: js-bson: Failed to load c++ bson extension, using pure JS version
remote: 
remote: /var/lib/openshift/587407407628e1ca850000cb/app-root/runtime/repo/programs/server/node_modules/fibers/future.js:278
remote:                         throw(ex);
remote:                               ^
remote: Error: failed to connect to [goldsoft:NaN]
remote:     at Object.Future.wait (/var/lib/openshift/587407407628e1ca850000cb/app-root/runtime/repo/programs/server/node_modules/fibers/future.js:398:15)
remote:     at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
remote:     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
remote:     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
remote:     at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
remote:     at new Mongo.Collection (packages/mongo/collection.js:102:1)
remote:     at Package (packages/idmontie_migrations/migrations.js:23:1)
remote:     at /var/lib/openshift/587407407628e1ca850000cb/app-root/runtime/repo/programs/server/packages/idmontie_migrations.js:254:4
remote:     at /var/lib/openshift/587407407628e1ca850000cb/app-root/runtime/repo/programs/server/packages/idmontie_migrations.js:261:3
remote:     at /var/lib/openshift/587407407628e1ca850000cb/app-root/runtime/repo/programs/server/boot.js:242:10
remote:     - - - - -
remote:     at [object Object].<anonymous> (/var/lib/openshift/587407407628e1ca850000cb/app-root/runtime/repo/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)


Thanx in advance

What version of Meteor are you trying to deploy? I havenā€™t tested with 1.4.x , but since you need support for Node4 , I guess the default github repo wonā€™t work anymore. (You will have to use a custom cartdridge to support Node4)

Iam using meteor versionā€¦ METEOR@1.2.1 in this project.
Ok i will try using the custom catridge to deploy ā€¦ Thank you for your help.