Laravel 101: CI/CD integration doesn’t have to be a nightmare

Ezra Lazuardy
Level Up Coding
Published in
4 min readJan 8, 2023

--

Introducing Ravel, a battery-included CI/CD Environment for Laravel.

Photo by Sonny Mauricio on Unsplash

Welcome to my first laravel mini-series! It’s been a while since my last writing. Work-related & college activities have made me busy lately. Some mental breakdowns and dramas a time ago also really messed up my mood.

But the past is the past, let’s move on!

Long story short, I got a job as Dev-Ops Engineer at a startup based in Semarang, Central Java. Managing deployments, releasing, testing commits, and doing some cloud optimization is my daily basis there.

Laravel is one of many tech stacks that my team uses. The one and only PHP Framework that gives you robust, clean, and performant code promise us to develop an excellent project for our clients.

Back then when I tried to automate backend deployment to our cloud servers, I’m stuck with the CI/CD issues for our repositories. FYI, we use Bitbucket for our subversion, and somehow I need to deploy the latest changes from this repo to our server at DigitalOcean.

The CI and The CD

Photo by Victor on Unsplash

For backend development, we mainly create a RESTful API for the project. Using Laravel with some libraries has been a standard for the team. You know what? handling multiple developers on the same team is a pain in the ass if we can’t manage their commits and changes to our repository.

For me, my main role as a Dev-Ops is to help them automate testing, deployment, etc. to the server. This act of automating deployment, testing, and releasing is called Continuous Integration and Continuous Deployments.

In short, the CI process needed to build and test their commits or changes made to the repo. CD process can be run to deploy, operate, and monitor the release that has been made to the server.

At Bitbucket, we can use their Bitbucket Pipelines to integrate our CI/CD environment for our project/repository.

While many example configurations for Bitbucket Pipeline are already available out there, trust me, making a new one that fits your project, tech stack, and environment is not an easy job to do. At least for me :p

Many configurations have been made, using different images, including external and internal that Bitbucket provides by default but some performance and stability issues always exist. Using Laravel as the primary tech stack require us to install the right PHP version, extensions, and several library and binaries to be installed in the environment.

Because of that, I decided to donate my spare time to the open-source community to develop a special image for CI/CD integration specialized for the Laravel framework.

A little raven was born

Inspired by Laravel Sail, Laravel’s docker-based development environment, I wrote Ravel, a battery-included CI/CD environment for Laravel.

Image by Ezra Lazuardy on Docker Hub

Ravel is a minimal, stable image that you can use to integrate CI/CD for Laravel projects. It’s based on Ubuntu 22.04 LTS (Jammy Jellyfish) with some packages and libraries included to start to build and test the Laravel project. In short, it’s plug-and-play!

If you are curious where the “Ravel” name comes from, it’s a mix of Raven and Laravel :)

The Ravel at work

Enough for the story, let’s see how Ravel helps you to integrate CI/CD in the Laravel project.

Remember the Bitbucket Pipelines I mentioned before? This is the example configuration that can be used to build and test any Laravel project with the help of Ravel.

You can straightly type ezralazuardy/ravel:<php-version> image name to your configuration file and that’s it! Ravel will be at your service to run the CI/CD process.

Why Ravel?

A simple, obvious question you might ask is, why do we need to use Ravel? Isn’t the other image much the same and just does the same job?

The answer to that is “the stability issues”. It’s okay if you want to use another image or maybe build your own image. But, it’s become your responsibility to make sure the image is working as expected, flawless, and no security concern exists.

Using Ravel really solve this issue, at least for the Laravel project. Don’t waste your time building or optimizing some little thing, my friend.

Keep it simple, because a genius always seeks simplicity.

Premature optimization is the root of all evil — Donald Knuth

Where the bird nest

Go to my Docker Hub pages to see the current release of Ravel.

https://hub.docker.com/r/ezralazuardy/ravel/tags

Or you can just pull the docker image to your local environment

docker pull ezralazuardy/ravel:8.2

The tags used by Ravel indicate the PHP version that is used inside of it. Make sure to use the right Ravel version for your Laravel projects.

--

--

“An idiot admires complexity. A genius admires simplicity.” — Terry A Davis