properly setup debugger for everyone and contribution guide
This commit is contained in:
parent
5073c264b7
commit
74b24dfe69
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,4 +6,5 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.php_cs.cache
|
.php_cs.cache
|
||||||
debug/
|
debug/
|
||||||
app/sdks
|
app/sdks
|
||||||
|
dev/yasd_init.php
|
||||||
|
|
|
@ -282,6 +282,30 @@ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
||||||
|
|
||||||
The Runtimes for all supported cloud functions (multicore builds) can be found at the [appwrite/php-runtimes](https://github.com/appwrite/php-runtimes) repository.
|
The Runtimes for all supported cloud functions (multicore builds) can be found at the [appwrite/php-runtimes](https://github.com/appwrite/php-runtimes) repository.
|
||||||
|
|
||||||
|
## Debug
|
||||||
|
|
||||||
|
Appwrite uses [yasd](https://github.com/swoole/yasd) debugger, which is available by default in debug build of Appwrite. You can connect to the debugger using VS Code [PHP Debug](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) extension or if you are in PHP Storm you don't need any plugin. Below are the settings required for remote debugger connection.
|
||||||
|
|
||||||
|
Finally you need to create an init file. Duplicate **dev/yasd_init.php.stub** file and name it **dev/yasd_init.php** and there change the IP address to your development machine's IP. Without the proper IP address debugger wont connect.
|
||||||
|
|
||||||
|
### VS Code Launch Configuration
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "Listen for Xdebug",
|
||||||
|
"type": "php",
|
||||||
|
"request": "launch",
|
||||||
|
"port": 9005,
|
||||||
|
"pathMappings": {
|
||||||
|
"/usr/src/code": "${workspaceRoot}"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### PHPStorm Setup
|
||||||
|
|
||||||
|
In settings, go to **Languages & Frameworks** > **PHP** > **Debug**, there under **Xdebug** set the debug port to **9005** and enable **can accept external connections** checkbox.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
To run all tests manually, use the Appwrite Docker CLI from your terminal:
|
To run all tests manually, use the Appwrite Docker CLI from your terminal:
|
||||||
|
|
|
@ -240,7 +240,7 @@ RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
|
||||||
RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini
|
RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini
|
||||||
RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini
|
RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini
|
||||||
RUN echo extension=maxminddb.so >> /usr/local/etc/php/conf.d/maxminddb.ini
|
RUN echo extension=maxminddb.so >> /usr/local/etc/php/conf.d/maxminddb.ini
|
||||||
RUN if [ "$TESTING" == "true" ]; then printf 'zend_extension=yasd \nyasd.debug_mode=remote \nyasd.remote_host=192.168.1.64 \nyasd.remote_port=9005 \nyasd.log_level=0 \nyasd.breakpoints_file="yasd.log"' >> /usr/local/etc/php/conf.d/yasd.ini; fi
|
RUN if [ "$TESTING" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/local/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi
|
||||||
|
|
||||||
RUN if [ "$TESTING" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi
|
RUN if [ "$TESTING" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi
|
||||||
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
|
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||||
|
|
4
dev/yasd_init.php.stub
Normal file
4
dev/yasd_init.php.stub
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo 'execute init_file success' . PHP_EOL;
|
||||||
|
Yasd\Api\setRemoteHost('127.0.0.1'); //Set your development machine's IP
|
|
@ -67,6 +67,7 @@ services:
|
||||||
- ./public:/usr/src/code/public
|
- ./public:/usr/src/code/public
|
||||||
- ./src:/usr/src/code/src
|
- ./src:/usr/src/code/src
|
||||||
- ./debug:/tmp
|
- ./debug:/tmp
|
||||||
|
- ./dev:/usr/local/dev
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
- redis
|
- redis
|
||||||
|
@ -77,8 +78,6 @@ services:
|
||||||
- -e
|
- -e
|
||||||
- app/http.php
|
- app/http.php
|
||||||
- -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
- -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
||||||
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- _APP_ENV
|
- _APP_ENV
|
||||||
- _APP_LOCALE
|
- _APP_LOCALE
|
||||||
|
|
Loading…
Reference in a new issue