Lenverge/README.md
2025-06-15 08:14:58 +08:00

54 lines
2.1 KiB
Markdown

# Lenvi Ansible Provisioner
Lenvi is a lightweight, Ansible-powered tool for managing local Laravel development environments. It provides a Homestead-like experience without the overhead of a virtual machine, running natively on Linux or on Windows via WSL2.
## Features
- **Centralized Configuration:** Manage all your projects from a single `lenvi.yaml` file.
- **Multi-PHP:** Assign a specific PHP version (e.g., 8.0, 8.2, 8.3) to each site.
- **Database Support:** Automatically creates databases using a shared MariaDB, MySQL, or PostgreSQL server.
- **Idempotent:** Safely run the provisioner at any time to update your environment.
## Prerequisites
1. **Ansible:** You must have Ansible installed.
```bash
# On Debian/Ubuntu
sudo apt update
sudo apt install python3-pip -y
pip3 install ansible
```
2. **WSL2 (for Windows users):** Install WSL2 and a Linux distribution like **Ubuntu 22.04** from the Microsoft Store. All subsequent commands must be run from the WSL2 terminal.
## How to Use
1. **Clone this repository:**
```bash
git clone <your-repo-url> ~/tools/lenvi_ansible
```
2. **Configure `lenvi.yaml`:**
Open `~/tools/lenvi_ansible/lenvi.yaml` and configure it for your projects. Set your `db_engine` and list all your sites under the `sites` key.
3. **Run the Playbook:**
Navigate to the `lenvi_ansible` directory and run the main playbook.
```bash
cd ~/tools/lenvi_ansible
ansible-playbook playbook.yml --ask-become-pass
```
Ansible will ask for your `sudo` password to install software and configure services.
### Important Note for Windows (WSL2) Users
For your Windows browser (Chrome, Firefox, etc.) to access a site like `myapp.test`, you must manually edit the **Windows hosts file**.
1. Open **Notepad** as an **Administrator**.
2. Open the file: `C:\Windows\System32\drivers\etc\hosts`
3. For each site in your `lenvi.yaml`, add a new line:
```
127.0.0.1 myapp.test
127.0.0.1 another-app.test
```
4. Save the file. You only need to do this once per new domain.
You can now access your sites in your browser!