1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Contrib updates

This commit is contained in:
Jake Barnby 2022-07-13 22:22:18 +12:00
parent a656699fa7
commit cdd7569e86
3 changed files with 31 additions and 13 deletions

1
.gitignore vendored
View file

@ -12,3 +12,4 @@
debug/
app/sdks
dev/yasd_init.php
.phpunit.result.cache

File diff suppressed because one or more lines are too long

View file

@ -51,19 +51,19 @@ $ git checkout -b [name_of_your_new_branch]
4. Before you push your changes, make sure your code follows the `PSR12` coding standards , which is the standard Appwrite follows currently. You can easily do this by running the formatter.
```bash
composer format <your file path>
docker run --rm --interactive --tty --volume $PWD:/app composer format <your file path>
```
Now, go a step further by running the linter by the following command to manually fix the issues the formatter wasn't able to fix.
```bash
composer lint <your file path>
docker run --rm --interactive --tty --volume $PWD:/app composer lint <your file path>
```
This will give you a list of errors for you to rectify , if there is an instance you need more information on the errors being displayed you can pass in additional command line arguments. More list of available arguments can be found [here](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage). A very useful command line argument is `--report=diff`. This will give you the expected changes by the linter for easy fixing of formatting issues.
```bash
composer lint --report=diff <your file path>
docker run --rm --interactive --tty --volume $PWD:/app composer lint --report=diff <your file path>
```
5. Push changes to GitHub
@ -187,17 +187,19 @@ Appwrite's current structure is a combination of both [Monolithic](https://en.wi
├── src # Supporting libraries (each lib has one role, common libs are released as individual projects)
│ └── Appwrite
│ ├── Auth
│ ├── Database
│ ├── Detector
│ ├── Docker
│ ├── DSN
│ ├── Event
│ ├── Extend
│ ├── GraphQL
│ ├── Messaging
│ ├── Migration
│ ├── Network
│ ├── OpenSSL
│ ├── Realtime
│ ├── Resque
│ ├── Specification
│ ├── Stats
│ ├── Task
│ ├── Template
│ ├── URL
@ -218,7 +220,7 @@ Although the Appwrite API is a monolithic app, it has a very clear separation of
Each container in Appwrite is a microservice on its own. Each service is an independent process that can scale without regard to any of the other services.
Currently, all of the Appwrite microservices are intended to communicate using the TCP protocol over a private network. You should be aware to not expose any of the services to the public-facing network, besides the public port 80 and 443, who, by default, are used to expose the Appwrite HTTP API.
Currently, all the Appwrite microservices are intended to communicate using the TCP protocol over a private network. You should be aware to not expose any of the services to the public-facing network, besides the public port 80 and 443, who, by default, are used to expose the Appwrite HTTP API.
## Ports
@ -338,7 +340,7 @@ Things to remember when releasing SDKs
Appwrite uses [yasd](https://github.com/swoole/yasd) debugger, which can be made available during 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.
First, 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 will not connect. You will also need to set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file.
First, you need to set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file.
### VS Code Launch Configuration
@ -356,7 +358,17 @@ First, you need to create an init file. Duplicate **dev/yasd_init.php.stub** fil
### PHPStorm Setup
In settings, go to **Languages & Frameworks** > **PHP** > **Debug**, there under **Xdebug** set the debug port to **9005** and enable the **can accept external connection** checkbox.
In settings, go to **PHP** > **Debug**, there under **Xdebug** set the debug port to **9005** and enable the **Can accept external connections** checkbox.
Still in settings, got to **PHP** > **Servers** and select the **+** button to add a new server. Give the server a name and remember this for later. Then enter your host address and port. Next, enable the checkbox for **Use path mappings**. Now enter a mapping for the root of the repository to `/usr/src/code`.
The final step is adding a new environment variable to the Appwrite server. In the **appwrite** service's environment in **docker-compose.yml**, add the following line:
```yaml
- PHP_IDE_CONFIG=serverName=YOUR_SERVER_NAME
```
Replacing `YOUR_SERVER_NAME` with the name of the server you added in the previous step.
## Tests
@ -384,6 +396,12 @@ To run end-2-end tests for a specific service use:
docker compose exec appwrite test /usr/src/code/tests/e2e/Services/[ServiceName]
```
To run a single test use:
```bash
docker compose exec appwrite test /usr/src/code/tests/.../[TestClass] --filter "[TestName]"
```
## Benchmarking
You can use WRK Docker image to benchmark the server performance. Benchmarking is extremely useful when you want to compare how the server behaves before and after a change has been applied. Replace [APPWRITE_HOSTNAME_OR_IP] with your Appwrite server hostname or IP. Note that localhost is not accessible from inside the WRK container.
@ -413,18 +431,18 @@ We use some automation tools to help us keep a healthy codebase.
```bash
# Run on all files
composer format
docker run --rm --interactive --tty --volume $PWD:/app composer format
# Run on single file or folder
composer format <your file path>
docker run --rm --interactive --tty --volume $PWD:/app composer format <your file path>
```
**Run Linter:**
```bash
# Run on all files
composer lint
docker run --rm --interactive --tty --volume $PWD:/app composer lint
# Run on single file or folder
composer lint <your file path>
docker run --rm --interactive --tty --volume $PWD:/app composer lint <your file path>
```
## Tutorials