Provisioning Scripts Overview

At the heart of Laravel Settler are the two main provisioning scripts: scripts/amd64.sh and scripts/arm.sh. These scripts contain the complete set of commands executed by Packer to transform a base Ubuntu installation into a fully-featured Laravel Homestead environment.

Script Responsibilities

Both scripts perform the same core function but are tailored for their respective CPU architectures (AMD64/x86_64 and ARM64). Their responsibilities include:

  1. System Initialization: Updating the package manager (apt-get), upgrading existing packages, and setting the system locale and timezone.
  2. Adding Repositories: Adding third-party Personal Package Archives (PPAs) and package sources for software like PHP (via ondrej/php), Node.js, and PostgreSQL to ensure up-to-date versions are available.
  3. Installing Core Services: Installing and configuring foundational services such as databases (MySQL, PostgreSQL), web servers (Nginx, Apache), and caching layers (Redis, Memcached).
  4. PHP Installation: Installing a comprehensive suite of PHP versions (from 5.6 to 8.3) along with their respective FPM services and a wide range of common extensions (-mysql, -curl, -gd, -zip, etc.).
  5. Language & Tooling Installation: Setting up other development languages and tools, including Node.js, Go, Composer, Docker, and Docker Compose.
  6. Configuration: Modifying configuration files (.ini, .conf) for all installed services to align with Homestead's standards. This includes setting memory limits, enabling remote access for databases, and configuring Nginx/PHP-FPM users.
  7. System Cleanup: At the end of the process, the script performs a cleanup routine to remove unnecessary packages, log files, and caches to reduce the final box size.

Build Configuration

At the top of each script, you will find a set of boolean variables that act as feature flags for the build process. These allow you to easily skip the installation of major software components.

#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive

ARCH=$(arch)

SKIP_PHP=false
SKIP_MYSQL=false
SKIP_MARIADB=true
SKIP_POSTGRESQL=false

echo "### Settler Build Configuration ###"
# ... rest of the script

By changing these values from false to true before running the Packer build, you can create a customized, lighter version of the Homestead box. See the Customizing the Build page for more details.