Step 4: Deploy the Application Code from the Repository
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 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 Cloudwyas 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 Application 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 Cloudways. Give a title to the SSH Key.
Step 3: Copy the SSH Address of the 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 (notes: always remove the .git at the end of the SSH URL before adding to Cloudways).
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 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 your code from your GitLab repository each time you make changes there with a simple Pull request.