Create staging environment using GitLab

Prequisite: Please go through the steps to set up GitLab on the Production/live server before going through this tutorial. Steps to create a staging environment using GitLab branch 1. Create a new branch for your GitLab project as shown below 1 A. Go to your project page in GitLab and click the option to add New branch 1 B. Create a new branch named as dev 2. Create your staging site by copying the files and the necessary databases 3. Follow all the steps mentioned on the article Autodeployment using GitLab Webhooks on your staging sever with only the exception of Step 7 which needs to be modified slightly on the staging server. For the staging server that command would change to [crayon-59e6ebfa4e1af963999167/] Please note we are checking out only the dev branch on the staging server. So only your changes on the dev branch will be seen on this server. 4. Add the staging webhook.php file also to the list of webhooks on GitLab for Push events as shown below This completes setting up your...
Read More

Create a WordPress staging site through shell script

Creating a wordpress staging environment requires 4 things. Here we are assuming that the staging environment is on the same server. Requirements for creating a wordpress staging environement Clone Database - Each Time Copy the code - Only the wp-content folder Edit wp-config to point to the Staging Database (single site only) plus the Staging Domain (multisite) - Once Only Update the wp-options table with the Staging Domain (single site), Update the wp_blogs, wp_site, wp_options, wp_1_options, etc tables with the Staging Domain (multisite) - Each Time So how to to achive creating a wordpress staging environement with a single script? Here are the steps. Step 1: Create staging.sh and define variables Create a file named staging.sh inside a directory named staging (preferably outside your public_html folder) Define all the variables related to your production and staging database connection as shown below [crayon-59e6ebfa4eaed884853205/] Step 2: MySQL Dump of the Production database Add below code to staging.sh file to get MySQL Dump of the current production database [crayon-59e6ebfa4eaf7616843356/] Step 3: Export the Database to the Staging database Again...
Read More