Skip to content

Commit

Permalink
New sections:
Browse files Browse the repository at this point in the history
1. RoadRunner envs configuration
2. Start dev env using docker
3. Start manual dev env
  • Loading branch information
butschster committed Jan 3, 2025
1 parent 9a40b33 commit cac597e
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 22 deletions.
40 changes: 21 additions & 19 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vitepress'
import {defineConfig} from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -12,7 +12,7 @@ export default defineConfig({
},

nav: [
{ text: 'Docs', link: '/' },
{text: 'Docs', link: '/'},
],

sidebar: [
Expand Down Expand Up @@ -42,32 +42,34 @@ export default defineConfig({
{
text: 'Integrations',
items: [
{ text: 'XHProf', link: '/config/xhprof' },
{ text: 'VarDumper', link: '/config/var-dumper' },
{ text: 'Ray', link: '/config/ray' },
{ text: 'Sentry', link: '/config/sentry' },
{ text: 'SMTP server', link: '/config/smtp' },
{ text: 'Monolog', link: '/config/monolog' },
{ text: 'Inspector', link: '/config/inspector' },
{ text: 'Http Dumps', link: '/config/http-dumps' },
{text: 'XHProf', link: '/config/xhprof'},
{text: 'VarDumper', link: '/config/var-dumper'},
{text: 'Ray', link: '/config/ray'},
{text: 'Sentry', link: '/config/sentry'},
{text: 'SMTP server', link: '/config/smtp'},
{text: 'Monolog', link: '/config/monolog'},
{text: 'Inspector', link: '/config/inspector'},
{text: 'Http Dumps', link: '/config/http-dumps'},
]
},

{
text: 'Configuration',
items: [
{ text: 'Projects', link: '/config/projects' },
{ text: 'Webhooks', link: '/config/webhooks' },
{ text: 'Single Sign On (SSO)', link: '/config/sso' },
{ text: 'External Database', link: '/config/external-db' },
{ text: 'Metrics', link: '/config/metrics' },
{text: 'RoadRunner', link: '/config/roadrunner'},
{text: 'Projects', link: '/config/projects'},
{text: 'Webhooks', link: '/config/webhooks'},
{text: 'Single Sign On (SSO)', link: '/config/sso'},
{text: 'External Database', link: '/config/external-db'},
{text: 'Metrics', link: '/config/metrics'},
]
},

{
text: 'Cookbook',
items: [
{ text: 'Dev environment', link: '/cookbook/dev-env' }
{text: 'Dev environment using docker', link: '/cookbook/docker-install'},
{text: 'Dev environment', link: '/cookbook/manual-install'},
]
},

Expand Down Expand Up @@ -95,9 +97,9 @@ export default defineConfig({
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/buggregator/server' },
{ icon: 'discord', link: 'https://discord.gg/vDsCD3EKUB' },
{ icon: 'twitter', link: 'https://twitter.com/buggregator' },
{icon: 'github', link: 'https://github.com/buggregator/server'},
{icon: 'discord', link: 'https://discord.gg/vDsCD3EKUB'},
{icon: 'twitter', link: 'https://twitter.com/buggregator'},
]
}
})
70 changes: 70 additions & 0 deletions docs/config/roadrunner.md
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
```
6 changes: 5 additions & 1 deletion docs/contributing/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ and Doltdb.

## Installation

To set up environment for local development read the [development environment setup guide](../cookbook/dev-env.md).
Here are two ways to install the server:

1. **Docker:** The easiest way to get started is by using Docker. To set up environment for local development read
the [development environment setup guide](../cookbook/docker-install).
2. **Manual:** If you prefer to install the server manually, follow the [manual installation guide](../cookbook/manual-install.md).
93 changes: 93 additions & 0 deletions docs/cookbook/docker-install.md
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! 😊
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cookbook β€” Dev environment
# Cookbook β€” Manual install dev environment

Hello contributors! This cookbook will guide you through setting up your development environment for Buggregator.
Hey, developer! πŸŽ‰ This guide will help you quickly set up a local dev environment for Buggregator.

## Clone the Repository

Expand Down

0 comments on commit cac597e

Please sign in to comment.