In the previous article How to Use Minio with Strapi v4, I mentioned how we could obtain over 80GB of cloud storage for free.
Promises are debts.
Preamble
Currently, there is an enormous number of companies offering cloud services to us developers. Usually, they have a rather limited layer, enough to build several personal projects, but it's not very scalable. To scale, you have to pay.
Displeased with the situation, I decided to rent a server at contabo.com!, which had a fairly competitive price: about 70 euros per year for 8GB of RAM, 200GB NVMe storage, and multiple CPUs.
Contabo was a great choice for developing my projects, but over time its performance worsened. Being a shared server, resources sometimes surged to 90%. It's still the best cost-effective alternative for small businesses / freelancers.
However, here we've come to get 24GB of RAM and 4 CPUs for free.
Oracle in Decline
It's no secret that Oracle Cloud has one of the least supported platforms and worst UIs in the market. However, its free tier is frankly incredible.
You can see everything it offers in this post by Arnold Galovics.
How We Take Advantage of Oracle
For this, we'll use this repository by Arnold Galovics and follow everything he mentions in his post. It's not necessary to know Terraform; simply follow the guide's steps and obtain a free Kubernetes cluster.
How We Use This Kubernetes Cluster
With this Kubernetes Cluster, we can follow our friend Viktor Farcic's series of videos
Once we understand how argo-workflows, argo-events, and argocd works, we can use these two repositories:
- https://github.com/vfarcic/argo-combined-app
- https://github.com/vfarcic/argo-combined-demo
Victor has created an infrastructure where we can simply add the Kustomize folder to each of our projects. Upon git push and configuring a GitHub webhook connected with argo-events, workflows will be triggered to build and automatically deploy the image in our cluster.
We'll need to correctly configure argo-combined-demo to add each project to our cluster.
What Infrastructure Do I Use?
Throughout the article, I've added all the references I used to build my own cloud infrastructure, allowing me to set up numerous projects for free (at least until Oracle decides to destroy my Cluster without reason).
I used argo-combined-demo as a base, but it fell short for me. I wanted an easy way to add projects, but there were many limitations.
Kaniko was building my NextJS images too slowly, so I modified the workflows to connect to one of my servers via SSH and directly perform the image build there to optimize the time it takes to create these images.
Subsequently, the images are uploaded to the Oracle Cloud Registry with a new name, and the image name is updated in my Kubernetes cluster via another workflow that handles continuous deployment with argoCD.
The repository argo-combined-app is a great example and a good base, but it's limited to just one Dockerfile.
In my case, I use monorepos containing the backend, frontend, Strapi, and other microservices. Thus, I had to modify the Kustomize to fit my needs and create a system to decide which microservices to rebuild after committing to the main branch using a JSON like this:
[
{
"name": "frontend",
"folder": "../storefront",
"enabled": true
},
{
"name": "backend",
"folder": "../backend",
"enabled": false
},
{
"name": "frontend-admin",
"folder": "../admin",
"enabled": false
}
]
This JSON is read by my workflow and takes care of building the image associated with each microservice.
This infrastructure has allowed me to build an event-based CI/CD with great scalability and very simple configuration. I just need to make small modifications to the kustomize folder of each project and run a script that adds the argo-events webhook to my repository and adds the GitHub repository to argoCD.
This is all the logic behind my projects. Personally, it took me 20 full days to set up this infrastructure without knowing anything. I'm sure you too can escape having to pay exorbitant costs to cloud companies to deploy your numerous projects.
Interested in setting up this infrastructure?
You can schedule a call with me here.