Deploying nodejs to amazon - node.js

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 ...

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)

Docker development workflow with node.js

I'm trying to use docker with a node.js web app i'm working on.
I have familiarized myself with the docker concepts and gotten up and running with the example here: https://docs.docker.com/examples/nodejs_web_app/
I get the general process...write a Dockerfile -> Build a docker image -> run it in a VM.
However, it seems impractical to rebuild the image and restart the container every time I change a file.
I currently have a gulp / live-reload setup that works great for development so I was wondering if there was any recommended way of accomplishing something like this with docker.
Thanks!
You can mount the source directory in the container as a volume and use the same gulp/livereload setup that you currently use now. Here's an example project with this setup. If you run into port issues with livereload see here.

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.

How to use simple npm-install in Openshift?

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.

Running an open-source project on heroku

I am trying to run HabitRPG on Heroku because I don't have root access in the machines in my school's library to install the dependencies.
The wiki to HabitRPG gives instructions on how to run it on a localmachine, but does not talk about running it on Heroku. I understand that HabitRPG used to run on Heroku, but lefnire had to move it.
What am I facing here? How much work am I looking at to run on Heroku? Have they not given instructions to deploy it because they don't want people to? Any help would be appreciated.

Resources