Run Cloud, Run!

I've been working on an API layer for a new project - cookoffchamps.com - originally I was just going to use the server middleware part of NuxtJS, but then I was persuaded that Python is a strong and simple technology to use for API development. So why not, right??

Originally, this was to be deployed on one of my Linode instances, but some challenges I ran into with Gunicorn (mainly around conflicts with pre-existing sites) made me re-think - and I thought, why do I need a server for this at all???

Enter Google Cloud Run - they already offer "standard" buildpacks for Python and Flask projects, charge you by usage (which should be much cheaper than adding a new Linode instance) and automatically scales as my project grows. A few minutes with Github and CI/CD is in place.

There is one catch

This one took me way too long - I have a paid Mongo Atlas cluster that I wanted to use for this project. There is a VPC connector from Google to Mongo Atlas - and both ends confirm that Google Cloud to Mongo DB is supported - but there is a catch. If your cluster is hosted on Google, then it will work - but if you're using AWS or Azure (in my case Azure) then it will NOT. To be fair, this is documented, but it's definitely in the small print and not easy to find... That took way longer than it needed to for me to find and solve.

Work around for now is for me to give Google Cloud Run access to my MongoDB directly (not through my VPC) - nowhere near as secure, but good enough to keep development moving forward - and definitely on the TODO list to get fixed!