• Stars
    star
    234
  • Rank 171,149 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Run multiple Laravel Sail websites locally with custom domain names and https

Fleet

Latest Version on Packagist Total Downloads

Easily run multiple Laravel Sail applications at the same time locally with custom domain names.

Note: This is still new and may contain bugs, if you see something weird please create an issue

Installation

You can install the package via composer:

composer require aschmelyun/fleet --dev

Getting Started

Navigate to the root directory of your Laravel application, and stop any Sail instance if it's running. Then, use the following command to add Fleet support to your app:

php artisan fleet:add

During setup you'll be prompted to enter in a domain name. Alternatively, you can pass it in through the command line:

php artisan fleet:add my-app.localhost

After the setup finishes, you can start up Sail just like normal:

./vendor/bin/sail up

And your site will be available at the domain you provided!

Note: If you chose a domain that doesn't end in .localhost, you will need to add an entry to your hosts file to direct traffic to 127.0.0.1

Local SSL

Fleet supports local SSL on your custom domains through the power of mkcert. After you've installed it on your machine, you can use the --ssl option when using the fleet:add command to enable it for your application.

php artisan fleet:add my-app.localhost --ssl

A local certificate will be generated and stored in ~/.config/mkcert/certs. After spinning up your site with Sail, your specified domain will have https enabled.

Port Conflicts

When spinning up multiple Laravel Sail appliactions, it's likely you'll encounter an error about port conflicts between Docker containers. This is because each service has a port mapped to your local machine, and by default, they're the same across your applications.

In order to fix this, add different forwarded port numbers to each Laravel application using the .env file. For example:

  • App #1
FORWARD_DB_PORT=3306
FORWARD_REDIS_PORT=6379
  • App #2
FORWARD_DB_PORT=4306
FORWARD_REDIS_PORT=7379

This way, both applications can be spun up using Fleet and Sail, and their respective services' ports won't conflict.

Additional Usage

By default, whenever you use fleet:add, a Docker network and container are both started to handle the traffic from your local domain name(s).

You can start this manually by using:

php artisan fleet:start

If you would like to remove Fleet support from an application and return it back to the default Docker setup, you can run:

php artisan fleet:remove

To stop and remove all Fleet containers and networks that are currently running on your system, you can use the command:

php artisan fleet:stop

Why use this?

Laravel Sail uses Docker and Docker Compose to spin up containers that create a local development environment for your application.

By default, the containers are bound to the :80 port of your local machine. Spinning up a second application results in a failure due to port conflicts, but you can always adjust it so that the second app is available at something like :8081.

This can have some unintended consequences though, and can get messy juggling communication between two different applications using port numbers.

Instead, Fleet provides a small set of commands that alter your docker-compose.yml file to provide support for Traefik, a reverse proxy that runs on a Docker container.

When you add a site to Fleet, a network and a few labels are added to the Docker Compose entry for your application, and a main Traefik container is spun up to handle all local web traffic incoming to the :80 port.

This configuration allows two or more Laravel Sail applications configured to different domains to resolve to their respective running containers.

For a more in-depth look at how this all ties together, check out this video that I published on using Traefik with Docker Compose.

Changelog

Please see CHANGELOG for more information on what's recently changed.

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

docker-compose-laravel

A docker-compose workflow for local Laravel development
Dockerfile
2,305
star
2

larametrics

A self-hosted metrics and notifications platform for Laravel apps
CSS
618
star
3

subvert

Generate subtitles, summaries, and chapters from videos in seconds
PHP
550
star
4

cleaver

🔥🔪 A blazing-fast static site generator using Laravel's Blade templating engine
PHP
264
star
5

docker-compose-wordpress

A docker-compose workflow for local WordPress development
Dockerfile
203
star
6

github-receipts

Source code that powers my GitHub issues receipt printer
PHP
182
star
7

use-the-keyboard

A collection of keyboard shortcuts for Mac apps, Windows programs, and websites.
Blade
154
star
8

laravel-job-board

A modest job board platform built with Laravel. Follow along with the videos below to get an in-depth look at its development.
PHP
122
star
9

laravel-vue-stripe-cashier

A very basic ecommerce app built with Laravel, Vue, and Cashier (Stripe)
PHP
55
star
10

simple-toggle-sites

A very basic Chrome extension to quickly block or unblock a list of websites
SCSS
53
star
11

size

Simple PHP helper to convert bytes to different sizes
PHP
47
star
12

cleaver-directory

🔥📍 A blazing-fast static site generator for local directories built with PHP and Laravel's Blade
Blade
47
star
13

laravel-links

A Linktree clone built with Laravel featuring user accounts and visitor information
PHP
39
star
14

video-laravel-docker-deployment

The source behind the Docker deployment with Laravel video
PHP
36
star
15

listpal

A synchronized to-do app built with Laravel, Vue, and laravel-websockets
PHP
36
star
16

reqon

Effortlessly intercept and inspect http requests
TypeScript
29
star
17

laravel-grafana-dashboard

A simple data dashboard built with Laravel, MySQL, and Grafana, all tied together under a Docker network
PHP
28
star
18

laravel-scheduled-tasks-docker

An example set up for using Laravel's scheduled tasks with Docker
PHP
25
star
19

docker-compose-traefik

A basic example of a reverse proxy with Docker Compose and Traefik
PHP
24
star
20

andrewber

Final source code from the "Build A Ride Share App with Laravel and Vue" tutorial
PHP
23
star
21

geolocation-google-maps-vue

The source code behind the "Adding Geolocation and Google Maps to Vue Applications" video
Vue
21
star
22

video-auth-vue-laravel-sanctum

The source code behind the "Authentication in Vue using Laravel Sanctum" video
PHP
14
star
23

video-populating-google-map-vue-laravel

The source code for the app shown in my Populating a Google Map with Vue and Laravel video
PHP
13
star
24

video-amazon-s3-storage

The source code in the "Getting started with Amazon S3 storage in Laravel" video
PHP
13
star
25

video-auth-laravel-passport

Source code behind the "Getting started with Laravel Passport and OAuth2" video
PHP
12
star
26

laraplace

A basic r/place clone built with Laravel and Vue using websockets for real-time interactivity.
PHP
9
star
27

video-5-laravel-eloquent-tips

The source code for the app shown in my 5 Tips For Supercharged Laravel Eloquent Queries video
PHP
9
star
28

mdsee

Easily view markdown files in the browser and automatically see any changes
JavaScript
9
star
29

lc-the-docker-tutorial

Source code behind the Laracasts series: The Docker Tutorial
Dockerfile
7
star
30

jstophp

A (very) basic list for JavaScript developers interested in learning PHP
EJS
6
star
31

dices-pizza

Example pizza tracking app built with Laravel, React, and Inertia.js
PHP
5
star
32

lc-image-uploading-vue-laravel

Source code behind the Laracasts Series: Image Uploading with Vue and Laravel
PHP
5
star
33

basic-feeds

📜✏️ A simple PHP library to generate RSS and Atom feeds
PHP
4
star
34

jira-external-links

Chrome extension that opens external Jira links in a new tab
JavaScript
4
star
35

site

Source code behind aschmelyun.com, built with Cleaver
PHP
4
star
36

active-links

Update link classes if their href matches the current url
JavaScript
4
star
37

rpi-home

The source for my Raspberry Pi home server powered by Docker + Laravel + Grafana + Vue
PHP
3
star
38

video-vue-converting-composition-api

The source code behind the video "Converting a Vue component to the Composition API"
Vue
3
star
39

dates.wtf

The source behind dates.wtf
JavaScript
3
star
40

cleaver-site

The source behind usecleaver.com
Blade
3
star
41

laravel-auth-videos

The source code behind the series of videos produced on Laravel's authentication options
PHP
3
star
42

quickmetrics-laravel

Making integration with quickmetrics.io easier for Laravel apps
PHP
3
star
43

gpc

General purpose containers - A handy bash file for running common Docker containers
Shell
2
star
44

parody

Create a fully-featured, pre-populated test API with authentication built in
Dockerfile
2
star
45

parody-blog

A blog style API scaffold for Parody
PHP
2
star
46

taro

A blazing-fast static site generator that uses JSON content files and the Laravel blade templating engine
PHP
2
star
47

lc-larabit-favorite-laravel-collections-methods

Source code behind the Laracasts Larabit: My Favorite Laravel Collections Methods
PHP
2
star
48

lc-larabit-mysql-json-columns

Source code behind the Laracasts Larabit: Using MySQL JSON Columns with Laravel
PHP
2
star
49

lc-larabit-first-typescript-component

Source code behind the Laracasts Larabit: Create Your First TypeScript Component
Vue
1
star
50

ffgen

A command-line wrapper for the fontfacegen package
JavaScript
1
star
51

lc-larabit-pinia-overview

Source code behind the Laracasts Larabit: Pinia Overview
Vue
1
star
52

lc-offline-first-vue

Source code behind the Laracasts Series: Let's Build an Offline-First Vue App
JavaScript
1
star
53

laravel-coreui-starter-kit

A Laravel and CoreUI-powered dashboard starter kit
PHP
1
star
54

lc-larabit-manipulating-photos-intervention-image

Source code behind the Laracasts Larabit: Manipulating Photos in Laravel with Intervention Image
PHP
1
star
55

larametrics-docs

The source behind larametrics.com
JavaScript
1
star
56

endive

Simplistic SCSS framework to assist in rapid front-end development
CSS
1
star
57

lc-larabit-whats-new-in-alpinejs

Source code behind the Laracasts Larabit: What's New in Alpine.js (Dec 2021)
CSS
1
star
58

github-actions-docker-phpunit

Example project using phpunit for the GitHub Actions Docker video
PHP
1
star
59

laravel-docker-site

The source behind the laraveldocker.com website
PHP
1
star
60

passhints

A collection of password hints and requirements for websites and mobile apps.
SCSS
1
star
61

parody-todo

A to-do list style API scaffold for Parody
PHP
1
star
62

aschmelyun.com

The source of aschmelyun.com
HTML
1
star
63

lc-larabit-db-query-gotchas

Source code behind the Laracasts Larabit: Common Database Query Gotchas
PHP
1
star
64

calcite

A front-end framework for rapid web development and prototyping
HTML
1
star
65

textrepo

📝 A super light-weight notes app powered by Vue and IndexedDB
CSS
1
star
66

lc-larabit-creating-using-custom-blade-directives

Source code behind the Laracasts Larabit: Creating and Using Custom Blade Directives
PHP
1
star
67

whatsopentc

What's Open Treasure Coast - A local directory showing restaurants that are open during COVID-19
HTML
1
star
68

lc-larabit-laravel-octane-overview

Source code behind the Laracasts Larabit: A High-Level Overview of Laravel Octane
PHP
1
star