Skip to content

Bash script for deploying Wordpress projects based on Roots/Bedrock & Roots/Sage to any server.

License

Notifications You must be signed in to change notification settings

trainoasis/wp-bedrock-sage-bash-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Bedrock/Sage bash deploy script

Bash script for deploying Wordpress projects based on Roots/Bedrock & Roots/Sage to any server.

Tested on: Sage 9, on OS X system.

How it works

To understand what the script does, it's best to check the script itself.

But to get the basic idea, these are the main pseudo-code steps (also the actual functions called in the script, if you check the bottom part of the deploy.sh)

1. remove_local_temp_files

removes local temporary files that might have been built using this script previously

2. git_clone_repo

clones your predefined repository

3. run_composer

runs composer 1x for Bedrock & 1x for Sage

4. run_yarn

runs yarn install & build inside predefined Sage theme

5. remove_non_production_stuff

prepares DEPLOY_TEMP folder for deployment

6. zip_temp_folder

zips the DEPLOY_TEMP folder

7. scp_temp_folder_to_server

transfers the above folder to the predefined server

8. ssh_to_server_and_do_stuff

connects to predefined server and executes commands that

  • makes a backup of the folder we are deploying to (.zip)
  • unzips our new deploy folder transfered in step 7.
  • copies uploads, languages, .env and such to our new deploy folder
  • copies over plugins but does not overwrite existing plugins (only those that are not a composer dependency)
  • copies over web/app/languages/wpml (translation .mo files generated by WPML since v.4.3.0!) - overwrites
  • removes our deploy zipped folder
  • activates maintenance mode
  • renames actual domain folder to your_domain.com_BEFORE_DEPLOY (adds "_BEFORE_DEPLOY")
  • renames our prepared deploy folder (DEPLOY_TEMP) to the name of the actual domain folder we had before
  • activates our theme and plugins, assigns menus, sets permalinks (you can disable all this if you wish, check the code)

How to use

To be able to use the script, follow these steps:

  1. Read HOW IT WORKS section above.
  2. Define VARIABLES inside deploy.sh carefully (See comments in the script itself for hints/help).
  3. Run the script
sh deploy.sh --verbose
  1. enjoy life

Want to use via Gitlab CI?

See https://github.com/trainoasis/deploy-wp-bedrock-sage-gitlab-ci for YML script.

About

Bash script for deploying Wordpress projects based on Roots/Bedrock & Roots/Sage to any server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages