3 ms·
On the backend my API is using node+koa and postgres+postgis. Front end is vue. Koa is amazing, and there's a postgis package for knex (a SQL query builder) t
by gorbypark 8y ago
On the backend my API is using node+koa and postgres+postgis. Front end is vue. Koa is amazing, and there's a postgis package for knex (a SQL query builder) that lets me do geospatial stuff right in node, which is a game changer. Backend is deployed in containers, Google container registry builds the images for free on every git push and custom bash scripts deploy on the digitalocean instance. Front end is deployed with Netlify, also on the free tier, and also amazing. It's incredible how cheap (and mostly free) it is to deploy side projects these days!
- ngrilly 8y agoThanks for sharing your stack here! How do you deploy your backend containers without downtime? Do you host your Node app and PostgreSQL on the same machine? I understand your frontend is hosted on Netlify and your backend on DigitalOcean: are they accessible under the same hostname (using Netlify proxy for example), or do you use CORS requests?
- gorbypark 8y agoI do have a slight downtime (1 second or so) when upgrading containers since the bash scripts just pulls the new image, stops/rm the container and start up the new one... Although my project is for an enterprise customer who works 7am-5:30pm so I just do it outside of those hours. Each end point is it's own instance too, which minimizes the likely hood of anyone knowing. It was all designed to run on kubernetes which would allow rolling updates with zero downtime, but I can't justify the cost of a cluster at the moment. The node app and postgres are on different instances. They could easily be on the same, though. Postgres is open to the world since GIS analysts need to be able to connect to it with QGIS. The API is also open to the world using CORS for the same reason (a custom GIS collection tool accesses the REST API).
- ngrilly 8y agoInteresting! I think a 1 second downtime when deploying a new version of the backend is tolerable if the app is a single-page application, because the app can implement a retry logic client-side. This is possible only if the backend can be stopped and restarted really quickly. Otherwise, a rolling update or green-bue deployment is necessary. Another question: do you expose your Node service directly to the Internet, or is it behind a reverse proxy?