How to use simple npm-install in Openshift? - node.js

I'm trying to use cute-files on my openshift account
https://www.npmjs.com/package/cute-files
I know node.js works as I did in localhost:3000 but not as expert,
I'm ended up with http://cutefiles-powerupware.rhcloud.com/ that's not I'm looking it. It should be Cute-files app as start.
I did PuTTY to access terminal to do npm-install but no luck due to permission.
The problem is... I cannot understand how openshift works, I need to know how to access console to do npm-install then, execute "$ cute-files", alternativley I've used Git to commit and push, the files are updated...I got no results... I've spent like 6 or 7 hours, Openshift has been very complicated me to use, can anyone explain how to install and execute simple node.js app in openshift?

It's not like you can access Openshift and run any command. Openshift isn't a simple hosting or vps service, it's a PaaS. That means they offer you an environment to run certain services in particular as you demand.
When you create an app it's bound to a git repository which when pushed will be deployed to openshift.
About your application being deployed and runned, it's NOT about node.js running in port 3000. Openshift has some default application file names and port to expect.
So, working in a local clone of such repository you might perform the npm install command, that will download the node_modules folder to be there.
How to do all this?
First you should install rhc in your system.
Manage to clone any of you applications via rhc.
Make changes, and do git.
Those changes may include doing npm install getting your dependencies.
When doing git push, expect the changes to be deployed.
You really should read this guide.

Related

Node and npm with FTP

I have an issue with my application(a chatbot made with Vite/Node.js). When I run the command: npm run dev in the terminal inside vscode, I can open the localhost and use the application. But when I try to upload the files to my ftp server, and then open the website to run the applicaton, it does not work. I have looked for hours, and found out that the reason for this issue, is that my ftp server, does not have node.js and npm installed. So I guess my question is. How do I install node.js and npm on my ftp server, so that I am able to run this "npm run dev" command on the server? Btw, I am a beginner developer, with under 1 year of experience.
This is a pretty board question. But as you have discovered you can not use node on websites that are statically hosted. You can only use javascript, CSS, and HTML.
If you want to have a server, node running with a framework like express, then you need to host the server. But that is a giant topic, you could google it; there are many ways to host a back end service that is running node. (for instance an EC2 container on AWS)

How to access Bluemix application's runtime shell as root?

I have a Nodejs application running in Bluemix. I try to run a command to install dependencies in Nodejs application container. I accessed it using application's runtime SSH. I need root privileges to install dependencies. It is asking me password for sudo command. How can i get that password?
You shouldn't be installing dependencies this way. The ssh terminal is intended for debugging purposes only:
If you need to troubleshoot an instance of an app, you can gain SSH
access to the app using the SSH proxy and daemon.
For example, one of your app instances may be unresponsive, or the log
output from the app may be inconsistent or incomplete. You can SSH
into the individual VM that runs the problem instance to troubleshoot.
Source: https://docs.cloudfoundry.org/devguide/deploy-apps/app-ssh-overview.html
NodeJS dependencies can be installed by adding a package.json file:
Cloud Foundry expects a package.json in your Node.js app. You can
specify the version of Node.js you want to use in the engine node of
your package.json file.
In general, Cloud Foundry supports the two most recent versions of
Node.js. See the GitHub Node.js buildpack page for current
information.
Source: https://docs.cloudfoundry.org/buildpacks/node/node-tips.html

Deploying nodejs to amazon

I'm new with NodeJS and have worked lately with a project which run in NodeJS. This project is actually going to be put online. The server runs on Amazon and is now running an "old" version of the project.
I've had a very fast manual how to deploy, but I didn't get it.
What I got:
Install cygwin (already did)
tar the project without the .git directory in cygwin
Upload the tar to the server in cygwin
Restart the application
Does anyone know a good tutorial or can someone explain to me how I do best? I know that there is no auto deployment.
I recently setup a nodejs application on AWS, the tools that i used was
nginx server for handling my http request, as starting nodejs in terminal is very problematic.
pm2 for auto restarting nodejs in case if error occur
git for version control, maintained a repo of my code and clone it to my AWS server
SSH for remote login
Hope this helps :)
I'm actually in the same process of deploying a node server via amazon aws. I personally started with watching some Videos to get a clue about AWS EC2, S3 and so on. The following link is a good start for understand some conecpts:
https://www.youtube.com/watch?v=jLVPqoV4YjU
afterwards it is best to read the documentation (better not all of it just the things you need and want to understand).
I also use pm2, git and maybe will use nginx also as reverse proxy ...

How to deploy a socket.io from nodejs on Tomcat

Here's the thing, I have a folder, using Nodejs and socket.io(it's a chat) and I also have a server running Tomcat 8. I have worked with .war and .ear files before in Tomcat, but I'm new in this nodejs deployment thing.
Do you guys have like a tutorial or can you explain me how can I like package my app and then deploy it, or upload the folder, I don't know, something.
You don't need tomcat to run your node.js application. Just be sure node is installed on your server and the port you are using is allowed on your server's firewall and you are good to go. (Don't forget to install your npm packages through your packages.json of course)
Usually a node.js app is run like below;
node server.js
And that's all. If you'd like to keep it alive or restart in any case of issue you can use forever (https://www.npmjs.com/package/forever)
If you want to load balance with reverse proxy or if you want to configure ssl etc. you can use nginx or haproxy etc.
If you want to automate your deployment you can create a hook to your git source (github, bitbucket etc.) and write down a script to stop / start your node processes, fetch modified files, install npm packages etc.

Deploy sails.js to Windows Azure Website

I'm following this guide on installing a node.js application on Azure:
http://www.windowsazure.com/en-us/develop/nodejs/tutorials/create-a-website-(mac)/#header-0
Is it possible to get a sails.js app running without having to instantiate a Virtual Machine?
New guide on deploying to Windows Azure:
https://github.com/mdrmuhaimin/sails-docs/blob/b1030c21daf885e6490e1d1f946375a5c8584e4c/Guide:Deploying-Sails-to-windows-azure-linux-vm.md
Also, as I mentioned in the comment above, you don't have to install Sails globally to deploy it-- just clone your app, run npm install, and then forever start app.js or node app.js. See the deployment guide for more info.
As of right now sails requires an npm install -g on the box which would require either a virtual machine or a cloud service with a startup script. The link you are showing if for a deployment model where you don't get any access to manipulate the host since there are many instances running on it.
It would be great if sails could be included inside an app by putting it in the package.json and started up from within the app.
UPDATE - This has changed since the answer was posted. #mikermcneil has an updated answer that reflects the current state.

Resources