Skip to content

Latest commit

 

History

History
 
 

wordpress

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Wordpress Scripts

A compilation of scripts that can be used for automating common Wordpress tasks.

🖼 Create a New Site

Prerequisites

What does this do?

Installs a fresh version of Wordpress with the following:

Usage

Whilst SSH'd into the Docker php81 container (docker exec -it php81 bash), browsed to /var/www/html, simply run:

bash <(curl -s https://raw.githubusercontent.com/pvtl/scripts/master/wordpress/create.sh -L)

🚀 Deploy a Site to production

Prerequisites

  • Unix
  • Git
  • PHP
  • MySQL
  • Composer
  • Access to https://github.com/pvtl/deploy-script.git (it'll prompt you for a password, which is a Github personal access token)
  • Access to the Git repo you're wanting to clone
  • The domain name you'll be using for the site, must be live and propagated (i.e. for the script to be able to reach it via a CURL request). To get around this, you could either:
    • Add the domain to the server's host file (eg. 127.0.0.1 example.com)
    • Point another 'disposable' (eg. justfordeploy.pvtl.io) domain to it for setup, then once deployed, change the domain name in deploy.json and .env

What does this do?

In the past, deploying a Wordpress site typically requires:

  1. Finding, downloading, connecting to FTP, uploading, configuring deploy.php and the deploy.json config
  2. Next, through the browser, filling out/submitting deploy.php
  3. Next Stage & deploy
  4. Next, through FTP, create, upload, configure a .env (and go to another site to generate WP Secrets custom to this site)
  5. Next, through FTP, create, upload, configure a .htaccess

This script does all of the below with a single command:

  • In a single place, provides step-by-step prompts for the required information
  • Grabs the deploy.php script from Git (placing it on the server)
  • Grabs the deploy.wordpress.json (placing it on the server)
  • Automatically (using user input) sets up the deploy script & deploys
  • Configures Wordpress:
    • Database credentials and URL
    • Generates WP secrets/keys/salts
    • A default .htaccess for permalinks
  • Sorts out file ownership

Usage

SSH into the destination server and change to the correct user (sudo su - -s /bin/bash <cPanel username>) Run this command from the directory immediately above the publicly accessible web root (i.e. the directory containing public_html)

curl https://raw.githubusercontent.com/pvtl/scripts/master/wordpress/deploy.sh --output wordpress-deploy.sh && bash wordpress-deploy.sh && rm wordpress-deploy.sh

Note Run this command for any subdomains before running for the home directory to avoid issues with deployments


👷‍♂️ Setup the site locally

Prerequisites

What does this do?

Setting up a site on your local machine takes time. What if it could be done through a (almost) single command?

This script does all of the below with a single command:

  • In a single place, provides step-by-step prompts for the required information
  • Creates a directory and Clones the repo into it
  • Automatically installs PHP (composer) and build (npm) dependencies
  • Symlinks the correct directories
  • Configures Wordpress:
    • Database credentials and URL
    • Generates WP secrets/keys/salts
    • A default .htaccess for permalinks

Usage

Whilst SSH'd into the Docker php81 container (docker exec -it php81 bash), browsed to /var/www/html, simply run:

bash <(curl -s https://raw.githubusercontent.com/pvtl/scripts/master/wordpress/setup.sh -L)

🔦 Stage on Dev Server

Prerequisites

  • Unix
  • Git
  • Node, NPM & Yarn
  • PHP
  • MySQL
  • Composer

What does this do?

Setting up a site for staging does take time. What if it could be done through a (almost) single command?

This script does all of the below with a single command:

  • In a single place, provides step-by-step prompts for the required information
  • Creates a directory and Clones the repo into it
  • Automatically installs PHP (composer) and build (npm) dependencies
  • Symlinks the correct directories
  • Configures Wordpress:
    • Database credentials and URL
    • Generates WP secrets/keys/salts
    • A default .htaccess for permalinks
  • Downloads and sets up the stage.php script

Usage

Whilst SSH'd into the Dev Server, php71 container (sudo docker exec -it services_php71-fpm_1 bash), browsed to /var/www/html, simply run:

bash <(curl -s https://raw.githubusercontent.com/pvtl/scripts/master/wordpress/setup.sh -L) -s

🔭 Converting a Standard WP site to Bedrock (for Git Tracking)

Prerequisites

  • Unix

What does this do?

Converting a traditional (out of the box) Wordpress site to Bedrock for Git tracking can be tedious. This script simply analyses a Wordpress directory and outputs a list of all of the plugins, themes & uploads, and gives guidance on how to handle each

Usage

Whilst SSH'd into the Docker php80 container (docker exec -it php80 bash), browsed to /var/www/html, simply run:

bash <(curl -s https://raw.githubusercontent.com/pvtl/scripts/master/wordpress/git-conversion.sh -L) -s