Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialbenfarnham
17,073 PointsHow would I deploy a website built on node.js? What hosting services would you recommend?
So I have been taking the 'Full Stack JavaScript' course and honestly love it. But it has left me with more questions... I eventually want to deploy a website (well more of a simple blog) that was built on express.js for node.js and add web applications down the road. First, where would I deploy said website / web app?
I always hear Heroku being mentioned but honestly I would love to learn how to actually deploy a web application. Are there any courses that teach more in depth web application deployment?
I feel like the more I learn, the more questions I have! Thanks to all of you in advance!
5 Answers
Kevin Korte
28,149 PointsHeroku is cool, and makes it great because it's so easy to deploy an app, because it does abstract so much of the heavy lifting away from the developer. The one downside to Heroku is it can get expensive fast if your app can't make enough money to pay the bill it creates. I'm not saying Heroku isn't worth it, but it the costs have to be accounted for.
If you wanted to set up, and maintain your own server, I'd recommend Digital Ocean than. It's cheap, they appear to have great support, and they're active on social media. They have a good documentation on their site too. Another good option if you're feeling really ambitious would be to use the Amazon Web Service stack. Some of the AWS services are free for the first year at the the base level.
Just some thoughts.
Cena Mayo
55,236 PointsAgree with Kevin. I'd add that although Heroku DOES have a free tier that's good for prototyping your site, I'm not sure I'd use it for anything other than quick testing. Also, if you're ultimately interested in MEAN stack development, note that Heroku doesn't natively support MongoDB - if you're using Mongo, you'll have to host it elsewhere (typically MongoLab). That's not necessarily a bad thing in itself, but it can add a layer of complexity if you're just getting started.
Linode and DigitalOcean both have really excellent documentation on setting up a web server and various related technologies. It 's worth setting aside some time (and a little cash, unless you have a spare Linux box laying around) and working through their tutorials. So while you don't need, say, Apache to run a node/express server, it's helpful to understand how servers work in general. Setting up Apache to run PHP and MySQL (LAMP stack) can be eye-opening compared with MEAN stack, and I think provides a good comparative exercise.
benfarnham
17,073 PointsOh man, I would love to follow some tutorials on that. Honestly, I just want to understand how these things work so I can launch these ideas I have.
And again, newby qeustion but.. What is a Linux Box? Haha!
Rhett Moxon
449 PointsIm assuming hes just talking about a computer running linux.
Bob Main
4,183 PointsI'm in a similar boat as Benjamin and found this discussion very informative and interesting. I'm front-end person trying to store basic data (mostly users and info).
Benjamin, did you find something that worked well for you in the last year or two?
Also, I was curious if anyone had any experiences/thoughts on using alternative severless resources like pubnub.com?
- Thanks!
David Wood
30 PointsThinking about the right node.js hosting you must answer question: what are your needs? Obviously hosting and the final price is strictly connected with an available options and parameters. There is a big choice on the market. Check out this list: https://www.netguru.co/blog/nodejs-hosting-services of 8 hosting services (free and priced). I believe that it will help you make a right decision.
benfarnham
17,073 Pointsbenfarnham
17,073 PointsSo with Digital Ocean, I would have to have my own server? Hmm... Probably best I don't go that route yet haha. Still trying to transition from being only a front end developer. I have researched Amazons Web Service and have been tempted to use it.
Thanks for your insight!
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsI guess it comes down to, do you want someone to manage the server for you, like Heroku, or do you want to manage it yourself, like Digital Ocean?
With any of the self managed options like Digital Ocean, AWS, Linode, etc, you're going to pay them to just rent an instance of a server. Depending on what you buy, you might just buy a virtual machine running on their server, meaning that one computer's hardware resources are servicing multiple virtual machines (which isn't necessarily a bad thing when a site has low resource needs), all the way up to a dedicated server, where you rent all of the server's hardware just for you).
With all of these options, they're basically going to give you SSH access to your server, and from there it's your responsibility to install what you need, configure it, maintain it, and provide any security updates for it. They're (the hosting company), are completely hands off at this level. If you're server gets hacked, or is used in a way that violates their terms and conditions, they'll just kill your server. (Long story, but at a company I worked for, this happened. The guy started everything on a unmanaged VPS (virtual private server)), and he left. Small company so nobody even knew there was going to be a problem, until our server was used to send mass amounts of emails, they killed our server. It took 3 days to get a new server online, and move all of our web files and email accounts to a new, managed VPS.
A box is often referred to as a functioning computer, often times a virtual computer. A Linux box would be a functioning computer that is running the Linux OS. By far the most common server setup. Information, configurations, etc are not shared between boxes, and a computer can have multiple boxes. If a box has a problem, gets hacked, etc, you kill the box, the problem goes away.
That's what all these web hosts are going to give you. A box to work in, that way everyone's site is protected from other users.
Out of all of the these options, AWS is by far the most advanced to set up, and keep running. You're going to want to be pretty comfortable in SysOps to run and maintain something built on that platform. It's incredibly powerful, but it's by far the most hands off, you're on your own, do everything yourself option.
I played with AWS, and quickly starting feeling I was in over my head, as I'm not a SysOps guy, and to be honest, that field of work doesn't excite me much, however I have much respect for the guys that do it.
benfarnham
17,073 Pointsbenfarnham
17,073 PointsThis was an incredible answer. Honestly, I think I will start with Heroku simply because I would like to learn how to manage my own server before I do so. I am really just looking to deploy a few small apps (like really small) but then have the option to add on to them in the future. Well... Add quite a lot on.
With Heroku, I have read a lot of articles where they needed to host images on Amazon S3. Any ideas on this? Is the integration pretty easy? (I have big ambitions haha)
I hear you on the SysOps. I don't think I would have the patience to learn something of that nature but I am so glad there are people that do.
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsYep, that's why I started this 7 months ago: https://teamtreehouse.com/community/public-course-request-amazon-web-services-or-sysadmin-level-server-stuff
Heroku is perfect for this. I've fallen in love a bit with Heroku, but I try to always remain unbiased. I' have put some very small apps on their free platform, which is great. Only downside to free is that the server sleeps after 30 minutes of inactivity, and it has to sleep for I think 6 hours in a 24 hour period. When you send a request to an asleep server, it may take that first request 20 seconds while it wakes up. After that's it's normal speed requests (~1 sec) until it sleeps again.
Hosting images on S3 is good anyway, it's super fast at delivery content like that. But with Heroku you have to, the way their filesystem works. But setting up S3 should be easy. S3 is probably one of the easiest AWS services to get up and stay up. And if you search on npmjs.com, there are a few packages that make using S3 inside of Node relatively painless. I wouldn't really worry much about it. Just keep in mind, S3 will eventually charge you money on top of any other hosting costs....so it's important to take into account all of that. You wouldn't want a surprise that it cost $300 to host your app one month billed by 5 different services you're using.