Giter VIP home page Giter VIP logo

Comments (4)

santiq avatar santiq commented on May 22, 2024 2

Honestly I don’t know, never used azure.
But I can provide instructions for aws elastic beanstalk, aws ec2, heroku, now.sh, or digital ocean.

from bulletproof-nodejs.

ashwin-i2sts avatar ashwin-i2sts commented on May 22, 2024 1

from bulletproof-nodejs.

santiq avatar santiq commented on May 22, 2024

Hey, Sorry I didn't see the notification.

So let's start with the most simple one, Heroku which is what I'd recommend if you are hosting an app with little load, ideally when you are starting out. Just keep it simple and don't waste your time with hosting node.js apps since moving from Heroku to AWS is fairly simple and straightforward with the right instructions.

Basically you have to create a Procfile (that exact name, without file extension, in the project root) with the command for starting your application, for example for this repo would be:

web: npm run start

But also, since we are using typescript, we need first a step that transpiles it to javascript
Heroku has a "hook" or a step that we can use to our advantage. Just put this on your package.json

    "build": "tsc && nuxt build",
    "heroku-postbuild": "npm run build",

Now that we have the codebase ready for deployments to Heroku, the next would be to create a Heroku account and a Heroku app. You can look that up in google.

But what's important here is to understand how Heroku works, they basically expose a Git server. So you add a new "remote" for your codebase and push your changes there.

git remote add heroku https://your-url-of-hero/whatever.git

Then to deploy changes

git push heroku master # notice 'heroku' is the name of the remote and 'master' the name of the branch.

For now.sh the process is almost identical, they are like a cheaper alternative to Heroku and use Procfile as well.

from bulletproof-nodejs.

santiq avatar santiq commented on May 22, 2024

As for AWS EC2 and Digital Ocean

When you create an instance in EC2 you are purchasing a complete O.S, and you have to take care of it, that means setup log rotation, install Nginx, setup port forwarding, and so on.

To deploy something there, you can SSH into the machine IP (look for that in AWS EC2 console) and clone your repo, install dependencies, and spin up the server.
Later you can automatize this process with a Bash script.
It is a great way to hosting your app, you have full control of everything as opposed to what Heroku or now.sh offers.

But this is the reason I prefer to use AWS Elastic Beanstalk

EB is a "High Level" service that glues together 5-6 different AWS services.

With a few clicks, you can have your app running in EC2 with multiple instances to reach High Availability, different types of load balancers and automatic scaling (through EC2 Auto Scaling Groups) and with free SSL certificates (AWS Certificate Manager) and your own domain (AWS Route 53), lastly, Cloud Watch is also added so you can see logs of your instances without login into them

It may seem like I'm promoting AWS but is not, I hate them as much as I love them, and I only recommend them when you are dealing with a production environment.

from bulletproof-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.