Logo image

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.

Test StatusGitHub ReleaseDocker Image Version

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

  1. 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.
  2. 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.
  3. 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.
  4. Dynamic Credentials Update:
    • Periodically fetch and update credentials from HashiCorp Vault, ensuring tenant environments use the latest credentials.
  5. Containerization Support:
    • Built for containerization, offering simple and clear configuration, even through environment variables.
  6. 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.

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:

  1. Composer Install:
    $ composer require laralord-project/server
    Copy

    To run the server, use the command:

    $ ./vendor/bin/laralord server:start
    Copy

    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.

  2. Download Binary File:
    $ curl https://github.com/laralord-project/Server/releases/download/v0.1.0/laralord \
        && chmod +x laralord && mv laralord /usr/bin/laralord
    Copy
  3. Docker Image:

    The Docker image includes bash helpers for tenant provisioning and management.

    $ docker run laralordproject/server:latest
    Copy

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.

Laralord © 2024UI Build: 0.1.0-rc1-42-g4cde