Wallogit.com
2017 © Pedro Peláez
Wordpress deployer recipes
For the record, those recipes was written using a personal Wordpress stack based on Bedrock (Thanks to the great roots.io team), using phpdotenv package. But it can be used in many other configuration ., (*1)
Make sure to include recipe files in your deploy.php:, (*2)
require 'vendor/cstaelen/deployer-wp-recipes/recipes/assets.php'; require 'vendor/cstaelen/deployer-wp-recipes/recipes/cleanup.php'; require 'vendor/cstaelen/deployer-wp-recipes/recipes/db.php'; require 'vendor/cstaelen/deployer-wp-recipes/recipes/uploads.php';
Just add those lines below in your deploy.php with your own values :, (*3)
set('wp-recipes', [
'theme_name' => 'Your WP theme folder name',
'theme_dir' => 'path/to/your/theme/folder',
'theme_dist' => 'theme_release', // Will be rename with theme_name
'wwwroot_dir' => 'web', //VHOST ROOT DIR
'shared_dir' => '{{deploy_path}}/shared',
'gulp_cmd' => 'gulp build',
'assets_dist' => 'path/to/theme/folder/dist',
'local_wp_url' => 'http://local.dev',
'remote_wp_url' => 'http://mywebsite.com',
'clean_after_deploy'=> [
'deploy.php',
'.gitignore',
'*.md'
]
]);
Upload your WP database : dep db:push prod
Download your WP database : dep db:pull prod
Sync WP uploads with rsync : dep uploads:sync prod, (*4)
You can also use those rules below in your deploy.php file to compile and deploy assets and cleanup some useless files on your staging/production server :, (*5)
after('deploy', 'deploy:assets');
after('deploy', 'deploy:cleanup');
If you are using phpdotenv to configure your servers as the awesome Bedrock Wordpress Stack do, you can use those task rules below to grab WP_HOME value filled in your .env file., (*6)
before('db:cmd:pull', 'env:uri');
before('db:cmd:push', 'env:uri');
In order to do that, we assume your local .env file is in the root project folder, and the remote one in the repo shared folder., (*7)
Make sure to leave empty those config values :, (*8)
set('wp-recipes', [
...
'local_wp_url' => '',
'remote_wp_url' => ''
...
]);