DEV Community

Cover image for configure Plesk and Gitlab to deploy your laravel application
massimo colella
massimo colella

Posted on

configure Plesk and Gitlab to deploy your laravel application

Assuming you have your project repository in Gitlab, and a Plesk hosting interface to work with, follow these steps to create a CI/CD between your gitlab repository and your hosting panel, and publishing automagically your laravel application.
Before you begin, some details:

  • If not available, ask your hosting provider to install the GIT Plesk extension. It's free and it's mandatory, to make this CI/CD work.
  • Plesk has a default webroot public folder for your website, called 'httpdocs'. We will instead use the default laravel 'public' folder. So, enter your plesk admin panel, and click the Hosting Settings link. Change the value in the interface, as you see in this screenshot:

Plesk admin interface

  1. Open your project subscription in Plesk;
  2. Click the GIT icon (if not installed, proceed to install the GIT extension, or ask your hosting provider to do so)
  3. Click to Add Repository
  4. Enter the gitlab ssh or the https address in the repository URL

Plesk - Git extension interface

Plesk will generate a ssh public key, maybe it will be already automatically copied in your clipboard. Copy it.

  1. Go to your gitlab project, then go to settings -> repository, then click the Expand button of the 'Deploy Keys' section.
  2. Insert a name for your key, then paste the copied key in the field below. Check the 'Grant write permission to this key' option, then click the 'add key' button below.

Gitlab settings

  1. Return to your plesk interface, then click again the Git icon. You will find a panel like this one below:

Plesk - git settings

here you can change which branch will be published on your web server. Choose the one you need.
Next, we will change the default deployment location. Click the settings icon in the lower right corner of the panel, then change the Server Path leaving a simple slash /, removing the default folder, 'httpdocs'.

Plesk - Git settings

  1. click the Deploy now button to pull the git files onto the web server root.

Finally, you will need to make your laravel application work within your plesk hosting, running composer and npm. Refer to this article.

Top comments (0)