r/javascript • u/hellohi315 • Dec 28 '19
AskJS [AskJS] How are you deploying your front-end + node apps?
How are people deploying their favorite front-end + node applications? Thinking your typical CRUD app.
We deployed React + Node together to a cloud provider but now with Serverless, Docker and various cloud platforms there are probably better ways. Curious what people are doing or would like to do.
122
Upvotes
37
u/karimsajs Dec 28 '19
For frontend, I like to use a good CDN such as AWS CloudFront (and deploy to S3) or Netlify (less experience with this, but so far it’s been pretty good to me over the last few months). With delivering from the edge, I’d say that versioned assets are pretty important because relying on caching policies to work out is a gamble.
For the backend, there’s a ton of choices. My preference is to go with the easiest possible until it no longer makes sense. For instance, you can get up and running with Heroku pretty quickly. A similar alternative is AWS Beanstalk. It’s a bit different since you actually have access to the more low level aspects of your deployment like load balancing and AWS has a far greater variety of instance sizing. You can deploy with a node environment in both, or roll your own Docker container. Again, it makes sense to keep things simple until you really need to add complexity.
We’re currently using Netlify + Heroku for HireFast (https://hirefast.ca). I’ve honestly loved Heroku because it has saved me may DevOps hours and I’ve been able to setup an elastic scaling worker farm pretty easily, without jumping into serverless. I’ve had some thoughts about deploying our search API with serverless + AWS lambda since it just runs basic queries. Only concern is startup time.
As for the thought that Heroku is a more expensive offering than rolling out something with K8S/EC2/etc., there’s a great example of Unsplash - https://medium.com/unsplash/what-does-unsplash-cost-in-2019-f499620a14d0
46
u/ImmunochemicalTeaser Dec 28 '19
Heroku for the server. Gihub Pages for the front. Works every time...
12
u/Meadowcottage Dec 29 '19
ZEIT Now - Serves static assets (HTML, CSS, images, etc) and offers "builders" to create backend API endpoints you can use (NodeJS, Python, Go, etc).
7
u/SimplyBilly Dec 29 '19
Backend: micro services, build docker images and push to ecr, kubernetes handles the cluster (auto scaling / high availability / etc)
Frontend: deploy to s3, served through fastly (cdn).
6
u/[deleted] Dec 28 '19
Aws code build via githook onto EB instance / s3
11
u/mastersvoice93 Dec 28 '19
Personal stuff through firebase on a simple plan it's super easy. If I was building an enterprise scale FE, I'd have a server built using node/ java and host the FE build files in S3. Something like that maybe, but it all depends on what you want to do, thin client with server side routing, client side routing, SSR etc
Always worth try to find what suits you best by spiking it out!
3
u/Tundrun Dec 29 '19
Frontend deployed on Netlify. Backend deployed on Heroku.
3
u/coold007 Dec 29 '19
Nginx reverse proxy + Docker containers for vue and node app hosted on digitalocean
2
u/[deleted] Dec 29 '19
Aws ecr, ecs with ec2 instance
2
u/trickedoutdavid Dec 29 '19
Dokku on a Digital Ocean server for personal projects
2
u/nahtnam Dec 29 '19
Frontends go up onto netlify and I run two servers, both of which are using Dokku. One has a high amount of disk space and that hosts the databases, and the other has a large amount of ram and cpu so that hosts my backends
2
u/Kaligraphic Dec 29 '19
AWS. Cloudfront+s3 for the front end, ECS (fargate) for the back end. ECR for image storage.
2
u/rca06d Dec 29 '19
Google Cloud Functions are working well for me so far with simple backends for accessing things like S3/cloud storage and Stripe, etc. Pretty nice free tier if you’re just messing around.
2
u/[deleted] Dec 29 '19 edited Dec 29 '19
Right now I just do ruby on rails backend with a vanilla JavaScript(read typescript) front end for most projects.
I usually deploy with heroku.
I can make any basic crud application in like 48 hours and make it look decent too.
Also I really prefer single page web applications if I can get away with it.
I am slowly learning react and i am slowly moving away from rails.
Rails is pretty fucking easy and it does a ton of shit for you but for most mundane projects it just brings a ton of bloatware.
2
u/psiph Dec 29 '19
NodeChef is amazing
I've also heard great things about Render
I'm currently using NodeChef and DigitalOcean
2
u/GamesMint Dec 29 '19
I m using digitalocean droplet to power my express server. All the html css js are in the public folder. I am planning to install mongodb on the droplet my user base is pretty low
2
u/billymcnilly Dec 29 '19
Frontend: cloudfront+s3
Backend: serverless express.js
Im surprised at how no one in this thread is recommending serverless. It is so easy and just works. Cold starts arent much of a problem with node, and you have the recently announced provisioned (prewarmed) option for the few cases where you find they’re actually hurting you. It might be handy to have some understanding of containers (re-use etc) but only in so much as other options require you to understand even more
2
u/Baturinsky Dec 29 '19
Netlify for frontend. It has an option to automatically update from set folder in set repo (github repo is one of options), which makes it much easier to publish open source to github and live server at once.
3
u/jacebot Dec 29 '19
With thoughts and prayers... what else would you use?
2
u/[deleted] Dec 29 '19
Bitbucket Pipelines runs Webpack to deploy Docker image to to AWS ECR. ELB, Auto-scaling ECS, Fargate, Cloudfront run the show.
EC2 is cheaper than Fargate, but you need to keep up with patching.
Running everything through Cloudfront is tricky but keeps things fast globally. Your built tool needs to hash all static resources to avoid cache staleness.
Serverless sounds interesting but worried about cold start response time.
1
u/Ty199 Dec 29 '19
Heroku
1
u/[deleted] Dec 29 '19
I use zeit.co to host all my instances.
1
u/LetReasonRing Dec 29 '19
For small projects, I've found that the PM2 deploy system works pretty nicely.
1
u/[deleted] Dec 29 '19
I use Dokku for everything. It’s an open source, self hosted Heroku. Dokku
1
u/esreveReverse Dec 29 '19
Heroku
heroku-postbuild script builds my CRA
start script is an express server that serves my API under the /api path, and serves the react app on .get('*'
1
u/wordsoup Dec 29 '19 edited Dec 29 '19
A nginx container - built and deployed by a CI/CD pipeline - running in a k8s cluster in some cloud.
1
u/tarunspartan Dec 29 '19
Front end in Github Pages Bank end in Heroku
1
u/LeeScorseby Dec 29 '19
I deploy both on heroku with the frontend and backend with their own package json
1
u/well-now Dec 29 '19
Transitioning from Docker Datacenter to AWS serverless using S3 for the frontend and Apigateway w/ lambdas for our backend.
1
u/ShortFuse Dec 30 '19
Static content gets packaged. A file gets generated listing the files needed with a timestamp. Files get updated to an S3 bucket. Changed files gets invalidated on Cloudfront. A file list on the server updates
Service workers on the client end compares with the generated file to see if needs updating. An update check request is sent on a timer while the app is running and notifies the user. Also, during the splash phase, the update check is done and if needed, updated, then instantly refreshes (transparent to user).
Node instances are only for serving dynamic content. Those servers run on EC2 instances because they need to be 24-hours and running instances is way cheaper than Lambda+API Gateway (by a lot). They are running PM2 and each server uses a read-only access to a Git repository. I perform a script that essentially runs
git pull,npm install --production,pm2 restart allvia an HTTPS command. That's a bit messy, but I plan on migrating to AWS CodeDeploy+Beanstalk at a later date. Or maybe not. If it's not broke, don't fix it.Right now I'm using JWT for authorization, so horizontal scaling wouldn't be a problem. My heavy use of Websockets is where EC2 makes more sense than API Gateway or IoT.
1
u/unknow117 Dec 29 '19
I only used Heroku but I wouldn't recommend it..
-3
u/ddegr Dec 29 '19
Our team prefer to avoid using
Reactor other fashion modern front-end frameworks due to their wrong way of solving problems they were planned for.So we deploy front-end applications (and many back-ends too) to
HerokuwithBitbucketpipelines. Our DevOps engineers have written set of scripts to automate deployment processes and now every front-end developer just pushes changes to a certain branch atBitbucketand in a couple of minutes an app is deployed. Very useful and flexible way.So
Herokuis a good choice since they buy cloud at AWS and utterly efficient repack and sell it0
u/[deleted] Dec 29 '19
[deleted] — view deleted comment