mixd / packerwp
Deploy a traditional WordPress installation on a target environment using Deployer
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 1 948
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 5
Forks: 2
Open Issues: 8
Requires
- php: >=7.3
Suggests
- deployer/deployer: Deployer binary to make use of the 'dep' commands
- johnpbloch/wordpress: Allows you to install WordPress using Composer
This package is auto-updated.
Last update: 2024-10-25 20:48:27 UTC
README
Built by Mixd
PackerWP is a custom Deployer runbook. It was designed as the successor to the legacy Ruby deployment tool WP Deploy and has been tailored to include all the Capistrano tasks that were previously provided by WP Deploy.
Available tasks
This tool has been designed around Mixd's NHS Framework though should be portable enough to drop into any other WordPress-based project.
Starting a new project
To get started, you'll need to install PackerWP into your project using composer
$ composer require mixd/packerwp
With PackerWP now installed, you should make sure you have the Deployer binary installed to your local system to make it easier to run commands.
$ curl -LO https://deployer.org/deployer.phar
$ mv deployer.phar /usr/local/bin/dep
$ chmod +x /usr/local/bin/dep
Setting up
PackerWP uses a deploy.json
file in the root of your project to define all of the environment config.
Run cp ./vendor/mixd/packerwp/config/deploy.example.json ./deploy.json
to get a copy of the accepted config rules added to the root of your project.
Go ahead and start populating it.
Now, add a symbolic link to the root of the project to link up the custom Deployer tasks. ln -s vendor/mixd/packerwp/deploy.php
.
You should now be able to run dep
and see a list of all the available tasks.
Tasks
Initial WordPress Installation
Once you have your environment set up, you can install WordPress by running
$ dep setup-local-wp
This task will generate a wp-config.php for you and place it in the project root, then it will run the WordPress installation, reset the WordPress Salts and present you with the new admin password and a link to the WordPress Admin.
If you need to re-roll the admin password, you can reset it at anytime by running
$ dep reset-admin-pwd [stage]
if you omit
[stage]
you will reset the password for the local environment, otherwise you can supplystaging
orproduction
appropriately.Note: This task will also re-roll the WordPress salts.
Working with databases
Occasionally you may wish to push or pull your MySQL Database to a specific environment.
Ensure that you have populated the wp_home_url
and db_$
entries in your deploy.json
for your target environment.
To download a copy of the database from a remote host and import it into your local environment you can run:
$ dep pull-remote-db [stage]
To upload your local database and import it into the remote host you can run:
$ dep push-local-db [stage]
Both the
pull
andpush
tasks will handle searching and replacing the necessary URLs to convert fromlocal
to[stage]
or from[stage]
tolocal
.
If you wish to simply make a backup without importing or replacements, you can run:
$ dep backup-remote-db
or
$ dep backup-local-db
each of these tasks will make a MySQL Backup using wp db export
and gzip it into a db_backups
folder in the project root.
Working with uploaded media
To download the WordPress upload folder from a remote host run:
$ dep pull-remote-uploads [stage]
To upload your local WordPress upload folder to a remote host run:
$ dep push-local-uploads [stage]
Deployment
If you're ready to deploy your work to a remote host, simply run:
$ dep deploy [stage]
By default, PackerWP is configured to name every release using PHP's
date function in the following format Ymd
.
Templates
PackerWP also supports wp-config.php extras. If you want to override the WP Config extras that get added during the dep setup-wp
task then do the following:
Create the templates folder: mkdir ./templates/
Copy the bundled WP Extras file: cp vendor/mixd/packerwp/config/templates/extras.php ./templates/extras.php
Now you can edit the extras file. Be sure to commit and push this file to Github so it persists for other developers.
Contributing
If you'd like to request changes or additional tasks we encourage you to create a Pull Request on the Github repo.