-
-
Save kiddtang/5dc75293806369d443f9f9a6be861d0d to your computer and use it in GitHub Desktop.
OCTANE_SERVER=swoole | |
OCTANE_HTTPS=true |
SWOOLE_SOCK_TCP | ((bool) $config['swoole']['ssl'] ?? 0) * SWOOLE_SSL, |
ports: | |
- '${APP_PORT:-80}:80' | |
- 8000:8000 |
XDEBUG: '${APP_DEBUG:-false}' | |
XDEBUG_PORT: '${SAIL_XDEBUG_PORT:-9000}' |
RUN mkdir -p /etc/swoole/ssl/certs/ /etc/swoole/ssl/private/ | |
RUN openssl req -x509 -nodes -days 365 -subj "/C=CA/ST=QC/O=Artisan, Inc./CN=localhost" \ | |
-addext "subjectAltName=DNS:localhost" -newkey rsa:2048 \ | |
-keyout /etc/swoole/ssl/private/sail-selfsigned.key \ | |
-out /etc/swoole/ssl/certs/sail-selfsigned.crt; | |
RUN chmod 644 /etc/swoole/ssl/certs/*.crt | |
RUN chown -R root:sail /etc/swoole/ssl/private/ | |
RUN chmod 640 /etc/swoole/ssl/private/*.key |
ARG XDEBUG | |
ARG XDEBUG_PORT | |
RUN if [ "${XDEBUG}" = 'true' ] ; then \ | |
apt-get update \ | |
&& apt-get install -y php-xdebug \ | |
&& echo "[XDebug]" > /etc/php/8.0/cli/php.ini \ | |
&& echo "zend_extension="$(find /usr/lib/php/20200930/ -name xdebug.so)" > /etc/php/8.0/cli/php.ini" \ | |
&& echo "xdebug.mode = debug" >> /etc/php/8.0/cli/php.ini \ | |
&& echo "xdebug.discover_client_host = true" >> /etc/php/8.0/cli/php.ini \ | |
&& echo "xdebug.client_host = host.docker.internal" >> /etc/php/8.0/cli/php.ini \ | |
&& echo "xdebug.client_port = ${XDEBUG_PORT}" >> /etc/php/8.0/cli/php.ini \ | |
&& apt-get -y autoremove \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ;\ | |
fi; |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Listen for Sail Xdebug", | |
"type": "php", | |
"request": "launch", | |
"port": 9000, | |
"pathMappings": { | |
"/var/www/html": "${workspaceFolder}" | |
}, | |
"hostname": "localhost", | |
"ignore": ["**/vendor/**/*.php"], | |
"xdebugSettings": { | |
"max_data": 65536, | |
"show_hidden": 1, | |
"max_children": 100, | |
"max_depth": 3 | |
} | |
}, | |
] | |
} |
/* | |
|-------------------------------------------------------------------------- | |
| Octane Swoole Configuration Options | |
|-------------------------------------------------------------------------- | |
| | |
| While using Swoole, you may define additional configuration options as | |
| required by the application. You maycheck which options you need from: | |
| https://www.swoole.co.uk/docs/modules/swoole-server/configuration | |
| | |
*/ | |
'swoole' => [ | |
'ssl' => true, | |
'options' => [ | |
'ssl_cert_file' => '/etc/swoole/ssl/certs/sail-selfsigned.crt', | |
'ssl_key_file' => '/etc/swoole/ssl/private/sail-selfsigned.key', | |
] | |
], |
path=$(printf '%s\n' "${PWD##*/}") | |
command="docker exec ${path}_laravel.test_1 php "$@"" | |
echo "Running php on docker ${path}_laravel.test_1" | |
$command |
{ | |
"php.validate.executablePath": "/usr/local/bin/php" | |
} |
[supervisord] | |
nodaemon=true | |
user=root | |
logfile=/var/log/supervisor/supervisord.log | |
pidfile=/var/run/supervisord.pid | |
[program:php-octane] | |
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=swoole --host=0.0.0.0 --port=8000 --watch | |
user=sail | |
environment=LARAVEL_SAIL="1" | |
stdout_logfile=/dev/stdout | |
stdout_logfile_maxbytes=0 | |
stderr_logfile=/dev/stderr | |
stderr_logfile_maxbytes=0 | |
[program:php-serve] | |
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80 | |
user=sail | |
environment=LARAVEL_SAIL="1" | |
stdout_logfile=/dev/stdout | |
stdout_logfile_maxbytes=0 | |
stderr_logfile=/dev/stderr | |
stderr_logfile_maxbytes=0 |
mix.browserSync({ | |
proxy: 'https://localhost:8000', | |
open: false, | |
}); |
can you add the chokidar dependency, (the install command or changes in package.json)
Are you facing this issue?
Hot reloading not working with laravel/sail [laravel 8]
if you check package-lock.json
, you should see chokidar
is a dependency of laravel-mix
Let me know what I can help with. thanks!
can you add the chokidar dependency, (the install command or changes in package.json)
Are you facing this issue?
I faced an issue after doing npm run watch-poll
npm will try to install additional dependencies.
Additional dependencies must be installed. This will only take a moment.
running npm install browser-sync [email protected] --save-dev --legacy-peer-deps
I fixed this now by manually installing this dependency and removed the version part from the install command @2.3.0
, it was clashing with other project deps.
can you add the chokidar dependency, (the install command or changes in package.json)
Are you facing this issue?
I faced an issue after doing
npm run watch-poll
npm will try to install additional dependencies.Additional dependencies must be installed. This will only take a moment. running npm install browser-sync [email protected] --save-dev --legacy-peer-deps
I fixed this now by manually installing this dependency and removed the version part from the install command
@2.3.0
, it was clashing with other project deps.
Understand. Mine was base on fresh Laravel. However, the dependency issues have to resolve case-by-case.
Thanks for leaving your feedback!
Hey @kiddtang, thanks for the great resource.
Is it still necessary to run apt-get update && apt-get install -y php-xdebug
? Because php8.0-xdebug
is already installed in the default 8.0 Sail Dockerfile.
Hey @kiddtang, thanks for the great resource.
Is it still necessary to run
apt-get update && apt-get install -y php-xdebug
? Becausephp8.0-xdebug
is already installed in the default 8.0 Sail Dockerfile.
You are right! Since Larave Sail v 1.9.0, the Xdebug was included as default.
You can refer to official docs https://laravel.com/docs/8.x/sail#debugging-with-xdebug
Alternatively my Updated Medium: https://blog.devgenius.io/xdebug-laravel-sail-project-in-vs-code-b7b73e3dedf7#fac6
can you add the chokidar dependency, (the install command or changes in package.json)