Hi guys … I’m wondering if there are some best practices to deploy Docker images to Digital Ocean using Terraform.
Because I don’t expect much load and don’t need failover features etc. I’m not aiming to deploy to kubernetes. At least not for the moment. I just wanna deploy a standalone Docker app.
This leads me to the question whether there are some best practices on how to deploy Docker images via Terraform. To it seemls like I can use (1) App platform or (2) provision a droplet with docker and run the image inside the droplet myself.
I’d prefer to deploy to the App platform. But I don’t have a handle on how I can use public images from DockerHub. The App platform itself (via WebIU) supports this. But from the Terraform docs I cannot get a handle on this.
As far as I see it, the app platform is simpler and more straight forward for Docker images. Plus I don’t have to setup that many domain-information (I wanna point my existing docs.sommerfeld.io to the App). Downside is that I have to setup a CNAME entry with my Domain Hoster to a <random>.digitalocean.app URL which maybe I cannot do automatically. Plus as said I don’t know how to use a public image from DockerHub.
Using the droplet means I would have to do more stuff on my own
So to summarize, here are my questions:
Thanks guys and best regards. Sebastian
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
Indeed all of the things that you’ve pointed out are correct!
I would have a couple of remarks:
https://docs.digitalocean.com/products/app-platform/how-to/deploy-from-container-images/
Then once deployed, future updates will be automatic. So when updating the source image tag, a new deployment will be triggered.
https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs/resources/app
And one last thing, if you change your Nameservers to the DigitalOcean ones, you will be actually able to automate the DNS records creation by using Terraform as well or the DigitalOcean API:
https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs/data-sources/domain
Hope that this helps!
Best,
Bobby