Skip to content

Commit 6cf561e

Browse files
fix: updated the octane docs
1 parent a7c9ff3 commit 6cf561e

File tree

1 file changed

+127
-45
lines changed

1 file changed

+127
-45
lines changed

src/performance/configure-laravel-octane.md

Lines changed: 127 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,55 @@
1616

1717
## Prerequisites
1818

19+
Before installing Laravel Octane, ensure your system meets the basic requirements. The specific requirements may vary depending on which application server you choose (Swoole, FrankenPHP, or RoadRunner).
20+
1921
::: warning Requirements
20-
- Swoole PHP extension must be installed on your system
21-
- PHP 8.2 or higher
22+
- PHP 8.2
2223
- Existing Bagisto installation
2324
:::
2425

26+
### Server-Specific Requirements
27+
28+
Choose one of the following server options:
29+
30+
#### For Swoole Server
31+
32+
- Swoole PHP extension must be installed on your system
33+
2534
Verify Swoole is installed:
2635

2736
```bash
2837
php --ri swoole
2938
```
3039

40+
#### For FrankenPHP Server
41+
42+
- No additional PHP extensions required
43+
- FrankenPHP binary will be automatically downloaded during installation
44+
- Supports automatic HTTPS, HTTP/2, and HTTP/3 out of the box
45+
46+
Verify FrankenPHP (after installation):
47+
48+
```bash
49+
./frankenphp version
50+
```
51+
52+
#### For RoadRunner Server
53+
54+
- No additional PHP extensions required
55+
- RoadRunner binary will be automatically downloaded during installation
56+
- Built with Go for high performance and scalability
57+
- Supports HTTP, gRPC, and background job processing
58+
59+
Verify RoadRunner (after installation):
60+
61+
```bash
62+
./rr version
63+
```
64+
3165
## Installation
3266

33-
Laravel Octane installation for Bagisto involves installing the Octane package via Composer and then configuring it to use Swoole as the application server. This process will enhance your Bagisto application's performance significantly.
67+
Laravel Octane installation for Bagisto involves installing the Octane package via Composer and then configuring it to use Swoole, FrankenPHP, or RoadRunner as the application server. All three options will enhance your Bagisto application's performance significantly.
3468

3569
### Install Laravel Octane
3670

@@ -43,73 +77,121 @@ cd /path/to/your/bagisto
4377
# Install Laravel Octane
4478
composer require laravel/octane
4579

46-
# Install Octane with Swoole
80+
# Install Octane (will prompt for server selection)
4781
php artisan octane:install
4882
```
4983

50-
::: tip Developer Note
51-
After running `php artisan octane:install`, the terminal will prompt you to select a server. Choose **Swoole** from the available options:
52-
- Swoole
53-
- RoadRunner
54-
- FrankenPHP
84+
### Choose Your Server
85+
86+
::: tip Server Selection
87+
After running `php artisan octane:install`, the terminal will prompt you to select a server from these options:
88+
- **Swoole** - High-performance async PHP server with advanced features like concurrent tasks
89+
- **FrankenPHP** - Modern PHP server with native HTTP/2, HTTP/3, and automatic HTTPS
90+
- **RoadRunner** - Go-based application server with excellent performance and plugin ecosystem
5591

56-
We're configuring Octane with Swoole throughout this guide, so make sure to select Swoole when prompted to ensure consistency with the configuration examples provided.
92+
All three servers are excellent choices for Bagisto. This guide covers all options.
5793
:::
5894

95+
### Direct Installation Options
96+
97+
If you prefer to skip the interactive prompt:
98+
99+
```bash
100+
# Install with Swoole
101+
php artisan octane:install --server=swoole
102+
103+
# Install with FrankenPHP
104+
php artisan octane:install --server=frankenphp
105+
106+
# Install with RoadRunner
107+
php artisan octane:install --server=roadrunner
108+
```
109+
110+
### RoadRunner Additional Setup
111+
112+
For RoadRunner, you may also need to install additional packages:
113+
114+
```bash
115+
# Install RoadRunner CLI and HTTP packages (optional)
116+
composer require spiral/roadrunner-http spiral/roadrunner-cli
117+
```
118+
59119
## Environment Configuration
60120

61-
After completing the installation, you'll notice that `OCTANE_SERVER=swoole` has been automatically added to the end of your `.env` file. If for some reason it's not there, you can add it manually.
121+
After completing the installation, the appropriate server configuration will be automatically added to your `.env` file based on your selection.
122+
123+
### For Swoole Server
62124

63125
```properties
64126
OCTANE_SERVER=swoole
65127
```
66128

129+
### For FrankenPHP Server
130+
131+
```properties
132+
OCTANE_SERVER=frankenphp
133+
```
134+
135+
### For RoadRunner Server
136+
137+
```properties
138+
OCTANE_SERVER=roadrunner
139+
```
140+
67141
## Running Octane
68142

69-
Start Octane for production without file watching:
143+
### Basic Usage
144+
145+
Start Octane server (uses configured server from .env):
70146

71147
```bash
72148
php artisan octane:start
73149
```
74150

75151
## Common Issues
76152

77-
While Laravel Octane with Swoole is generally stable, you might encounter some common issues during setup or operation. Here are the most frequent problems and their solutions to help you troubleshoot your Bagisto Octane installation.
153+
While Laravel Octane with Swoole, FrankenPHP, and RoadRunner is generally stable, you might encounter some common issues during setup or operation. Here are the most frequent problems and their solutions to help you troubleshoot your Bagisto Octane installation.
78154

79-
### Troubleshooting
155+
### General Troubleshooting
80156

81157
| Problem | Solution |
82158
|---------|----------|
83-
| **Port already in use** | Change `OCTANE_PORT` or stop conflicting services |
84-
| **Memory leaks** | Reduce `OCTANE_MAX_REQUESTS` to restart workers more frequently |
159+
| **Port already in use** | Change the port or stop conflicting services |
160+
| **Memory leaks** | Reduce the max request by specifying in the octane command |
85161
| **Slow startup** | Ensure database connections are properly configured |
86-
87-
### Debug Commands
88-
89-
Use these diagnostic commands to verify your Octane installation, check system compatibility, and monitor running processes. These commands are essential for troubleshooting and ensuring everything is working correctly.
90-
91-
```bash
92-
# Test if Swoole is working
93-
php -m | grep swoole
94-
95-
# Check Octane installation
96-
php artisan octane:install --server=swoole
97-
98-
# View worker processes
99-
ps aux | grep "artisan octane"
100-
```
101-
102-
::: tip Quick Start
103-
1. Install: `composer require laravel/octane`
104-
2. Setup: `php artisan octane:install --server=swoole`
105-
3. Configure: Update `.env` with Octane settings
106-
4. Run: `php artisan octane:start`
107-
5. Access: Visit `http://localhost:8000`
162+
| **Worker crashes** | Check PHP error logs and reduce worker count if needed |
163+
| **Swoole extension not found** | Install via `pecl install swoole` or use package manager |
164+
| **FrankenPHP binary not found** | Re-run `php artisan octane:install --server=frankenphp` |
165+
| **RoadRunner binary not found** | Re-run `php artisan octane:install --server=roadrunner` |
166+
167+
::: tip Quick Start Guide
168+
1. **Install Laravel Octane:**
169+
```bash
170+
composer require laravel/octane
171+
```
172+
173+
2. **Choose and setup your server:**
174+
```bash
175+
# For Swoole
176+
php artisan octane:install --server=swoole
177+
178+
# For FrankenPHP
179+
php artisan octane:install --server=frankenphp
180+
181+
# For RoadRunner
182+
php artisan octane:install --server=roadrunner
183+
```
184+
185+
3. **Configure your `.env` file:**
186+
- For Swoole: `OCTANE_SERVER=swoole`
187+
- For FrankenPHP: `OCTANE_SERVER=frankenphp`
188+
- For RoadRunner: `OCTANE_SERVER=roadrunner`
189+
190+
4. **Start the server:**
191+
```bash
192+
php artisan octane:start
193+
```
194+
195+
5. **Access your application:**
196+
- Visit `http://localhost:8000`
108197
:::
109-
110-
::: warning Production Notes
111-
- Use a process manager (like Supervisor) to keep Octane running
112-
- Configure a reverse proxy (Nginx) for production deployments
113-
- Monitor memory usage and restart workers periodically
114-
- Test thoroughly before deploying to production
115-
:::

0 commit comments

Comments
 (0)