Setup Your Environment

Create a containerized development environment so you can build, test and contribute to Speedtest Tracker.
Speedtest Tracker is built on the Laravel framework, this means we get to use some awesome 1st party packages like Laravel Sail to create a local containerized development environment.
These directions will walk you through the steps of setting up that environment.
These directions assume you have a working knowledge of the Laravel framework. If you have questions on how to use it the Laravel Docs and Laracasts series on "Laravel from Scratch" are a good place to start.

1. Clone the repository

First let's clone the repository to your machine, I prefer GitHub's CLI so that command is included below.
gh repo clone alexjustesen/speedtest-tracker \
&& cd speedtest-tracker

2. Make a copy of `.env.example` and update DB variables

Next we need to make a copy of .env.example, the environment file is what Laravel uses.
cp .env.example .env
You'll also want to fill in a few DB_ variables here as well which will control which database Laravel will use. I've included PostgreSQL as the default database system.
DB_CONNECTION=pgsql
DB_HOST=pgsql
DB_PORT=5432
DB_DATABASE=speedtest_tracker
DB_USERNAME=sail
DB_PASSWORD=password

3. Install Composer dependencies

We'll use a temporary container to install the Composer dependencies for the application.
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs

4. Starting a development environment

To start up the environment we can now use the Sail binary that is included with the package to build our development image and spin up a network with a database container.
./vendor/bin/sail up -d
​
# or if you have a Sail alias setup..
sail up -d

5. Stopping the development environment

./vendor/bin/sail down
​
# or if you have a Sail alias setup..
sail down
Last modified 6mo ago