Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 2.63 KB

README.md

File metadata and controls

45 lines (35 loc) · 2.63 KB

Wordpress deploy script

Automated script to import or deploy Wordpress website in SSH This is based on the Grafikart tutorial : https://www.grafikart.fr/tutoriels/ssh-deploy-wordpress-1060 (thanks!)

Prerequisites

Works only on MacOS or Linux, to make it work on windows you can try those methods (not tested) : https://stackoverflow.com/questions/2532234/how-to-run-a-makefile-in-windows This is the script I use on my OVH shared hosting (pro plan minimum to have SSH access). You have to enable SSH on your hosting, for OVH hosting plan, follow this tutorial :

Getting Started

  1. Copy this Makefile in your local Wordpress directory

  2. Install wp-cli locally (https://wp-cli.org/) to have it works with the wp command.

  3. Install wp-cli on your server, the method I use is the following one :

    • upload the wp-cli.phar file in a _scripts/ folder on your server (I put it in the root directory so I use the same for all the projects)
  4. Copy this Makefile in the root directory of your local Wordpress installation

  5. Replaces the variables in the envfile with your own :

    • phplive=/usr/local/php5.6/bin/php ## Server php path (this example works for OVH pro shared hosting plan)
    • wpclilive=/homez.xxx/xxxxxxxxxx/_scripts/wp-cli.phar ## (to kown this full path you can connect to your server in SSH with the terminal and type the command pwd)
    • path=~/www/websites/mywebsite/ ## path of your project on the server
    • [email protected] ## SSH credentials
    • livedomain=http://www.domain.com ## live URL
    • localdomain=http://localhost/example ## local URL
  6. Create a database on your OVH

  7. Copy the local files on your server, and configure the wp-config.php correctly to connect to your database

Add your SSH key to the server to avoid typing your password every time

Create a .ssh key on your local computer : https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ Create a .ssh key on your OVH server : https://docs.ovh.com/fr/public-cloud/creation-des-cles-ssh/ On the server in the /.ssh/ folder add a authorized_keys file and add your local SSH public key in it : https://timleland.com/copy-ssh-key-to-clipboard/

Available tasks

make help in you terminal to see all available commands Run make import Import all files from server Run make deploy Deploy files to the server Run make dbdeploy Send the database and replace the URLs Run make dbimport Get the database from the server and replace the URLs Run make update Update local Wordpress core and plugins