ServerKade

ServerKade

Did You Know?

Easily manage backups and deployments with ServerKade automation.

Git Integration

GitHub | Product Documentation

Estimated reading: 4 minutes 14 views

Creating an application in ServerKade for hosting PHP scripts and projects with Git is simple. You can specify the application name, domain, system user, and other options such as PHP version and custom web root. When choosing the deployment method, you can select “Git” to easily deploy your PHP code from a Git repository. Once the application is created, ServerKade will automatically clone the repository and deploy the code. You can manage the Git deployment process from the ServerKade dashboard. ServerKade makes it easy to create and manage PHP applications with Git.

Once you have connected your server with ServerKade, you can follow the steps below to automatically install the GitLab repository on your server.

Github Integration

Step 1: First, you need to Integrate Git, Navigate to DashboardIntegrationGit.

Step 2: Click on the Github Link Github button like the below image. After that, allow authorisation to serverkade for deploying your project and your Github account connected with the serverkade account.

Link Github

Step 3: Now, you can deploy a site from Github.

Create Application

Step 1: Click on the server on which you want to create the new application.

Step 1

Step 2: Now, you will see the option Applications on the left-hand sidebar of the Server Panel. Click on Applications.

step 2

Step 3: Now, you will see the Applications table like the below image. Click on the Create button on the top right of the Applications table, as mentioned in the below image.

Step 4: After that, you will see the Create Application screen like the below image.

Application - Basic Details

Step 5: Basic Details

  • Enter the name of your application in the Application Name field.
  • Choose whether you want to use a primary domain or a test domain in the Domain field. If you select a test domain, you can change it later to a primary domain.

Application - Basic Details

Step 6: Application

After that, select Integrated Account, then select your repository Repository, and select its Branch. If you want to run a script after cloning your repository, then write a deployment script.

Step 7: Advance Options

When creating a new application in ServerKade, you have the option to either create a new system user for the application or use an existing one. A system user is a user account created on your server, which is used to manage files and permissions for your application.

In the Basic Settings section of creating an application in ServerKade, you have the option to select the PHP version for your application. ServerKade supports multiple PHP versions ranging from 7.2 to 8.3. You can choose the desired PHP version for your application.

Application - Settings

You also have the option to specify a custom webroot path for your application. By default, ServerKade sets the webroot path to /public_html for your application. However, if you want to set a custom webroot path, you can do so by entering the desired path in the “Webroot” field provided. This can be useful if you have specific requirements for the directory structure of your application.

You can not perform Enable Auto Pull if your repository Type is public.

Step 8: If you want to Enable Auto Pull, then navigate to Created Application DashboardGit.

  • Then click on Enable as shown in the image below.

Application - github enable

  • After that, Copy Webhook URL.
  • Login into your Integrated Github Account, and In your Selected Repository, navigate to SettingsWebhooksAdd Webhook, and use the following settings:
    • Payload URL: Your Copied Webhook URL
    • Content Type: application/json
    • SSL Verification: Disable (not recommended)
    • Which events would you like to trigger this webhook?: Just the push event
    • Active:: Check
  • Click Add Webhook to save your settings, and the request should start working.

Application - github enable

  • Click on Edit, then click on Recent Deliveries tab for see your Request Logs.

Step 8.1: You can view your commit history in the Webhook History section.

Application - Git History

Step 9: To check out a branch, click on Change Branch and select the desired branch.

Application - Github

Step 10: If you wish to run a Custom Script after a pull request, enter the script in the Deployment Script section and click Save.

Application - Github

  • When the webhook receives a push request, you may want to execute a Custom Script to clear cache or update your web application. You can write a script that includes this command in the Deployment Script section.

Please use # (hashtag) for commenting in the Deployment Script.

  • The script will run inside your application’s root folder. If your deployment script involves using composer or PHP command, it will use the default PHP-CLI. You must use a replacer to run a script using a different PHP version.

    Replacer

    • A replacer lets you specify a specific PHP version for the deployment script to run.
    • For example:
      {PHP80} artisan cache:clear
    • Will be translated to:
      /usr/bin/php8.0 artisan cache:clear
    • You can always type the full path to the PHP version if you prefer not to use a replacer.