The docker stack is composed of the following containers
Name | Version |
---|---|
traefik | 3.2 |
nginx | 1.27 |
php-fpm | 8.2 |
php-fpm-xdebug | 3.2.2 |
redis | 7.4 |
mysql | 8.4.3 |
mailpit | 1.21 |
rabbitmq | 4.0.4 |
opensearch | 2.18 |
opensearch-dashboard | 2.18 |
varnish | 7.6 |
Starts a reverse proxy and load balancer for project
Opens local port: 80
, 443
Builds from the nginx folder.
Mounts the folder laravel from the project main folder into the container volume /home/laravel
.
Builds from the php-fpm folder.
Mounts the folder laravel from the project main folder into the container volume /home/laravel
.
This container includes all dependencies for Laravel.
Builds from the php-fpm-xdebug folder.
Mounts the folder laravel from the project main folder into the container volume /home/laravel
.
This container includes all dependencies for Laravel (also contain xDebug).
Starts a redis container.
Please change or set the mysql environment variables
MYSQL_DATABASE: 'xxxx'
MYSQL_ROOT_PASSWORD: 'xxxx'
MYSQL_USER: 'xxxx'
MYSQL_PASSWORD: 'xxxx'
MYSQL_ALLOW_EMPTY_PASSWORD: 'xxxxx'
Default values:
MYSQL_DATABASE: 'laravel'
MYSQL_ROOT_PASSWORD: 'root_pass'
MYSQL_USER: 'laravel_user'
MYSQL_PASSWORD: 'PASSWD#'
MYSQL_ALLOW_EMPTY_PASSWORD: 'false'
Opens up port: 3306
Note: On your host, port 3306 might already be in use. So before running docker-compose.yml, under the docker-compose.yml's mysql section change the host's port number to something other than 3306, select any as long as that port is not already being used locally on your machine.
Starts a mailpit container.
Opens up port: 8025
Starts a rabbitmq container.
Opens up port: 15672
Starts an opensearch container.
Starts an opensearch dashboard container.
Opens up port: 5601
Builds from the varnish folder.
Starts a varnish container.
Opens up port: 6081
Copy your .env.sample
to .env
file in root folder, and change PROJECT_NAME
and PROJECT_VIRTUAL_HOST
:
PROJECT_NAME
- help you to create simple and clear container names.
PROJECT_VIRTUAL_HOST
- it is your main url address.
For example:
PROJECT_NAME=laravel
PROJECT_VIRTUAL_HOST=laravel.test
Edit your /etc/hosts
and add next line:
127.0.0.1 laravel.test traefik.laravel.test mail.laravel.test search.laravel.test dashboard.laravel.test rabbit.laravel.test
To start/build the stack.
Use - docker-compose up
or docker-compose up -d
to run the container on detached mode.
Compose will take some time to execute.
After the build has finished you can press the ctrl+c and docker-compose stop all containers.
To the run installation process use next commands.
Create and install new project:
./scripts/composer create-project laravel/laravel .
./scripts/npm install
./scripts/npm run build
./scripts/php artisan key:generate
./scripts/php artisan migrate
To access the laravel homepage, go to the following url: https://laravel.test
Storing sessions and cache in redis.
server: {
host: 'nginx',
port: 5175,
https: true,
},
Setting up the boot method in /app/Providers/AppServiceProvider.php (it is necessary for the correct use of HTTPS locally).
public function boot(): void
{
if (config('app.env') === 'local') {
URL::forceScheme('https');
}
}
APP_URL=https://laravel.test
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel_db
DB_USERNAME=laravel_user
DB_PASSWORD="PASSWD#"
REDIS_CLIENT=redis
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_HOST=mailpit
You could enable or disable xDebug with the next command: ./scripts/switch_mode [fpm|xdebug]
fpm
- Enable container without xDebug
xdebug
- Enable container with xDebug
Also, you can open:
https://traefik.laravel.test - Traefik Dashboard (traefik/traefik123 for access)
https://mail.laravel.test - Mailpit
https://search.laravel.test - OpenSearch
https://dashboard.laravel.test - OpenSearch Dashboard
https://rabbit.laravel.test - RabbitMQ (guest/guest for access)
- v1.0.0 - Initial release
Name | Laravel |
---|---|
main | 11.x |