Skip to content

Instantly share code, notes, and snippets.

@bumbummen99
Created April 6, 2022 02:56
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 bumbummen99/411917ae3146cc83bf3daa5584125f34 to your computer and use it in GitHub Desktop.
Save bumbummen99/411917ae3146cc83bf3daa5584125f34 to your computer and use it in GitHub Desktop.
Laravel Sail + Octane + YASD

Install YASD

  1. Add the following ARG to your Dockerfile
ARG YASD_VERSION=2c86a0c
  1. Add the build dependencies to the apt-get install section of your Dockerfile
apt-get install -y ... libboost-all-dev \
  1. Remove phpX.X-xdebug as we are replacing it with YASD

  2. Add YASD build BEFORE cleanup (apt-get -y autoremove)

    && cd /tmp \
    && curl -L https://github.com/swoole/yasd/archive/$YASD_VERSION.tar.gz --output yasd.tar.gz \
    && mkdir yasd && tar xzf yasd.tar.gz -C yasd --strip-components 1 \
    && cd yasd \
    && phpize --clean \
    && phpize \
    && ./configure \
    && make clean \
    && make \
    && make install \

Configure YASD

Add the following to your php.ini

[yasd]
zend_extension=yasd
yasd.open_extended_info=${YASD_OPEN_EXTENDED_INFO}
yasd.debug_mode=${YASD_MODE}
yasd.remote_host=${YASD_REMOTE_HOST}
yasd.remote_port=9003

Modify your docker-compose.yml

...
environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            YASD_MODE: '${SAIL_YASD_MODE:-off}'
            YASD_OPEN_EXTENDED_INFO: '${SAIL_YASD_OPEN_EXTENDED_INFO:-0}'
            YASD_REMOTE_HOST: '${SAIL_YASD_REMOTE_HOST:-host.docker.internal}'
...

Add the following to your .env(.example)

#SAIL_YASD_MODE=remote
#SAIL_YASD_OPEN_EXTENDED_INFO=1

Uncomment above lines to enable debugging.

Notes

  • YASD doc does mention php -e option to be required. This does not work with octane so yasd.open_extended_info is being used to enable it globally. This will reduce performance considerably but is required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment