System Overview
Overview
The M.D.G. IT Managed Deployments system is a set of tools that keeps track of changes to files, builds a functioning Magento site based on these files, and then deploys them to the server that is hosting the site. The deployment system handles Magento files, and does not store databases or media files (such as product images).
The database, images and a handful of configuration files are stored on the servers that the system deploys to. Everything else on these servers is created dynamically by the deployment system, and is overwritten on a full build.
The files that are stored in git and the set of files required to run Magento are different—the build is the process that starts with the files in git and dynamically generates the remaining required files.
Components
The M.D.G. IT managed deployment system for Magento consists of several systems:
Version control
Git is a version control system that stores all of the Magento application files, aka source code, and a history of changes made to each file. This allows developers to:
- make changes to files without having to take backups of the original version
- compare different versions of one or more files to see what's changed
- revert one or more files to a previous version if something goes wrong
Please see here for an introduction to git:
https://www.atlassian.com/git/tutorials/what-is-version-control
https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control
Gitlab
Gitlab is a web-based user interface for git. Gitlab allows users to interact with git without having to use the command line, as well as providing additional functionality, including:
- Editing of files using the Gitlab file editor
- Comparison of file(s) using the built in comparison tool
- The ability to run deployment pipelines, which are a series of jobs that process the source code, producing a fully functioning Magento site
Clients receive their own Gitlab login, and can manage users who have access to the repository and deploy code to staging / production.
Gitlab runners
Gitlab runners are specialised virtual servers that run the jobs that create a functioning Magento site from the source code in git.
Deployment targets (aka Environments)
These are the actual servers where Magento runs, which serve the website to visitors. Each project has a staging environment, for testing changes, and a production environment, where the live site is running. The staging and production environments are identical, as is the build and deployment process. This means that the functionality on production should be identical to the functionality on staging.
Important Concepts
Commits
A commit is a snapshot of every file in the source code (i.e. the Magento file system).
Pipelines
Each pipeline is based on a specific git commit. A pipeline is made up of jobs, which together form a repeatable process that takes the files in git, runs the commands necessary to build the full site from the source code, and deploys the result to a server (aka environment). Pipelines go from left to right in stages.
Jobs
Jobs are the individual building blocks of pipelines. Each job runs one or more commands that get the site ready for production.
Putting it all together
- Developers commit their code changes to git, either directly in Gitlab using its file editing tools or by committing changes on dev / a local machine and pushing to the repository.
- The pipeline for that commit runs, building the full site.
- The result is deployed to staging and tested.
- When everything is working as expected, the same build is deployed to production.