My favorite architecture

Dec 07, 2020

In this article I wanna show you the architecture that I going building along the lasts years, I will explain what I like and why this is my prefer today.

First, the motivate to share this content is because I believe that we can help other colleges share wisdom.

Git repository

Yes, this is not new for developers, but this solution started with one repository Git, more specific one monolith with this organization:

app
php
docker-compose.yml

app: is the place where I have my app API Laravel, or the front-end app Angular.

php: here I put the Dockerfile and custom_php.ini

Buddy Works

Today we have many options for deploy automated, but Buddy was the platform that more call my attention, because is too easy set pipelines using the dashboard super cool.

Buddy: The DevOps Automation Platform
Get the most powerful and easy-to-configure continuous integration and delivery platform.

Buddy is very cool, have a plan free and I choose the tool as my favorite for deploy because works well, have integration with many cloud services like Digital Ocean, AWS, and believe me, is amazing!

Digital Ocean

I already use many services like AWS, Google Cloud, but Digital Ocean is for me, the most easy, low cost and transparent service that I know, like Buddy the cloud is my choose to host my machines of staging and production, how is a cloud service, I have many possibilities like:

  • Spaces: One service specific to storage, you pay $5 and have 250GB
  • DNS: Super easy to setting
  • Alerts: To controls your costs
  • Packages click-use: For example, you can start in 5 minutos one server with Linux + Docker + Docker-compose

Docker and docker-compose

With docker I have the possibility to deploy the same environment that I test the application in my local environment, with docker-compose this task is even more easy, I just have some observations:

SSL

During a time I install letsencrypt inside the docker, this is not the better way because sometimes you will need change and recreate the docker and you will lost the certificates, and we have a limit to generate new certificates and call API of letsencrypt, so the best way that I found was install letsencrypt in the machine directly and map the certifications for inside the docker using the file docker-compose, so, like this you can set the crontab for renovate the certificate and you not go lost the files when need recreate the docker.

Mysql database should stay outside the docker

Like letsencrypt, I map the data volume outside the docker for the same reason, if you had the data inside the docker, recreating the image will lost all your data, and this is not good.

Reasons to use this architecture

For me, this architecture is amazing to manage, deploy, monitored, control costs, flexibility to grow our API and the business, and other many motivations.

I hope had help you to think.