Skip to content

Instantly share code, notes, and snippets.

@DFurnes
Last active November 18, 2019 18:10
Show Gist options
  • Select an option

  • Save DFurnes/d2293c0551e3b23ad4d95b79eefb2560 to your computer and use it in GitHub Desktop.

Select an option

Save DFurnes/d2293c0551e3b23ad4d95b79eefb2560 to your computer and use it in GitHub Desktop.
Updating your Homestead, Fall 2019 edition!

Hey folks! Let's do some spring fall cleaning! πŸ‚

If you work on apps using Homestead, please set aside some time within the next few sprints to follow this upgrade guide: we want to make sure everyone's environments are up to date and as close to production as possible.

This may take up to an hour, so grab a coffee & read up on new features in PHP 7.3! β˜•

Upgrade Guide

This has been tested on macOS 10.14 (Mojave) & macOS 10.15 (Catalina).

1. Upgrade VirtualBox & Vagrant:

You're likely using VirtualBox 5.2. It's time to upgrade to VirtualBox 6!

  1. Download the VirtualBox 6.0.14 installer.
  2. Shut down your Homestead with homestead halt & run the installer.
  3. Take a moment to check if you're on the latest Vagrant and update if necessary.

2. Upgrade your Homestead:

Now, head into your Homestead directory (likely ~/Code/homestead).

Update your Homestead.yaml to install features we rely on & swap to PHP 7.3:

- mongodb: true
- mariadb: true

+ features:
+     - mongodb: true
+     - mariadb: true
+     - webdriver: true


sites:
     - map: aurora.test
       to: /home/vagrant/Code/aurora/public
-      php: "7.2"
+      php: "7.3"

     - map: northstar.test
       to: /home/vagrant/Code/northstar/public
-      php: "7.2"
+      php: "7.3"

     - map: phoenix.test
       to: /home/vagrant/Code/phoenix-next/public
-      php: "7.2"
+      php: "7.3"
     
     - map: rogue.test
       to: /home/vagrant/Code/rogue/public
-      php: "7.2"
+      php: "7.3"
       
     - map: chompy.test
       to: /home/vagrant/Code/chompy/public
-      php: "7.2"
+      php: "7.3"

Remove the override to use PHP 7.2 from your after.sh:

#!/bin/sh

# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.

- # Switch to PHP 7.2 for the default CLI.
- sudo update-alternatives --set php /usr/bin/php7.2
- sudo update-alternatives --set php-config /usr/bin/php-config7.2
- sudo update-alternatives --set phpize /usr/bin/phpize7.2

# Install New Relic agent:
sudo sh -c "echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' > /etc/apt/sources.list.d/newrelic.list"
wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
sudo apt-get update

sudo DEBIAN_FRONTEND=noninteractive apt-get -y install newrelic-php5

Then, run the following commands from your Homestead directory:

# Download the latest box, which is currently 8.2.1:
vagrant box update

# Get the latest Homestead release and re-build:
git fetch --tags && git checkout v9.3.1
cp resources/aliases aliases
vagrant destroy && vagrant up

3. Set up your local applications:

Finally, you'll want to head into each application and update dependencies & run migrations (since we just rebuilt our box). Finally, let's run tests to check everything's working!

composer install
php artisan migrate --seed
phpunit

Hopefully tests pass... if so, you're all done! Nice work! πŸŽ‰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment