๐Ÿ‡
Speedtest Tracker
  • Introduction
  • Features
  • Changelog
  • ๐Ÿš€Getting Started
    • Installation
      • Using Docker Compose
      • Using Docker
      • Using Kubernetes
      • Using QNAP
      • Using Synology
      • Using Unraid
    • Environment Variables
    • Database Drivers
  • ๐Ÿ†˜Help
    • Error Messages
    • Frequently Asked Questions
  • ๐Ÿ”‘Security
    • Authentication
    • Authorization
    • Encryption
  • โš™๏ธSettings
    • Data Integrations
      • InfluxDB v2
    • Notifications
      • Database
      • Mail
      • Webhook
  • ๐Ÿ‘€Other
    • Speedtest Process
    • Proxies
      • Cloudflare Tunnel (Zero Trust)
      • Traefik
      • Tailscale
    • Caching
    • Commands
    • Data Dictionary
    • Embed Dashboard
    • Health Check
    • Community Projects
  • ๐Ÿ–ฅ๏ธAPI
    • Authorization
    • Responses
      • Results
      • Speedtests
      • Servers
      • Stats
      • Models
  • ๐ŸคนContributing
    • Development Environment
  • ๐Ÿ”—More
    • Source Code
    • Releases
    • Update the Docs
    • About Me
    • Donate
Powered by GitBook
On this page
  • Setup and Start the Development Environment
  • Reset your development environment
  • Processing Jobs in the Queue using a Worker
  • Lint your code before opening a PR or committing changes
  • Stopping the development environment
Edit on GitHub
  1. Contributing

Development Environment

Create a containerized development environment so you can build, test and contribute to Speedtest Tracker.

PreviousModels

Last updated 2 months ago

Speedtest Tracker is built on the framework, this means we get to use some awesome 1st party packages like 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 and on "Laravel from Scratch" are a good place to start.


Setup and Start the Development Environment

1. Clone the repository

First let's clone the to your machine, I prefer 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 will copy and fill in the following Environment Variables

APP_NAME="Speedtest Tracker"
APP_ENV=local
APP_KEY=
APP_DEBUG=false
APP_TIMEZONE=UTC

Generate the APP_KEY at with the command; echo -n 'base64:'; openssl rand -base64 32;

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/php83-composer:latest \
    composer install --ignore-platform-reqs

4. Build Sail development container

./vendor/bin/sail build --no-cache

# or if you have a Sail alias setup...
sail build --no-cache

5. Start the development environment

To start up the environment we can now use the Sail binary that is included with the package to start our development environment.

./vendor/bin/sail up -d

# or if you have a Sail alias setup...
sail up -d

6. Create the database

To start up the environment we need to make a database

touch database/database.sqlite

As well need to make the needed tables etc in the database.

./vendor/bin/sail artisan migrate:fresh --force

# or if you have a Sail alias setup...
sail artisan migrate:fresh --force

7. Installing NPM assets

We will need to install the needed NPM assets

./vendor/bin/sail npm install && ./vendor/bin/sail npm run build

# or if you have a Sail alias setup...
sail npm install && sail npm run build

Reset your development environment

You can reset your development environment at any time by re-running a fresh migration:

./vendor/bin/sail artisan migrate:fresh --force

# or if you have a Sail alias setup...
sail artisan migrate:fresh --force

Processing Jobs in the Queue using a Worker

Processes like running a speedtest and sending notifications are offloaded to be run by a worker process. If you're testing or developing anything requiring the queue jobs be processed run the command below.

./vendor/bin/sail artisan queue:work

# or if you have a Sail alias setup...
sail artisan queue:work

Lint your code before opening a PR or committing changes

To keep PHP's code style consistent across multiple contributors a successful lint workflow is required to pass. Check your code quality locally by running the command below and fixing it's recommendations.

./vendor/bin/sail bin duster lint --using=pint -v

# or if you have a Sail alias setup...
sail bin duster lint --using=pint -v

Stopping the development environment

When you're done in the environment you can stop the containers using the command below.

./vendor/bin/sail down

# or if you have a Sail alias setup...
sail down

We utilize for a local development environment this way on your machine the only requirements are Git and Docker. To build the development environment run the commands below.

๐Ÿคน
Laravel
Laravel Sail
Laravel Docs
Laracasts series
repository
GitHub's CLI
Laravel Sail