
Laralord Server
Web-server with Multi-tenancy support
Laralord Server is an open-source project built on OpenSwoole, designed to enable multi-tenancy for stateless Laravel applications without requiring code modifications. It provides a high-performance, multi-tenant server setup that separates tenant management from your application's business logic, allowing you to serve a single-tenant Laravel application in a multi-tenant environment. This page introduces the Laralord Server project, its key features, and installation instructions.
What is Laralord Server?
Laralord Server is an OpenSwoole-based wrapper that enables multi-tenancy for any stateless Laravel application without requiring code modifications. It allows you to gain the benefits of a multi-tenant application without adding complexity to the development process. By separating tenant management from your application’s business logic, you can serve a Laravel application developed with a single-tenant approach in a multi-tenant environment.
What is Laravel?
Laravel is an open-source PHP framework for web application development. Learn more in the official Laravel documentation.
Trademarks: The respective trademarks mentioned in this offering are owned by their respective companies, and their use does not imply any affiliation or endorsement.
Key Features
- Multi-Tenant Support:
- Detect tenant ID via headers, cookies, JWT tokens, query strings, or POST data.
- Operate in:
- Single-Tenant Mode: Optimized server for a single tenant with pre-booted Laravel instances for ultra-fast responses.
- Multi-Tenant Mode: Dynamically resolve environment credentials per tenant, supporting concurrent requests with isolated environments.
- S3 Bucket Proxy: Simplifies serving static files and tenant-specific frontends from an S3 or S3-compatible bucket, enabling different UI versions if needed.
- High Performance:
- Pre-boot Laravel application in Single-Tenant Mode, reducing response delay by up to 20ms.
- Process Isolation: Each request is executed in a separate process using the
pcntl
extension.
- Unified Queue Workers and Scheduler:
- Fair distribution of resources between tenants in both the queue system and scheduler.
- Supports isolated task execution per tenant, ensuring equal access to resources.
- Dynamic Credentials Update:
- Periodically fetch and update credentials from HashiCorp Vault, ensuring tenant environments use the latest credentials.
- Containerization Support:
- Built for containerization, offering simple and clear configuration, even through environment variables.
- Additional Tools:
- tenant-context Command: A bash script (
tenant-context $command
) that executes any bash command in the tenant’s context, using tenant-specific environment variables.
- tenant-context Command: A bash script (
Requirements
- PHP: >= 8.2
- PHP Extensions:
openswoole
,inotify
,apcu
,sysvmsg
,pcntl
,redis
- Environment Variables Source: Vault, file-based, or directory-based configurations supported
- System Utilities:
bash
,curl
Installation
Laralord Server can be installed using one of the following methods:
- Composer Install:Copy
$ composer require laralord-project/server
To run the server, use the command:
Copy$ ./vendor/bin/laralord server:start
Warning: We don’t recommend this method because Composer will install all dependencies required to build the server, which are not necessary for compiled work.
- Download Binary File:Copy
$ curl https://github.com/laralord-project/Server/releases/download/v0.1.0/laralord \ && chmod +x laralord && mv laralord /usr/bin/laralord
- Docker Image:
The Docker image includes bash helpers for tenant provisioning and management.
Copy$ docker run laralordproject/server:latest
Additional Resources
For more detailed documentation on Laralord Server, refer to the following sections:
GitHub Repository: Visit the Laralord Server GitHub repository for source code, issues, and contributions.
Licensing: Laralord Server is licensed under the MIT License. See the LICENSE file for details.