-
Notifications
You must be signed in to change notification settings - Fork 24
Upgrading
Matthew Orres edited this page Aug 23, 2019
·
10 revisions
Seamlessly deploy new versions of PHPDraft using Deployer.
Server requirements can be found in the install instructions (Yarn, Node, etc.)
- Download the latest release from the project releases page, extract it to a temporary local folder
- Open a terminal window and navigate to the temporary local folder.
- Note here that every call to the Deployer binary (
vendor/bin/dep
) will includelocal
at the end. This corresponds to the value specified in yourdeploy.php
file forstage
. If you never changed this, continue usinglocal
, but if you have multiple environments you deploy to, you may find it helpful as an extra check before you accidentally deploy the wrong settings to the wrong environment.
- Note here that every call to the Deployer binary (
- Run
vendor/bin/dep import local
and provide the settings importer with the location of your settings backup.- Alternatively, if you have no settings backup you should run the PHP Draft setup wizard by running
vendor/bin/dep setup local
. After completing the wizard, it is recommended you back your settings up by runningvendor/bin/dep backup local
- Pay attention to changelogs and release notes when upgrading. Occasionally, you will need to re-run the setup wizard in order to generate new settings as breaking changes occasionally make their way into these files. As a rule, I will always bump up the minor version number (the middle one) when new settings must be generated, but updates to the patch number (the last one) will suggest you needn't update them.
- Alternatively, if you have no settings backup you should run the PHP Draft setup wizard by running
- Run
vendor/bin/dep deploy local
to begin the deployment process. - Optional: If using php-fpm, you will need to restart the service as the deployment process uses symlinks, and PHP will still be using the previous release of code.
- Important! Be sure to wipe your browser's cache before reloading your install (in Chrome, open the Developer Tools, then you can right click on the Refresh button and select "Empty Cache and Hard Reload") and verify that the upgrade worked before finishing.
In addition to adding Deployer deployments, version 2.2 also added Phinx database migrations in favor of hand-coded SQL files. Now, database updates are done automatically via the deployment process for a cleaner, more consistent deployment experience.
- Back up your site database and files so that in the event that something goes wrong, you can restore PHP Draft.
- Download the latest release from the project releases page, extract it to a temporary local folder
- First, prepare your webserver to point to a symlink called
current
from within the current base directory. If your site is currently being served from/var/www/example.com/html
, move all of that code into a folder called/var/www/example.com/html/releases/0
and create a symbolic linkcurrent
that points to the0
folder (so/var/www/example.com/html/current
). - Ensure your webserver correctly serves and runs PHP Draft with the symlink in place before continuing.
- Also ensure that the current user on the computer you intend to publish upgrades from has an SSH key setup with the web server that your current instance of PHP Draft runs on. Deployer utilizes SSH tunnels to connect and upload files as well as run scripts such as Phinx to update the database with any changes. Need help? Follow this guide to generate an SSH key and install it on your webserver.
- Next, grab the
/db/scripts/2.1_to_2.2_Upgrade.sql
script and run it against your PHP Draft database. In addition to changing charsets over toutf8
, this also adds the necessary Phinx table to track database changes in the future. - Open a terminal window and navigate to the temporary local folder (see above).
- Run the PHP Draft setup wizard by running
vendor/bin/dep setup local
. After completing the wizard, it is recommended you back your settings up by runningvendor/bin/dep backup local
- Run
vendor/bin/dep deploy local
to begin the deployment process. - Optional: If using php-fpm, you will need to restart the service as the deployment process uses symlinks, and PHP will still be using the previous release of code.