Managing the codebase is perhaps one of the most important aspects of the development workflow. This is the reason why Git has become an integral part of the workflow for developers around the world.
Git is an open-source version control system used to store different versions and updates of your code either locally or over hosted solutions like GitLab, Bitbucket, or Github.
This article explains how one can use GitLab to deploy apps on the Cloudways platform.
Deploy Using GitLab on Cloudways Platform
The process of deploying PHP apps on the Cloudways platform from GitLab is a simple matter of executing the following steps:
- Generate SSH key
- Upload SSH key to the GitHub repository
- Copy the SSH address of the repository
- Deploy the application code from the repository
You can deploy PHP applications on the Cloudways Platform very easily, thanks to the integrated “Deployment Via Git” feature that helps connect your Git repository with the Cloudways managed server
Step 1: Generate the SSH Key
Sign in to your Cloudways account, visit the server where you wish to deploy the application and head to the Applications Settings.
In the Application Setting, head to the Deployment Via Git option available in the menu on the left of the window and click Generate SSH Key.
This will automatically generate an SSH key. Click View SSH Key which can be copied by hovering over and clicking the key.
Step 2: Upload SSH Key To GitLab Repository
Move to the repository on GitLab and to the account’s settings page.
Move to the SSH Keys setting and add the SSH Key you have copied from the Cloudways. Give a title to the SSH Key and add an expiry date (optional). However, note that if you don’t add an expiry date, the SSH Key will never expire. This could be a security loophole.
Click Add Key and you’ll see the details of the key.
Step 3: Copy the SSH Address Of Repository
Move to the repository which you need to clone on the server. Click the Clone option which drops down and shows two options, Clone with SSH or Clone with HTTPS. Copy the URL under the Clone with SSH.
Note: The option to Clone with HTTPS is not supported by the Cloudways Platform.
Step 4: Deploy the Application Code from the Repository
- Move back to the Cloudways Application Settings > Deployment Via Git and paste the SSH address of the repository you have copied.
- Click Authenticate to let Cloudways authenticate the SSH address.
- After authentication, select the branch of your GitLab repository you need to deploy from. For this example, I am using the Master branch.
- Next, type the deployment path. Make sure to end the deployment path with a /. If you leave this field empty, the code will be deployed to the public_html/ folder by default.
Finally, click Start Deployment to deploy your code.
Upon successful GitLab deployment of your application, you’ll get a green-colored pop-up message “Git cloned”.
Further, you can pull the code from your GitLab repository each time you make changes there with a simple Pull request.
Here, we also need to understand that the CI/CD using GitLab makes the deployment process easier as it allows us to create a pipeline that ensures flawless application updates for the end-user and upgrades the production quality.
Cloudways has simplified Git deployment with a significant reduction in the time required for deploying web applications. As such, you can focus on building the features and expanding the functionality of your applications. Deployment through Git also resolves the problem of version control and enables better collaboration between the multiple development teams.
Let me know in the comments section below if you experienced any problem when using GitLab to deploy apps on Cloudways and I’ll try to answer it there. Happy Deployment. 🙂
Customer Review at
“Cloudways hosting has one of the best customer service and hosting speed”
Sanjit C [Website Developer]