You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Did a large refactor of paths (release_path, current_path, document_root)
6
+
- Provide two [recipes](#recipes) (base and advanced) and examples for both
7
+
- v2.0.0 did not work with symlink deployments, this now works again (see #8)
8
+
- Updated from Deployer 7.2 to 7.3
9
+
- New config options (see `set.php`):
10
+
-`wp/configFiles` for wp-config/wp-config-local files which should be protected by more restrict file permissions
11
+
-`wp/configFiles/permissions` for the chmod permissions to apply to the configFiles
12
+
- Removed `document_root` - use `release_or_current_path` instead
13
+
- New/changed task names:
14
+
-`push_code` now is called `update_code` again for parity with PHPDeployer.
15
+
16
+
**Upgrading:**
17
+
- If you haven't upgraded to v2.0.0 yet, it's best to upgrade to 3.0.0 directly
18
+
- Have a look at the example files. Your deploy.php will get much smaller and require less configuration.
19
+
- Also the new version is more smiliar to PHPDeployers default common recipe.
20
+
21
+
## v2.0.0
22
+
23
+
- Updated from Deployer 6.x to 7.x
24
+
See [docs](https://deployer.org/docs/7.x/UPGRADE#upgrade-from-6x-to-7x) for more information.
25
+
Most notable changes:
26
+
- New format for yml-files which can now also include configuration.
27
+
- The `local` is not available any more. Instead `once` and `runLocally` should be used. For theme assets the example uses a function callback and the `on` helper to optionally run those build tasks on the local host.
28
+
- When deploying you can't select a host by name or stage anymore. Instead you have to use labels (eg a `stage` label). If you've used `dep deploy production` you now have to use `dep deploy stage=production` and set the stage label in your yml file.
29
+
- Switched to a single base recipe which can be included and built upon. See `examples/deploy.php`.
30
+
- The new recipe and examples uses yml-files for project-specific configuration so the `deploy.php` is a dropin file and has no configuration in it.
31
+
- PHP 8 compatibility.
32
+
- Fixes issues with rsync flags/options and `'`.
33
+
34
+
**Upgrading:**
35
+
If you've used the default recipe it's probably easiest to copy the new example `deploy.php` and update your yml-file with project-specific configuration. If you have added any other tasks/features to your `deploy.php` make sure you upgrade them too.
36
+
If you've used most of the core functions of this library or just the examples, the upgrade should only take a few minutes.
1. Run `composer require gaambo/deployer-wordpress --dev` in your root directory
40
-
2. Choose one of the [recipes](#recipes) and copy the corresponding recipe file (`deploy*.php`) and example host file (`hosts*.example.yml`) from `recipes` into your root directory - **or** write your own.
37
+
2. Choose one of the [recipes](#recipes) and copy the corresponding example files (`examples/base` or `examples/advanced`) into your root directory - **or** write your own.
41
38
3. Read through the recipe and customize it to your needs - here's a checklist:
42
39
-[ ] Check localhost configuration
43
40
-[ ] Set paths to your directory structure
44
41
-[ ] If you have a custom theme set it's name - if not remove the configuration and the theme build-tasks
45
42
-[ ] If you have a custom mu-plugin set it's name - if not remove the configuration and the mu-plugin build-tasks
46
43
-[ ] Check if the deployment flow meets your needs and maybe delete/add/overwrite tasks
47
-
4. Make your remote hosts ready for deployment (install composer, WP CLI; setup paths,...)
44
+
4. Make your remote hosts ready for deployment (install composer, WP CLI; setup paths,...). Allthough the library checks for most of them and installs them.
48
45
5. Make a **test deployment** to a test/staging server. Do not directly deploy to your production site, you may break it.
49
46
6. Develop, deploy and be happy :)
50
47
@@ -70,13 +67,11 @@ Some tasks have additional requirements, eg:
70
67
All tasks are documented and describe which options/variables need to be configured. `set.php` is included in all example recipes - This and the example recipes should have you covered regarding all required configurations. Further variables which need to be set by you are marked accordingly in the recipes.
71
68
72
69
To help understand all the configurations here are the thoughts behind theme:
73
-
The tasks are built to work with any kind of WordPress setup (vanilla, composer, subdirectory,..) - therefore all paths and directorys are configurable via variables. `set.php` contains some sane defaults which makes all tasks wort out of the box with a default installation.
70
+
The tasks are built to work with any kind of WordPress setup (vanilla, composer, subdirectory,..) - therefore all paths and directorys are configurable via variables. `set.php` contains some sane defaults which makes all tasks work out of the box with a default installation.
74
71
75
72
### Default Directory Structure
76
73
77
-
The defaults assume you've got everything in your root project directory. Which means `deploy.php` is located in the same directory which serves as document root and in this document root WordPress is installed with it's default directory structure (themes, plugins, uploads under `wp-content`).
78
-
79
-
My [Vanilla WordPress Boilerplate](https://github.com/gaambo/vanilla-wp/) puts the document root into a `public` subdirectory of the root directory. So it updates the paths on localhost to point to the public directory. You can find a example configuration in the GitHub repository.
74
+
My [Vanilla WordPress Boilerplate](https://github.com/gaambo/vanilla-wp/) uses this library. You can find a example configuration in the GitHub repository.
80
75
81
76
### wp-config.php
82
77
@@ -110,7 +105,7 @@ This prevents any development files/development tools from syncing. I strongly r
110
105
## Tasks
111
106
112
107
All tasks reside in the `src/tasks` directory and are documented well. Here's a summary of all tasks - for details (eg required variables/config) see their source.
113
-
You can also run `dep --list` to see all available tasks and their description.
108
+
You can also run `dep list` to see all available tasks and their description.
114
109
115
110
### Database Tasks (`tasks/database.php`)
116
111
@@ -178,17 +173,7 @@ You can also run `dep --list` to see all available tasks and their description.
178
173
Handling and installing the WP-CLI binary can be done in one of multiple ways:
179
174
180
175
1. The default `bin/wp` in `set.php` checks for a usable WP-CLI binary and if none is found it downloads and installs it to `{{deploy_path}}/.dep/wp-cli.phar` (this path is checked in the future as well).
181
-
2. If you want this behaviour (check if installed, else install) but in another path, overwrite the `bin/wp` variable with a function:
This would install the WP-CLI binary into `/usr/local/bin` with sudo, since this path is probably in $PATH it's found via `getWPCLIBinary` the next time.
191
-
176
+
2. If you want this behaviour (check if installed, else install) but in another path, overwrite the `bin/wp` variable with a function and change the path it should be installed to.
192
177
3. Set the `bin/wp` variable path on the host configuration, if WP-CLI is already installed.
193
178
4. Install the WP-CLI binary manually with the `wp:install-wpcli` task and set the path as `/bin/wp` afterwards.
194
179
You can pass the installPath, binaryFile and sudo usage via CLI:
@@ -198,45 +183,21 @@ See [original PR](https://github.com/gaambo/deployer-wordpress/pull/5) for more
198
183
199
184
There's a task for downloading core and `--info`. You can generate your own tasks to handle other WP-CLI commands, there's a util function `Gaambo\DeployerWordpress\Utils\WPCLI\runCommand` (`src/utils/wp-cli.php`);
200
185
201
-
### Simple Tasks (`tasks/simple.php`)
202
-
203
-
- Contains some overwrites of Deployer default `deploy:*` tasks to be used in a "simple" recipe without release paths. See [Simple Recipe](#simple)
204
-
205
-
If you want to include only some tasks/files you can require them via `require_once 'tasks/{task}.php';` because the `autoload.php` adds the `tasks` directory to the include path (similar to deployer). Please check you have your `vendor/autoload.php` loaded as well.
206
-
207
186
## Recipes
208
187
209
-
Deployer WordPress ships with some recipes which handle most of my use cases/WordPress setup types. Just copy the contents of the corresponding recipe file (`deploy*.php`) and example host file (`hosts*.example.yml`) from `recipes` into your root directory (and maybe rename the recipe to `deploy.php`). See [the installation checklist](#installation) for a quick checklist of settings to change. All recipes have some special configurations which are documented well in each file. Configuration details, thoughts behind it, use cases and more information are listed below for each recipe.
210
-
211
-
### Default aka Vanilla - `deploy.php`
212
-
213
-
Used for standard aka default aka vanilla deployments. By default it assumes the document root and WordPress are located in the same directory as your `deploy.php` (aka the root directory of your project). But all paths can be configured (see `set.php`).
214
-
The recipe contains tasks for building assets for your custom theme, installing the vendors of your custom theme and installing the vendors of your custom mu-plugin (eg site-specific/core-functionality plugin).
215
-
216
-
The deployment flow is based on the default [Deployer flow](https://deployer.org/docs/flow.html) and assumes a default Deployer directory structure on the remote host.
217
-
By default this recipes overwrites the `deploy:update_code` Deployer task with a `deploy:push_code` task to deploy code via rsync instead of git - but you can change that by removing the overwrite. Or you can edit the task to just sync themes (`themes:push`) and mu-plugins (`mu-plugins:push`).
218
-
219
-
#### Custom Theme
220
-
221
-
Set custom theme name (= directory) in variable `theme/name`.
222
-
By default it runs `theme:assets:vendors` and `theme:assets:build` locally and just pushes the built/dist files to the server (--> no need to install Node.js/npm on server). The `theme:assets` task (which groups the two tasks above) is hooked into _before_ `deploy:push_code`.
223
-
224
-
Installing PHP/composer vendors/dependencies is done on the server. The `theme:vendors` task is therefore hooked into _after_ `deploy:push_code`.
225
-
226
-
#### Custom MU-Plugin
227
-
228
-
Set custom mu-plugin name (=directory) in variable `mu-plugin/name`.
229
-
Installing PHP/composer vendors/dependencies is done on the server. The `mu-plugin:vendors` task is therefore hooked into _after_ `deploy:push_code`.
188
+
Deployer WordPress ships with two base recipes which handle my use cases.
189
+
Both recipes are based on the default PHPDeployer common recipe and have their own recipe file which you can include in your `deploy.php` as a start. The examples folder provides examples for each recipe.
190
+
Both recipes log the deployed versions in PHPDeployers default format (`.dep` folder).
191
+
Both recipes overwrites the `deploy:update_code` Deployer task with a `deploy:update_code` task to deploy code via rsync instead of git
230
192
231
-
### Simple - `deploy-simple.php`
193
+
### Base
232
194
233
-
A simple task for deploying WordPress Sites on shared hosting via rsync.
234
-
This is especially useful in case you can't put directories outside of the document root on your hosting or you don't want (for any reason) atomic deploys.
195
+
This is for WordPress sites where you don't need symlinking per version or atomic releases. This means that on your remote/production host you just have on folder which contains all of WordPress files and this is served by your web server.
196
+
Since this is still based on the default PHPDeployer recipe which uses symlinking and to provide compatibility with all tasks, this just hardcodes the `release_path` and `current_path`.
235
197
236
-
The deployment flow is based on the default [Deployer flow](https://deployer.org/docs/flow.html) but overwrites/removes some of the default `deploy:*` tasks to not create handle release directories, symlinks etc.
237
-
By default this recipes overwrites the `deploy:update_code` Deployer task with a `deploy:push_code` task to deploy code via rsync instead of git - but you can change that by removing the overwrite. Or you can edit the task to just sync themes (`themes:push`) and mu-plugins (`mu-plugins:push`).
198
+
### Advanced
238
199
239
-
An important configuration step is to set **deploy_path**, **release_path** and **document_root** on each remote host to the same directory. This way all tasks work as usual and don't require any changes.
200
+
This uses symlinking like the default common recipe from PHPDeployer. Each release gets deployed in its own folder unter `{{deploy_path}}/releases/` and `{{deploy_path}}/current` is a symlink to the most current version. The symlink is automatically updated after the deployment finishes successfully. You can configure your webserver to just server `{{deploy_path}}/current`.
240
201
241
202
#### Custom Theme
242
203
@@ -252,28 +213,20 @@ Installing PHP/composer vendors/dependencies is done on the server. The `mu-plug
252
213
253
214
## Changelog
254
215
255
-
### v2.0.0
256
-
257
-
- Updated from Deployer 6.x to 7.x
258
-
See [docs](https://deployer.org/docs/7.x/UPGRADE#upgrade-from-6x-to-7x) for more information.
259
-
Most notable changes:
260
-
- New format for yml-files which can now also include configuration.
261
-
- The `local` is not available any more. Instead `once` and `runLocally` should be used. For theme assets the example uses a function callback and the `on` helper to optionally run those build tasks on the local host.
262
-
- When deploying you can't select a host by name or stage anymore. Instead you have to use labels (eg a `stage` label). If you've used `dep deploy production` you now have to use `dep deploy stage=production` and set the stage label in your yml file.
263
-
- Switched to a single base recipe which can be included and built upon. See `examples/deploy.php`.
264
-
- The new recipe and examples uses yml-files for project-specific configuration so the `deploy.php` is a dropin file and has no configuration in it.
265
-
- PHP 8 compatibility.
266
-
- Fixes issues with rsync flags/options and `'`.
267
-
268
-
**Upgrading:**
269
-
If you've used the default recipe it's probably easiest to copy the new example `deploy.php` and update your yml-file with project-specific configuration. If you have added any other tasks/features to your `deploy.php` make sure you upgrade them too.
270
-
If you've used most of the core functions of this library or just the examples, the upgrade should only take a few minutes.
216
+
See [CHANGELOG.md](CHANGELOG.md).
271
217
272
218
## Contributing
273
219
274
220
If you have feature requests, find bugs or need help just open an issue on [GitHub](https://github.com/gaambo/deployer-wordpress).
275
221
Pull requests are always welcome. PSR2 coding standard are used and I try to adhere to Deployer best-practices.
276
222
223
+
### Testing
224
+
225
+
1. Download my [Vanilla WordPress Boilerplate](https://github.com/gaambo/vanilla-wp/) or set up a local dev environment with a deploy config
226
+
2. Setup a remote test server
227
+
3. Configure yml/deploy.php
228
+
4. Run common tasks (`deploy`, `plugins:pull/push`, `db`) for both base as well as advanced recipe
229
+
277
230
## Built by
278
231
279
232
[Gaambo](https://github.com/gaambo) and [Contributors](https://github.com/gaambo/deployer-wordpress/graphs/contributors)
0 commit comments