Getting Started With CD
October 13, 2018
Working with devops things like setting up custom CI/CD for my projects honestly scares the shit out of me. Once I start reading about how to do it, I realize how much I don’t know. It’s also so much harder to tinker with than just code, where you get instant feedback, and can debug. Tinkering with cloudformations, docker images, or virtual machines requires building and running them. Takes much longer time. There’s also the sense of never being good enough. You start with a simple manual deployment method on Firebase or Heroku. Maybe you can use a hosted database on something like mLab. You can even make Heroku listen to your repo on Github. Works well, but it gets expensive if you want to scale. So I turn to using Docker and a virtual machine on Digital Ocean. I quickly realize just Docker is not enough. I need Docker Compose which complicates things a little bit. I also need to handle images, tags, expose, networks, etc. which I arrogantly think I can handle without taking the time to really learn what the are. I realize I need a place to host docker images, as Docker Hub only gives you one free private image. So I start making my own image repository on a virtual server. It needs to be served over HTTPS, so I also need to host an Nginx reverse proxy with Letsencrypt. I would be so lost here if there weren’t for some great guides on how to do this. After some messing around with different Docker Compose versions I figure it out. I also learnt how easy it can be to get a certified HTTPS using these tools.
Back to CI/CD. I tried to host a docker version of Strapi. It has a quite strange deployment method, as the configuration and code base can be changed both on the live version through a web ui, and by actually coding on your local machine. When deploying changes, I need to ssh into the vm, pull a repo from Github, and then restart a Docker container which loads the repo as a volume. I thought of using Jenkins for this, but I heard some great things about Gitlab CI. It works well, and Gitlab seems quite amazing. Even though it’s a little clumsy, I look forward to learning how to use Gitlab effectively.
I really start to fall off when I see the peaks ahead of me. I can do some ssh-ing, some Git pulling, some Docker building, even some Docker composing. But what is this Kubernetes, Docker Swarm, Terraform, those huge Cloud Formation files. Oh my god, all the configuration. Hopefully, I can take the next step on the stair ladder to becoming a decent devopser. Or maybe I should just focus on developing and creating products, and just use Heroku, and hosted services for everything.
Written by Viktor Frede Andersen. You can reach me on Twitter @vikfand