Up until this feature was introduced in WPCD 4.16.2, you could only make use of your custom bash scripts either by:
With this feature you now have a third option for the most common use case – running commands at the end of the server provisioning and site provisioning processes.
First you need a place where you can create a publicly accessible text file using a standard https url. For example, the RAW version of gists.
Create a file with the bash commands you need to run.
Then, set the link in the WPCLOUDDEPLOY -> SETTINGS -> APP:WORDPRESS -> CUSTOM SCRIPTS tab.
You can create simple text files and make them available at a public link with bash commands.
For new servers, you can:
For new sites that do the following:
Your scripts will have access to the full complement of variables – which means that there is a lot of you can do without having to customize WPCD code directly. The above are just some ideas.
Here is an example of a post-processing script you can use on a site to install two plugins from the wordpress.org plugin repository:
So, you have a situation where you need to access a private github repository or maybe you want to add your plugin license key to new site installs. Since you should not place private data into public scripts, you need to make use of a secrets manager. The one we’ve used is called doppler.com but you can use any you like, as long as the following two requirements are met:
You can enter your api token in the SECRETS MANAGER API KEY field (see image earlier in this document). Then, that value will be available in the bash environment variable: $secret_key_manager_api_key
With this key, you should then be able to pull in all your other keys directly from your secrets manager.
You can use a secret GIST for your post-processing scripts. There are two caveats to be aware of:
There are, of course some caveats you must be aware of.
From a security perspective, if your remote link is compromised, so will any new servers or sites you provision.
Additionally, this feature is only useful if you do not need to set state data using post-metas in the WPCD plugin. Scripts you run using this method have no way of writing data back to WPCD without a custom add-on.
Need post-processing scripts for other functions? Let us know your use case and we’ll try out best to make it happen!