Comments (4)
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.
from bulletproof-nodejs.
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.
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)
- How to implement the swagger following this structure? HOT 2
- Email client replacement HOT 1
- Implementation with Mysql/pgsql with typescript HOT 3
- examples for creating new models in mongo HOT 1
- Project structure by feature HOT 2
- add absolute imports? HOT 1
- Where do you add utility functions and constants? HOT 1
- Absolute import "Cannot find module @/*" HOT 5
- Jwt invalid algorithm HOT 2
- Recreate code to be compatible with all os development environment
- Changing a request would require changes in 3 places of the code, is there a better solution? HOT 1
- api status handling
- Better testing project structure/ configuration? HOT 1
- Using a different database for tests HOT 1
- Where store Push Notification Token?
- Refactoring Sub/Pub Layer Poll HOT 1
- Is there same or similar example in js? HOT 1
- Redis client HOT 2
- adapt for mySQL HOT 2
- Update Mongoose for Heroku Deployment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bulletproof-nodejs.