Hello Elixir/Phoenix Community,
is there any high level overview of different ways I can use GCP for hosting for someone who has never done deployment before? I am set for GCP since they use 100% renewable energies. Unfortunately that means I cannot use render.com, since their european location is hosted on AWS. I am left with Gigalixir and GCP itself.
What different ways do I have to deploy on GCP? I am a bit overwhelmed by the products. Products that I stumbled upon are GAE, GCE and Cloud Run.
Do I understand it right that Docker is a way to just get some kind of linux image running once and for all (so I can just upload it anywhere)? When viewing it like this it seems I should just do my deployment as a docker image since I can then use any service I want and switch around? How is deploying a docker image different on one service than deploying the same docker image on another service then? How is deploying a docker image different to deploying without a docker image (for example on gigalixir or GAE)?
Any answers to these questions, links to helpful blog posts or videos that give an overview for a beginner over the different deployment methods and their pros and cons would help me greatly! Thanks.
Edit: One more question: I also have a frontend that is running React (possibly with Next.js). Phoenix is basically only a backend that uses soft-realtime features. Should the front-end just run on the same machine as the backend? Or should I deploy it somewhere else?
Hi @jascha! We should have a non-AWS Render region in Europe before the end of the year.
To your last question: if your frontend is a static site, you can run it anywhere (including on Render) because it will be on a CDN and served from the closest CDN data center; Render uses Fastly for this behind the scenes. API requests from your users will go directly to your backend server.
Shameless plug, Fly.io is on 100% renewables in the US and Europe.
The datacenter providers we use in South America, Africa, and India probably aren’t.
One thing to keep in mind, though. When companies advertise 100% renewable energy, they’re talking about datacenters they own. Google and everyone else puts hardware in other peoples’ datacenters, and they’re absolutely using datacenters that aren’t 100% renewable. It is very likely that AWS in Europe is doing as well for the environment as Google is.
Hi @anuragg, will the non-AWS region be hosted on GCP or another cloud provider which is transparent about its energy usage and uses renewable energy sources exclusively?
Haha yes that is actually me asking as I was evaluating render. But since there was no definite statement made on render actually using only renewable energy, I asked here again. But actually the green energy was not the main topic of this post and it would help me more if I could get help with the other questions - I am a bit overwhelmed by the hosting possibilities.
No idea if they are green or not but once you are overwhelmed with the options you may to consider the easiest one of them:
Not necessarily the cheaper
The new region will be on Equinix who have committed to a 100% renewable energy goal.
Regarding your questions around deployment in general, I’d recommend using this tutorial once you have your local app up and running: Deploy a Phoenix App | Render · Cloud Hosting for Developers
I wouldn’t recommend GCP if you’re looking for ease of use; Gigalixir, Fly and of course, Render are all going to be much easier to work with.
Thank you, that is great to hear. Render was actually my preferred choice before I learned about the hosting. Equinix does not seem to actually already be on 100% renewable energy and even AWS is “committed” to 100% renewable energy ( Sustainability in the Cloud ), but they seem to make it a high priority. Render for sure is under consideration again now for me.
Thanks, that was very informative - and I had not heard of fly before, so good to know there is another choice. H
So you are saying that even if I am hosting on GCP I am maybe not actually hosting in Googles own data centers and other data centers may not be so focused on renewable energies?
Do you happen to know how one can get a good assessment of how much effort which cloud hoster is actually making to be sustainable?
Your own Docker image will be always the same. If you are using a service like Heroku they might actually build a docker image for you in the background, so in that case, they might be different (although the industry either uses buildpacks originated at Heroku or source-to-image originated at Red Hat for OpenShift).
Any answers to these questions, links to helpful blog posts or videos that give an overview for a beginner over the different deployment methods and their pros and cons would help me greatly!
The whole deployment story involves a lot of things. It’s hard to point you in the right direction without more details of what you want to learn (configuration management in general, k8s, distributed Elixir). But Elixir is definitely a technology that is easy to deploy without Docker, because you can make a self-contained release. So if I were you and starting I would set up a virtual machine with Elixir release behind NGINX reverse proxy.
You can handle a lot of traffic with Elixir and one single server :). Unless you have some requirements that needs 100% uptime or smth.
I just published a blog post about using Elixir releases with runtime configuration (which I recommend), you can find it useful.
Thanks so much! And the book you are writing seems be a very, very extensive answer to the question I wanted to originally raise in this thread. I subscribed to the mailing list.
Here’s an article that explains this rather well, although it’s from a couple of years ago:
If you’re interested, I recommend the new book Sustainable Web Design from A Book Apart.