postgresql

This commit is contained in:
marito 2025-06-16 17:59:37 +08:00
parent 15335984a3
commit 900d24075f

View File

@ -10,11 +10,16 @@ It's a fast, simple alternative to tools like Homestead or Laragon that uses Ans
* **WSL-Optimized:** Automatically configures WSL for optimal performance and file permissions.
## Prerequisites
* **Ubuntu 22.04 or higher** (or WSL2 with Ubuntu).
* **Ansible & Git:** Must be installed on the machine.
* **Sudo Access:** Your user must have `sudo` privileges.
* **Core Dependencies:** You need Ansible, Git, and the Ansible collection for PostgreSQL management. You can install all of them with these two commands.
**1. Install System Packages:**
```bash
sudo apt update && sudo apt install ansible git -y
```
* **Sudo Access:** Your user must have `sudo` privileges.
**2. Install Ansible PostgreSQL Collection:**
```bash
ansible-galaxy collection install community.postgresql
```
## How to Run
### 1. Get the Code
Clone the repository to a convenient location, like your home directory.
@ -87,9 +92,9 @@ Add an entry for each domain defined in `Lenvi.yaml`:
```
### 2. Configure Your Application (`.env`)
Update your application's `.env` file to use the database credentials from `Lenvi.yaml`.
**Example `.env` for `mylaravelapp.local`:**
**Example `.env` for `mylaravelapp.local` (MariaDB/MySQL):**
```env
DB_CONNECTION=mysql # Works for both mysql and mariadb
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_db
@ -100,6 +105,15 @@ REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
```
**Example `.env` for a PostgreSQL project:**
```env
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel_db_pg
DB_USERNAME=Lenvi
DB_PASSWORD=secret
```
### 3. Verify Your Setup
* **Web Access:** Open your browser and navigate to `http://mylaravelapp.local`.
* **Smart PHP Version:** The `php`, `composer`, and `artisan` commands are context-aware.