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.
Related
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
I'm occasionally getting "Bad Request" in the Azure Console (located in the main 'blade' of the Azure web app). One example is when running npm install grunt-sass but there were several other times with different commands, all of which are valid commands that should execute immediately with no errors.
I think this is a bug in Azure. I haven't seen the problem when using the Kudu Diagnostic Console.
Why is this happening?
On my side, it looks like depends on the npm version in the Azure Web Apps sanbox. I upgrade the npm version to 4.2.0, and successfully installed grunt-sass both via Kudu Conosole, or App Service Editor's Console Tool.
Please navigate to Application settings blade of your Azure Web Apps, and add the WEBSITE_NPM_DEFAULT_VERSION configuration in App settings section:
Then, it should work as expected.
In Kudu Console:
In App Service Editor:
At last, we recommend you can leverage custom deployment of Azure Web Apps, you can configure your dependencies in package.json, and deploy to Azure via Git, the deployment task will install the dependencies automatically, you can refer to Custom startup command for Node.js app on Azure with Babel 6 for the similar steps.
I found that if you're having a "Bad Request" error while running the npm install command in Azure App Service's Console, the npm process is still running in the background and it will complete.
That means that you should not try to run npm i again until it completes. You can monitor the progress via FTP - when the .staging folder in node_modules is empty, that means installation is complete.
I am fairly new to NodeJS development. I have no issues whatsoever running commands on my local machine. For instance, say I want to install a package called "formidable" on my Node server, I'd run the command 'npm install formidable'. If I have deployed my NodeJS application to Azure, how would I run the same command?
NB - I do not want to manually run the command on my local machine and then deploy to Azure. This will take far too long, since I have to install many packages each with many files in them.
Please advise on how I go about doing this?
Thanks
Beside login KUDU console site and run command in online cmdlet. You also can configure dependencies in package.json, then you deploy your nodejs application to Azure via GIT, it will automatically install the dependencies in this file.
For example:
You add the formidable module in dependencies:
Then deploy it application on Azure Web Apps, you can see the remoting deployment logs in cmdlet that the module was added in the application on Azure, e.g.:
You can refer to Create a Node.js web app in Azure App Service for how to create a nodejs application and deploy via GIT.
If you are running an Azure Web App you can use Kudu Services.
To do this
browse to http://yoursitename.scm.azurewebsites.net
It will ask you to authenticate if you have not already
Click on Debug Console -> CMD
You can run your npm commands from there.
Screen shot below
More information can be found here: https://github.com/projectkudu/kudu/wiki
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.
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.