Articles on: Getting Started (WebPro)

How to Install and Uninstall Astra Website Protection for sites using Git (Version Control)

You can install Astra Website Protection on websites using version control software such as Git. We recommend installing the plugin in your local development environment first, before deploying it to production. If you have any questions around the installation, please create a support request from your Astra Dashboard.

How to Install



Step 1 - Preparing Production Environment



Before we being the installation, please ensure that your productions server meets the General System Requirements.
If you are using a load balancer, and multiple nodes - please follow the instructions for load balanced environments.

Step 2 - Configure Storage Engine



By default the plugin uses the Filesystem storage engine, which creates the getastra-premium/astraStorage folder in runtime. This folder stores the plugin configuration and should not be erased across deployments.


You can configure the Astra Website Protection plugin to use the MySQL storage engine, and set the environment variables for all the servers

Option 2 - Update CI/CD script


Depending on how your CI/CD deployment script is written, you can update it so that the astraStorage folder is not erased across deployments

Option 3 - Custom Storage Path


We can alternatively configure a custom storage path which will be used to store the plugin configuration .is

Create a folder called astraStorage which is outside the main application folder so that it is not erased across deployments
Now we need to set the ASTRA_STORAGE_ROOT server environment variable with the absolute path of this folder. You can see the steps to add the server environment variable.

Example code (the path will change as per your server):

ASTRA_STORAGE_ROOT=/var/www/astraStorage



Please verify that the server environment variable has been set via the phpinfo() contents. Otherwise the astraStorage folder will get created, and may lead to un-staged changes on the server. Depending on your CI/CD configuration it may cause errors.


Step 3 - Adding Plugin files to Version Control



From our Getting Started guides, find installation steps for your CMS or Framework

Create a new Git branch for the plugin installation & checkout in your terminal application (you can use any branch name)

git checkout -b install-getastra


Once you have switched to the new branch, install the plugin in your local development environment by following the steps in the instructions

We do not need the .zip file, so you can delete it

rm getastra-v*.zip


Now stage the files in the getastra-premium folder to your repository.

git add getastra-premium/


Once you have verified the changes, commit the changes with the following command

git commit -m "Adds Astra Security plugin"


Push your changes to origin & deploy the code to production

git push origin install-getastra


Now enter the Activation Code in the plugin activation page as shown in the installation guides


How to Uninstall



From our Getting Started guides, find uninstallation steps for your CMS or Framework
Create a new branch in your repository, delete the getastra-premium folder, commit the changes, merge your code and deploy it
Delete the astraStorage which you may have created created during installation

If you have any questions about the installation, or have a different server setup - please feel free to create a support request from the widget on the bottom right - we'd be happy to help.

Updated on: 30/11/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!