Skip to content

Deploy Laravel, PHP upgrade #294

@carlschroedl

Description

@carlschroedl

Local Verification

I spun up a Homestead VM and verified that a local Pivot installation using the master branch (PHP 7.2.34, Laravel 5), can be safely updated to Oliver's branch (PHP 8.1.3, Laravel 9) without data loss, or regressions, as long as we remember to update the name of the env var that configures the mail driver. Details in Upgrade Outline.

Limitations of verification:

A. I did NOT test with Apache httpd -- I used Laravel's built-in development-grade HTTP server
B. I did NOT attempt to use a MySQL version that matches what is currently on the production server -- my local tests used MySQL 8.0.28 for both the old version and the upgraded version of Pivot.
C. I only verified the migration of one test election. The election had 3 candidates, 1 regular voter (the election creator), and two proxy voters (both emails were the election creator).

All that said, I think it is reasonable to proceed -- risks arising from disparities between the dev and prod environment can be mitigated by snapshotting the VM, and/or backing up the database.

Upgrade Outline

  1. Take snapshot of VM and/or make backup of MySQL database
  2. Upgrade PHP to version 8.1
  3. Rename mail env var from MAIL_DRIVER to MAIL_MAILER.
$ sed -i 's/MAIL_DRIVER/MAIL_MAILER/' .env
  1. Merge Upgrade to Laravel 9 #292
    Buildkite should pick up from there and take care of the rest

Troubleshooting

  • Install new dependencies, automatically regenerate caches
$ php composer install --no-interaction
...
(Installs a bunch of packages)
...
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
Configuration cache cleared successfully.
Configuration cached successfully.
Route cache cleared successfully.
Routes cached successfully.
Files cached successfully.
  • Manually regenerate caches
$ php artisan optimize

Related to #292
Related to #293

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions