Skip to content

Instantly share code, notes, and snippets.

@lucenarenato
Forked from kiddtang/.env-Swoole
Created April 5, 2023 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucenarenato/95ee3b6b8c16907dd6ee5a415475eb55 to your computer and use it in GitHub Desktop.
Save lucenarenato/95ee3b6b8c16907dd6ee5a415475eb55 to your computer and use it in GitHub Desktop.
Youtube - Boosts your Laravel Sail
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,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment