-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. RoadRunner envs configuration 2. Start dev env using docker 3. Start manual dev env
- Loading branch information
1 parent
9a40b33
commit cac597e
Showing
5 changed files
with
191 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Configuration β RoadRunner | ||
|
||
The **Buggregator server** uses the **RoadRunner application server** to handle HTTP and TCP requests efficiently. | ||
RoadRunner is a high-performance server written in Go, designed for PHP applications. In some cases, you might want to | ||
customize its configuration to suit your needs, such as: | ||
|
||
- Restricting **CORS rules** for security. | ||
- Increasing **TCP buffer size** for better performance. | ||
- Adjusting **logging settings** for different environments (e.g., development or production). | ||
|
||
This guide explains how to configure the Buggregator server using RoadRunner's **environment variables**. | ||
|
||
--- | ||
|
||
### Available ENV Variables | ||
|
||
| **Variable Name** | **Description** | **Default Value** | | ||
|----------------------------------|-----------------------------------------------------------------------------------------------------------|--------------------| | ||
| `RR_LOG_MODE` | Logging mode: `development`, `production`, or `raw`. | `production` | | ||
| `RR_LOG_ENCODING` | Log encoding format: `console` or `json`. Recommended `json` for production. | `json` | | ||
| `RR_LOG_LEVEL` | Global logging level: `panic`, `error`, `warn`, `info`, `debug`. | `warn` | | ||
| `RR_LOG_HTTP_LEVEL` | Logging level for HTTP plugin: `panic`, `error`, `warn`, `info`, `debug`. | `warn` | | ||
| `RR_LOG_TCP_LEVEL` | Logging level for TCP plugin: `panic`, `error`, `warn`, `info`, `debug`. | `warn` | | ||
| `RR_LOG_CENTRIFUGE_LEVEL` | Logging level for Centrifuge plugin: `panic`, `error`, `warn`, `info`, `debug`. | `warn` | | ||
| `RR_LOG_SERVER_LEVEL` | Logging level for the server: `panic`, `error`, `warn`, `info`, `debug`. | `warn` | | ||
| `RR_LOG_SERVICE_LEVEL` | Logging level for services: `panic`, `error`, `warn`, `info`, `debug`. | `warn` | | ||
| `RR_HTTP_ALLOWED_ORIGIN` | Allowed origins for CORS. Typically set to specific domains or `*` for all. | `*` | | ||
| `RR_HTTP_ALLOWED_HEADERS` | Allowed headers for CORS. Set `*` for all or specify headers. | `*` | | ||
| `RR_HTTP_ALLOW_CREDENTIALS` | Whether CORS credentials (cookies, authorization) are allowed. | `true` | | ||
| `RR_HTTP_NUM_WORKERS` | Number of workers in the HTTP pool. Determines concurrency for HTTP handling. | (Unset by default) | | ||
| `RR_TCP_MONOLOG_ADDR` | Address for the Monolog TCP server. | `:9913` | | ||
| `RR_TCP_VAR_DUMPER_ADDR` | Address for the Var-Dumper TCP server. | `:9912` | | ||
| `RR_TCP_SMTP_ADDR` | Address for the SMTP TCP server. | `:1025` | | ||
| `RR_TCP_READ_BUF_SIZE` | Buffer size for TCP data reading (in bytes). Higher values reduce `read` system calls for large payloads. | `50485760` (50MB) | | ||
| `RR_TCP_NUM_WORKERS` | Number of workers in the TCP pool. Determines concurrency for TCP handling. | (Unset by default) | | ||
| `RR_CENTRIFUGE_PROXY_ADDRESS` | Proxy address for Centrifuge plugin. | (Unset by default) | | ||
| `RR_CENTRIFUGE_GRPC_API_ADDRESS` | gRPC API address for Centrifuge plugin. | (Unset by default) | | ||
| `RR_CENTRIFUGE_NUM_WORKERS` | Number of workers in the Centrifuge poll. | (Unset by default) | | ||
|
||
--- | ||
|
||
### Example: Using ENV Variables in Docker Compose | ||
|
||
To configure RoadRunner through environment variables in `docker-compose.yml`, use the following example: | ||
|
||
```yaml | ||
version: '3.9' | ||
|
||
services: | ||
buggregator: | ||
image: ghcr.io/buggregator/server:latest | ||
environment: | ||
RR_LOG_MODE: json # Set logging mode to JSON | ||
RR_HTTP_NUM_WORKERS: 4 # Configure the number of HTTP workers | ||
RR_TCP_READ_BUF_SIZE: 10485760 # Set TCP read buffer size to 10MB | ||
RR_HTTP_ALLOWED_ORIGIN: "https://example.com" # Restrict allowed CORS origins | ||
``` | ||
### Example: Using ENV Variables with `docker run` | ||
|
||
You can also pass environment variables directly when running a Docker container: | ||
|
||
```bash | ||
docker run --pull always \ | ||
-e RR_LOG_MODE=json \ # Set logging mode to JSON | ||
-e RR_HTTP_NUM_WORKERS=4 \ # Configure the number of HTTP workers | ||
-e RR_TCP_READ_BUF_SIZE=10485760 \ # Set TCP read buffer size to 10MB | ||
-e RR_HTTP_ALLOWED_ORIGIN="https://example.com" \ # Restrict allowed CORS origins | ||
ghcr.io/buggregator/server:latest | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Cookbook β Dev environment using docker compose | ||
|
||
Hey, developer! π This guide will help you quickly set up a local dev environment for Buggregator. | ||
|
||
## 1. Clone the Repository | ||
|
||
Start by cloning the repository: | ||
|
||
```bash | ||
git clone [email protected]:buggregator/server.git | ||
cd server | ||
``` | ||
|
||
> **Note:** If you don't have access, fork the repository and clone your fork instead. | ||
## 2. Install Dependencies | ||
|
||
Run the following to install PHP dependencies: | ||
|
||
```bash | ||
composer install | ||
``` | ||
|
||
## 3. Build and Start the Docker Environment | ||
|
||
The repository includes a Docker Compose setup for a local development environment, including the Buggregator server, | ||
PostgreSQL, and service with examples. | ||
|
||
### Build Docker Images | ||
|
||
```bash | ||
make build | ||
``` | ||
|
||
### Start the Server | ||
|
||
```bash | ||
make up | ||
``` | ||
|
||
> **Note:** Make sure you have make installed on your system. If not, you need to install it first. | ||
This will: | ||
|
||
- Start the Buggregator server. | ||
- Spin up a PostgreSQL database. | ||
- Launch the example server for testing features. | ||
|
||
#### Mounted Directories in Docker Setup | ||
|
||
The Docker Compose setup uses **mounted directories** to ensure that changes made to your local files are immediately | ||
reflected inside the running containers. This makes development faster and more seamless. | ||
|
||
1. **Application Code** | ||
Local directory: `./app` | ||
Mounted in the container: `/app/app` | ||
|
||
2. **Runtime Files** | ||
Local directory: `./runtime` | ||
Mounted in the container: `/app/runtime` | ||
|
||
3. **Vendor Directory** | ||
Local directory: `./vendor` | ||
Mounted in the container: `/app/vendor` | ||
|
||
## 4. Access the Application | ||
|
||
Once the server is up, you can access the following: | ||
|
||
- **Buggregator:** [http://buggregator.localhost](http://buggregator.localhost) | ||
- **Examples:** [http://examples.buggregator.localhost](http://examples.buggregator.localhost) | ||
|
||
## 5. Environment Configuration (Optional) | ||
|
||
The default `.env` file is pre-configured, but you can customize it if needed: | ||
|
||
```bash | ||
cp .env.sample .env | ||
``` | ||
|
||
## 6. Stop the Server | ||
|
||
To stop the server and clean up, run: | ||
|
||
```bash | ||
make down | ||
``` | ||
|
||
> **Note:** If any services like PostgreSQL don't stop, you can manually kill them with `docker ps` and `docker kill`. | ||
--- | ||
|
||
That's it! π Your Buggregator dev environment is ready. Happy coding! π |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters