CICD with cPanel and GitHub

Appimate
5 min readOct 16, 2021

--

Earlier this year I learnt about the Continuous Integration and Continuous Deployment (CICD) methodology using an AWS pipeline cloud service. During this time I thought that the CICD methodology was only possible in big companies that use AWS as a service provider and the likes, because let’s admit it no small company can deal with the expensive overhead AWS brings.

This led me to think and ask questions about if there is an alternative to this, and surely there was and it was in the result of Git, GitHub and cPanel which I will detail in the following sections;

The entire process can be split into 3 simple Phases:

  1. Create a repository on your GitHub account,
  2. Create a cPanel FTP account from your cPanel dashboard,
  3. Create YAML file (in the right folder of your git repository),

and then Push your changes to the GitHub repository, where the magic happens.

Tools used:

Git: the good old software to track all your changes to your project folder and collaborate remotely.

Visual Studio code: the good old IDE (you can choose your favourite)

cPanel: is a web hosting control panel.

GitHub: In GitHub we used GitHub Actions which makes it easy to automate all your deployment workflows.

Our Repo: https://github.com/AppimateSA/CICD

Phase 1: Create of an FTP Account on Cpanel

The first thing would be to set up and create an FTP account on cPanel. (This assumes that you have already created a cPanel account) :

Step 1: cPanel FTP account

After logging in your cPanel account, go to the Files tab and click on that. Under it you will see a FTP account creation

Step 1.1: Select FTP account (Not Git Version control, we made that mistake)

Step 1.2 when you click it the following will appear, which you can fill in (keep safely the login/username and the password).

Choose directory of where you want to deploy your changes (all these will be under File Manger), inserting public_html will publish from your main domain folder.

Step 1.3

Choose a Quota you feel comfortable with

Result

After this click create FTP account and if it successful it will show on the table below e.g:

Phase 2: GitHub Repository & GitHub Actions

Now comes to second phase of our setup and this involves GitHub actions. (This assumes that you have already created an account on GitHub)

Step 2.

Create a GitHub repository

Step 2.1

When the repository is created go into it and click on settings to setup secrets.

Step 2.2: Adding the repository secrete keys.

The only point of this step is to remove secrete keys from your code, that’s it. Now, create a secret by clicking the New repository secret button. The secrets that you will create will be the password and username that you used for your FTP account. These will serve as environment variables for your YAML file.

Step 2.3: Adding a Workflow for your GitHub Actions.

After you are done with your secrets configurations, go and click Actions (displayed at the top of your repository) to get started in setting up your your Workflow using YAML file, for the facilitation of the CICD workflow.

Step 2.4: Getting the default YAML file

After clicking the setup a workflow yourself link this page will show up:

Step 2.5: Customizing the YAML file

Setup YAML file by using our the code as reference.

Commit the changes. After that go back to your code you should see a new folder created:

This folder is where the YAML is. Make sure that this folder is not deleted (deleting it means all the workflow configuration is gone and won’t execute).

Now you can test your CICD methodology by uploading any file you want on the GitHub repository or by doing your normal push commands from your local machine to the repository. The later options is highly recommended to retain the normal development patterns.

You can go track your deployment on your GitHub Actions:

If the file is deployed successfully, you will get a green check. To double check if the file is deployed, go to your deployment folder which is in cPanel and check for the file you created:

Conclusion

We all know how important collaboration and controlled software deployment is to larger organisations, we just thought it would be important to let you know that these are very achievable even in smaller low budget organisations. It takes a couple of setup steps on your traditional tools cPanel & GitHub.

We would appreciate any feedback on how this information helped or any general comments on the topic. check out our social media platforms.

Thanks to the following people at Appimate:

Tulani Bango, Luthando Maqondo

--

--

Appimate

APPIMATE is a technology company specialising in consumer software products and enterprise solutions.