Website development

We are Makklays. We help to realize the idea.

What is CI/CD in programming?


Makklays - Articles image

eye 42


Now it has become fashionable to use CI / CD. The abbreviation CI / CD is often found in vacancies. Let's take a look at what this means. So.
In software development, CI / CD or CICD is a combination of continuous integration (CI) and continuous delivery or continuous deployment (CD).

CI / CD brings together development, deployment, and teamwork, accelerating the build, test, and deployment process of an application.

Currently, DevOps programmers strive to use CI / CD for almost all tasks.


CI / CD IN PRACTICE



How it looks in practice. In practice, when working with a PHP project, we can use different services (below we will consider a few of them). It would seem that continuous integration is something very smart and scary. This is something that only big companies like NASA, Microsoft, Ford and Ferrari use. But no. Even a small company of two or three programmers and a designer can afford to run a CI / CD to build projects.

Simply put, continuous integration is putting code into a production system :) Actions that are performed in small teams, and especially in startups, many times a day. Continuous Integration automates this process and reduces the programmer's time for this action.

To do this, they can use several services discussed below.


Gitlab CI



Take advantage of the awesome Gitlab CI / CD tool to automate continuous integration. After purchasing Github from Microsoft and after investing heavily in Github, new features for the inexperienced began to appear on Github: Github Actions, code review and, after many years of waiting, free private repositories appeared for the first time. Having chosen Github CI / CD, the whole process of building and laying out the code on the production server will consist of three steps: build, tests, deploy for prod. At the root of the project, you need to make a .gitlab-ci.yml file - a config file that describes what to run and how to run it. All the syntax and rules for writing this file are available in the reference https://docs.gitlab.com/ee/ci/yaml/ - everything is described in detail there. Code examples and deploying all this on your project are available on the Internet and we will not get hung up on this. Please note that for the Deploy stage, the project will be uploaded to the external Heroku cloud. Setting up and reviewing Heroku is beyond the scope of this article. All you need is the name of your application and the Heroku API key.


Jenkins



Jenkins is very famous and widely used since 2011, as a fork of the Hudson project from Oracle. This is a vivid example of a CI / CD system, for which Jenkins itself was developed. Today, the Jenkins system is used by PlayStation and NASA SpaceX. The product is free and distributed under the MIT license. Jenkins requires a dedicated server for its work. Jenkins has many communities and articles on how to set up and use it on the web. There are also many books and guides (on the internet). Setting up and reviewing Jenkins is beyond the scope of this article. Jenkins has several useful applications: Configuration as Code - helps in configuring Jenkins, and Jenkins X for the cloud. Jenkins X reactively delivers data to the cloud.


TeamCity



The TeamCity system is often chosen because the TeamCity system is the easiest to install and configure. After downloading and installing the continuous integration system, the CI server becomes available to you via http url, for deploying the continuous integration system. For convenience, you can create a proxy-server on port 80. Setting up a CI server for continuous integration is very easy (this is often why programmers choose TeamCity). You can configure the CI server through the web admin panel. All you have to do is fill in the fields and click the Continue button, just like in Windows. Everything is simple and straightforward. And on the Internet there are many articles with screenshots, we will not dwell on it in detail.


And other CI / CDs for PHP projects



PHP Censor, Rex (Remote Execution), Open Build Service (OBS), Rundeck, GoCD, Buildbot - all of them are also used when developing PHP projects for continuous integration.