Deploying Sails App on Openshift - node.js

Can any one help me with deploying a SailsJS app on Openshift?
I followed How you get Sail.js running on Openshift
After making my changes and pushing it to the repo I get the status as successful but when I go to my link it says
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.2.15 (Red Hat) Server at kittylogintest-kittygame.rhcloud.com Port 80

I finally managed to deploy my sails application on openshift
Most of the steps mentioned in the link mentioned in my question will help
After following the steps i was getting an error stating permission denied for grunt-cli
I solved it by SSHing in to my app and then doing the npm install in app-root/runtime/repo
Hope this helps if some one stumbles on the same stair.

Related

AWS EC2 instance is working but can't connect to it via browser

I have a nodejs app running on an EC2 instance. I installed the webapp using Ubuntu server 18.04 and node version v16.x using this link:
Node installation guide v16.x
To run the project I used the following tutorial: Tutorial link
The problem I am facing is that when I run the starting command npm start my app launches on the server using port 3000. But whenever I open the link provided from AWS which in my case is : https://ec2-3-72-79-132.eu-central-1.compute.amazonaws.com it doesn't respond. I saw some similar questions and most common answers were to edit the inbound security groups which I did.
But it still doesn't work. I also tried to access the link with http only like this:
http://ec2-3-72-79-132.eu-central-1.compute.amazonaws.com:3000 but it still doesn't work. Any help will be highly appreciated, because I spent 2 days struggling with this issue and I see that I don't make any progress.

Nodejs and Meteor on OpenShift

I have a mobile (Ionic 2) chat application with the following implementation, that uses nodejs-0.10 and MongoDB 3.2.7 and Meteor 1.4.1.1. It works perfectly on my localhost.
Now I need to deploy it to an OpenShift server. I have followed the following steps and created a server on OpenShift with Meteor. It is connecting with Git, and I can push my code to the server.
I am pretty sure the Meteor server is running on OpenShift, because I saw something to that effect on the startup logs (via ssh). However, I am not sure how to connect to the Meteor server to test it.
The domain is nodejs-easyjobs.rhcloud.com (54.208.77.250) on the OpenShift server, I can ping this successfully.
I am using Ionic 2 to build the mobile app. I am currently just running on Android, but plan to add iOS and Windows.
I am following this tutorial, and it runs on localhost. However, I am not sure where this is configured. I guess localhost is default, and you need to change it to a different host if needs be.
If I check my OpenShift server (nodejs-easyjobs.rhcloud.com) via ssh, I can see that the contents of the Meteor bundle directory is on the server. So Git is pushing the code.
The part I don't understand is:
Do I need to configure Meteor differently for being on the OpenShift
Server? Or do I just leave it as is?
Where do I configure the client
(Ionic 2) to point to the OpenShift server?
Question:
My question is, how do I configure my mobile app (Ionic 2) to connect to the OpenShift Meteor Server?
UPDATE:
My dir structure:
openshift-appname
.../ionic-apps/nodejs/bundle/server/...
meteorapp
.../ionic-aps/myIonicApp/api/.meteor/...
.../ionic-aps/myIonicApp/api/server/...
The contents of the .../ionic-apps/nodejs is cloned on the OpenShift server with Git.
I followed this tutorial to deploy the Meteor bundle to OpenShift. `
So I used the following to build my Meteor app:
> cd .../ionic-aps/myIonicApp/
> meteor build .../ionic-apps/nodejs --directory --server-only
As far as I can see, I may be wrong, but the Meteor Server is all correct and running on OpenShift. I need to know how I can get my Ionic2 app to access it.
Step1: Find the access point to the Meteor server using the OpenShift
IP. i.e. nodejs-easyjobs.rhcloud.com (54.208.77.250).
Step2: Configure my Ionic2 client to use this.

Meteor deploy on Heroku Error deploying Node

I built a Meteor app, and it runs on my local machine, where I have meteor installed.
I have never deployed an app online, and am trying to put the app on heroku.
I first tried to use buildpack/jordansissel/heroku-buildpack-meteor.git, but I got an error "Meteor requires Node v0.10.41 or later"
I then tried to use buildpack/michaltakac/meteor-buildpack-horse.git but it failed to push because it couldn't unpack Node.
Lastly I've tried kevinseguin/heroku-buildpack-meteor.git but I get lots of warnings about npm depricated http://prntscr.com/bewzak
When I look at the logs it says "Slug compilation failed: failed to compile Node.js app"
I also get Error: MONGO_URL must be set in environment
I don't know enough to understand what the errors are, or how to get my app deployed
Image of errors: http://prntscr.com/bex0av
my goal it to get the site on gr-fireworks.herokuapp.com
I contacted Heroku helpdesk and they said they couldn't help me because the issue was outside the scope of Heroku Support.
I tried to reach out to Snap CI who said they were successful in deploying it, but when I try to type in exactly what they did, I am still getting the error about Node https://snap-ci.com/ankitsri11/Fireworks/branch/master/logs/defaultPipeline/1/Heroku?back_to=build_history
My repository I'm trying to deloy is on git at github.com/jschwarzwalder/Fireworks
From description of your problem I can conclude you need to do 2 things on your app's Heroku dashboard (Settings tab):
Add MONGO_URL environment variable that points to your Mongo DB database. You can create mongo instance on external service or use mLab Heroku addon (it has free plan).
So your environment variables may look like:
Also, you may need to add METER_SETTINGS if you use --settings settings.json and ROOT_URL - URL of you app gr-fireworks.herokuapp.com (is required).
Set this buildpack:
Ensure you have .git at the end of url.
Now you can deploy your app using single command (if you setup Heroku Toolbelt and heroku remote points Heroku's app repository):
$ git push heroku master

Openshift Layer4 connection, App Won't Start

I recently pushed a set of node.js changes to an app on Openshift. The app runs fine on my local machine and is pretty close to the vanilla example deployed by Openshift. The Openshift haproxy log has this final line:
[fbaradar-hydrasale.rhcloud.com logs]> [WARNING] 169/002631 (93881) :
Server express/local-gear is DOWN, reason: Layer4 connection problem,
info: "Connection refused", check duration: 0ms. 0 active and 0 backup
servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
The nodejs.log has this final line and no error mesages before this line: DEBUG: Program node server.js exited with code 8
I have searched high and low and can't seem to find anyone with a similar problem or hints at how to resolve this issue. Obviously, the above result in a 503 Service Unavailable when trying to access the app over the web.
Looking at the question I think it is happening because you don't have any routes configured at root '/'. OpenShift uses HAProxy as a load balancer in scalable applications. HAProxy is configured to ping root '/' url for health checks to determine whether your application is up or down. In your application, you have not configured anything at the root url so when HAProxy pings '/' it gets 503, hence your application behaves like this. There are two ways you can fix this problem
Create an index.html and push it to OpenShift application
The better solution is to configure HAProxy configuration file. SSH into the main gear using rhc ssh --app command, then change directory to haproxy/conf, and then update option httpchk GET / to option httpchk GET /valid_location, and finally restart the HAProxy using rhc cartridge-restart --cartridge haproxy. You can check the status of your gears by going to http://myapp-myusername.rhcloud.com/haproxy-status.
Hope this will help you.
Thanks for the response! However, I just discovered what the issue was by rolling back and making one change at a time. There was a buried npm dependency down in a subfile. This dependency had not been added to the package.json file and Openshift was failing to rebuild node appropriately. Once the dependency was added everything started to run again. The log errors were a bit of a red herring and simply a side effect of not having a good application to start!

Openshift NodeJS App 404 Not Found

I am creating my first node application on OpenShift.
I created an app with node 0.10 and MongoDb 2.4 but whenever I go to the application URL ,http://cm-justinbezanson3.rhcloud.com, it redirects to https://cm-justinbezanson3.rhcloud.com/app and says 404 Not Found.
I am sure I am missing a step somewhere.
If you still having this problem, you can follow this tutorial to deploy nodejs on openshift.
https://www.youtube.com/playlist?list=PLcdTDBNC_bSj1GG0_-K6R5_UgV9E3jBPZ

Resources