|
1 | 1 | # Development environment |
2 | 2 |
|
3 | | -This repo provisions a full local development environment for any PHP framework or project, using an Ansible playbook, runnable directly on Linux or inside WSL 2 on Windows. |
| 3 | +A local PHP development stack on **AlmaLinux 10**, compatible with RHEL, that runs inside WSL 2 on Windows or directly on a Linux host. |
| 4 | +A single Ansible playbook installs and configures the whole stack, and a second one provisions a virtualhost for each of your projects. |
| 5 | +It works with any PHP framework or project. |
| 6 | + |
| 7 | +## Why use it |
| 8 | + |
| 9 | +- **Production parity** — AlmaLinux matches the RHEL-compatible distributions commonly used in staging and production, so what runs locally behaves the same once deployed. |
| 10 | +- **One-command setup** — go from Windows Terminal through WSL 2 to a fully provisioned AlmaLinux 10 via Ansible, with no manual configuration. |
| 11 | +- **Automatic virtualhosts** — every project gets its own `*.localhost` subdomain, with no edits to the Windows `hosts` file. |
| 12 | +- **Version switching** — shell aliases switch between PHP 8.1–8.5 and Node.js 18–24 in a single command. |
4 | 13 |
|
5 | 14 | ## What you get |
6 | 15 |
|
7 | | -Running the playbook installs and configures: |
| 16 | +Running `install.yml` installs and configures: |
8 | 17 |
|
9 | | -* Apache |
10 | | -* PHP-FPM (version pinned in `wsl/roles/php/tasks/main.yml`) |
11 | | -* MariaDB (version pinned in `wsl/roles/mariadb/templates/MariaDB.repo.j2`) |
12 | | -* phpMyAdmin |
13 | | -* Composer |
14 | | -* Node.js 22 |
| 18 | +| Component | Details | |
| 19 | +| --- | --- | |
| 20 | +| Web server | Apache, routing `*.localhost` domains to your projects | |
| 21 | +| PHP | PHP-FPM 8.5 by default; 8.1–8.5 available via the `php81` … `php85` aliases | |
| 22 | +| Database | MariaDB 12.3, plus phpMyAdmin | |
| 23 | +| Node.js | 22 by default; 18–24 available via the `node18` … `node24` aliases | |
| 24 | +| Tools | Composer, Git (configured with your name and email) and the required Ansible collections | |
15 | 25 |
|
16 | | -## Which version should I use? |
| 26 | +The pinned versions live in `wsl/roles/php/tasks/main.yml`, `wsl/roles/mariadb/templates/MariaDB.repo.j2` and `wsl/roles/nodejs/tasks/main.yml`. |
17 | 27 |
|
18 | | -Two versions of this guide are maintained: |
| 28 | +## Quick start |
| 29 | + |
| 30 | +The full step-by-step guide is at <https://docs.dotkernel.org/development/v2/>; the outline is below. |
| 31 | + |
| 32 | +1. **Check the requirements** — in Windows Terminal, confirm WSL 2 is available with `wsl -v`. |
| 33 | + See [System Requirements](https://docs.dotkernel.org/development/v2/setup/system-requirements/). |
| 34 | +2. **Install AlmaLinux 10** — still in Windows Terminal, run `wsl --install -d AlmaLinux-10` and create your Unix user. |
| 35 | + See [Installation](https://docs.dotkernel.org/development/v2/setup/installation/). |
| 36 | +3. **Run the playbook** — inside AlmaLinux 10, install Ansible and the system packages, clone this repository, create your `config.yml` and run the installer: |
| 37 | + |
| 38 | + ```shell |
| 39 | + sudo dnf install epel-release dnf-utils https://rpms.remirepo.net/enterprise/remi-release-$(rpm -E %almalinux).rpm -y |
| 40 | + sudo dnf install ansible-core -y |
| 41 | + ansible-galaxy collection install community.general community.mysql |
| 42 | + cd ~ |
| 43 | + git clone --branch alma-linux-10 --single-branch https://github.com/dotkernel/development.git |
| 44 | + cd development/wsl/ |
| 45 | + cp config.yml.dist config.yml |
| 46 | + ansible-playbook -i hosts install.yml --ask-become-pass |
| 47 | + ``` |
| 48 | + |
| 49 | + Fill in your Git identity and MariaDB root password in `config.yml` before running the playbook. |
| 50 | + See [Setup Packages](https://docs.dotkernel.org/development/v2/setup/setup-packages/). |
19 | 51 |
|
20 | | -* **v2** targets **AlmaLinux 10** and is the current, actively maintained version - start here unless you have a specific reason not to. |
21 | | -* **v1** targets **AlmaLinux 9**, for environments that haven't moved to AlmaLinux 10 yet. |
| 52 | +New to Windows Terminal? |
| 53 | +Start with [Terminal](https://docs.dotkernel.org/development/v2/terminal/). |
| 54 | +On a native Linux host, skip steps 1 and 2 and go straight to [Setup Packages](https://docs.dotkernel.org/development/v2/setup/setup-packages/). |
22 | 55 |
|
23 | | -## Getting started |
| 56 | +> This stack is for **local development only**. |
| 57 | +> Security is relaxed by default: the MariaDB root password is stored in plaintext in `config.yml`, and phpMyAdmin allows root login. |
| 58 | +> Never expose it to a network. |
| 59 | + |
| 60 | +## Virtualhosts |
| 61 | + |
| 62 | +List the domains you want under the `virtualhosts` key in `wsl/config.yml`, then run: |
| 63 | + |
| 64 | +```shell |
| 65 | +ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass |
| 66 | +``` |
| 67 | + |
| 68 | +Each domain gets its own directory at `/var/www/<domain>/html`, with Apache serving its `public/` subdirectory as the document root. |
| 69 | +Virtualhosts that already exist are skipped, so you can re-run the playbook whenever you add a project. |
| 70 | +See [Virtualhosts](https://docs.dotkernel.org/development/v2/virtualhosts/overview/) for details. |
| 71 | + |
| 72 | +## Which version should I use? |
| 73 | + |
| 74 | +Two versions of this guide are maintained: |
24 | 75 |
|
25 | | -Full documentation is published at <https://docs.dotkernel.org/development/v2/>. |
| 76 | +- **v2** targets **AlmaLinux 10** and is the current, actively maintained version — start here unless you have a specific reason not to. |
| 77 | +- **v1** targets **AlmaLinux 9**, for environments that haven't moved to AlmaLinux 10 yet. |
26 | 78 |
|
27 | | -If you're using WSL 2 (Windows Subsystem for Linux) to run your development environment, start with [Terminal](https://docs.dotkernel.org/development/v2/terminal/) to install Windows Terminal, then continue to [System Requirements](https://docs.dotkernel.org/development/v2/setup/system-requirements/). |
| 79 | +## Resources |
28 | 80 |
|
29 | | -If you're not using WSL (for example, a native Linux host), you can jump straight to [Setup Packages](https://docs.dotkernel.org/development/v2/setup/setup-packages/). |
| 81 | +- [Full documentation](https://docs.dotkernel.org/development/v2/) |
| 82 | +- [Landing page](https://www.dotkernel.com/wsl2/) |
| 83 | +- [FAQ](https://docs.dotkernel.org/development/v2/faq/) |
| 84 | +- [Contact the Dotkernel team](https://www.dotkernel.com/contact/) |
0 commit comments