This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

[Black Friday Savings] Unleash the power of managed cloud hosting at 40% OFF for 4 months. GET THE DEAL

Using GitLab to Deploy Apps on Cloudways Platform

Updated on March 30, 2022

5 Min Read
gitlab deploy

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

GitLab is an open-source collaboration platform. You may arrange the pipeline to construct a Docker picture, push it to the GitLab container registry, and send it to your server using SSH. The pipeline will run for each commit pushed to the repository.

With GitLab CI, you can flexibly indicate which branches to deploy to. If you deploy to different environments, GitLab will preserve the history of deployments so you can roll back to any past form.

The process of deploying PHP apps on the Cloudways platform from GitLab is a simple matter of executing the following steps:

  1. Generate SSH key
  2. Upload SSH key to the GitHub repository
  3. Copy the SSH address of the repository
  4. 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.

Nothing as Easy as Deploying PHP Apps on Cloud

With Cloudways, you can have your PHP apps up and running on managed cloud servers in just a few minutes.

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.

Conclusion 

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. 🙂   

Q. How can you automate your website deployments ?

  • Connect your GitLab repository.
  • Complete your server details and define your process of development.
  • Initiate a deployment manually or turn on automatic deployments.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Cloudways hosting has one of the best customer service and hosting speed”

Sanjit C [Website Developer]

Shahzeb Ahmed

Shahzeb is a Digital Marketer with a Software Engineering background, works as a Community Manager — PHP Community at Cloudways. He is growth ambitious and aims to learn & share information about PHP & Laravel Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Unleash The Cloud.
Not Budgets.

For 4 Months +
Up To 30 Free Migrations

Black Friday

SAVINGS
Time Left In Offer
  • 0

    Days

  • 0

    Hours

  • 0

    Minutes

  • 0

    Seconds

40% OFF

On All Plans

GET THE DEAL NOW
Nov 26, 2022 12:00:00