Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# Install development environment
# Development environment

This collection of scripts provides multiple ways of creating and maintaining your development environment.
This is a collection of Ansible scripts allowing the creation and maintenance of your WSL2 development environment.

## Prerequisites

If you're not already using it, we recommend you to install
[Windows Terminal](https://www.microsoft.com/en-US/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab).
If you're not already using it, we recommend you to install [Windows Terminal](https://www.microsoft.com/en-US/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab).

It's a modern tool that incorporates the power of multiple already known command-line applications like
`Windows PowerShell`, `Linux shell`, and more...
It's a modern tool that incorporates the power of multiple already known command-line applications like `Windows PowerShell`, `Linux shell`, and more...

## How it works?
## Setup

Choose a tool from the below list, and we will guide you through the steps that will install and configure it for you.

- [WSL](wsl/README.md)
- [Docker](docker/README.md)
Go to the [WSL2](wsl/README.md) setup page.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dotkernel/development",
"description": "Set up development environment using Ansible+WSL2/Docker.",
"description": "Set up development environment using WSL2.",
"type": "metapackage",
"license": "MIT",
"authors": [
Expand Down
3 changes: 0 additions & 3 deletions docker/README.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/book/index.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/book/index.md
27 changes: 12 additions & 15 deletions docs/book/v1/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ where `{major}.{minor}` is one of the supported PHP versions: `8.4`, `8.3`, `8.2
Additionally, our setup includes predefined aliases for executing the above command.
The aliases are the following:

- `php81`: switch to PHP 8.1
- `php82`: switch to PHP 8.2
- `php83`: switch to PHP 8.3
- `php83`: switch to PHP 8.4
* `php81`: switch to PHP 8.1
* `php82`: switch to PHP 8.2
* `php83`: switch to PHP 8.3
* `php83`: switch to PHP 8.4

After switching to a different PHP version, test with the following command:

Expand Down Expand Up @@ -47,9 +47,9 @@ where `{major}` is the Node.js version you want to switch to.
Additionally, our setup includes predefined aliases for the above commands.
The aliases are the following:

- `node22`: switch to Node.js 22
- `node20`: switch to Node.js 20
- `node18`: switch to Node.js 18
* `node22`: switch to Node.js 22
* `node20`: switch to Node.js 20
* `node18`: switch to Node.js 18

After switching to a different Node.js version, test with the following command:

Expand All @@ -67,8 +67,7 @@ If running your project, you encounter permission issues, follow the below steps

> PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/data/cache" is not writable...

> PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/data/cache/doctrine" is not
> writable...
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/data/cache/doctrine" is not writable...

### Solution

Expand All @@ -78,8 +77,7 @@ chmod -R 777 data

### Error

> PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/public/uploads" is not
> writable...
> PHP Fatal error: Uncaught InvalidArgumentException: The directory "`<path-to-project>`/public/uploads" is not writable...

### Solution

Expand All @@ -89,8 +87,7 @@ chmod -R 777 public/uploads

### Error

> PHP Fatal error: Uncaught ErrorException: fopen(`<path-to-project>`/log/error-log-yyyy-mm-dd.log): Failed to open
> stream: Permission denied...
> PHP Fatal error: Uncaught ErrorException: fopen(`<path-to-project>`/log/error-log-yyyy-mm-dd.log): Failed to open stream: Permission denied...

### Solution

Expand Down Expand Up @@ -183,8 +180,8 @@ alias command_alias="command to execute"

where:

- `command_alias` is the name by which you want to call your original command
- `command to execute`: the original command to be executed on alias call
* `command_alias` is the name by which you want to call your original command
* `command to execute`: the original command to be executed on alias call

### Example

Expand Down
18 changes: 9 additions & 9 deletions docs/book/v1/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

`dotkernel/development` is a tool that helps you prepare your development environment with the following components:

- **WSL2** - Windows Subsystem for Linux
- **AlmaLinux9** - free and open source Linux distribution
- **PHP** - general-purpose scripting language geared towards web development
- **Apache** - free and open-source cross-platform web server software
- **MariaDB** - community-developed, commercially supported fork of the MySQL relational database management system
- **Git** - distributed version control system
- **Composer** - application-level dependency manager for the PHP
- **Node.js** - JavaScript runtime environment
- **PhpMyAdmin** - open source administration tool for MySQL and MariaDB
* **WSL2**: Windows Subsystem for Linux
* **AlmaLinux9**: free and open source Linux distribution
* **PHP**: general-purpose scripting language geared towards web development
* **Apache**: free and open-source cross-platform web server software
* **MariaDB**: community-developed, commercially supported fork of the MySQL relational database management system
* **Git**: distributed version control system
* **Composer**: application-level dependency manager for the PHP
* **Node.js**: JavaScript runtime environment
* **PhpMyAdmin**: open source administration tool for MySQL and MariaDB
15 changes: 6 additions & 9 deletions docs/book/v1/setup/installation.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Installation

## Install AlmaLinux 9
## Install AlmaLinux9

Open Microsoft Store, in the search box type in: `AlmaLinux` and hit `Enter`.

From the results, select **AlmaLinux 9** - this will take you to **AlmaLinux 9**'s app page.
From the results, select **AlmaLinux OS 9** this will take you to **AlmaLinux9**'s app page.

On this page, locate and click the `Install` button - this will download **AlmaLinux 9** WSL image on your system.
On this page, locate and click the `Install` button - this will download **AlmaLinux9** WSL2 image on your system.

Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open
`Windows Terminal`.
Once the download has finished, the `Install` button is replaced by an `Open` button - clicking it will open `Windows Terminal`.

Here you will be asked to fill in your username (for example `dotkernel`):

Expand All @@ -20,17 +19,15 @@ For more information visit: https://aka.ms/wslusers
Enter new UNIX username:
```

Next, you are prompted to enter a password to use with your username (you will not see what you are typing, that's a
security measure in Linux regarding passwords):
Next, you are prompted to enter a password to use with your username (you will not see what you are typing, that's a security measure in Linux regarding passwords):

```text
Enter new UNIX username: dotkernel.
Changing password for user dotkernel.
New password:
```

Depending on the strength of your password, you might see one of the following messages (if you want to choose a
different password, hit `Enter` and you are taken back to previous step - else, continue with retyping your password).
Depending on the strength of your password, you might see one of the following messages (if you want to choose a different password, hit `Enter` and you are taken back to previous step - else, continue with retyping your password).

```text
BAD PASSWORD: The password fails the dictionary check - it is based on a dictionary word
Expand Down
33 changes: 15 additions & 18 deletions docs/book/v1/setup/setup-packages.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setup the packages in AlmaLinux 9
# Setup the packages in AlmaLinux9

Install requirements:
Install system requirements:

```shell
sudo dnf install epel-release dnf-utils https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
Expand Down Expand Up @@ -40,20 +40,19 @@ Install requirements and initialize systemd by running the below Ansible command
ansible-playbook -i hosts install.yml --ask-become-pass
```

The installation process will ask for your password (set during the installation process) and will iterate over each
task in the playbook and will output a short summary with the results.
The installation process will ask for your password (set during the installation process) and will iterate over each task in the playbook and will output a short summary with the results.

At this step, **AlmaLinux 9** needs to be restarted - quit it by pressing `Control` + `d`.
At this step, **AlmaLinux9** needs to be restarted; quit it by pressing `Control` + `d`.

Open `Windows Terminal`.

Stop **AlmaLinux 9**:
Stop **AlmaLinux9**:

```shell
wsl -t AlmaLinux9
```

Start **AlmaLinux 9**:
Start **AlmaLinux9**:

```shell
wsl -d AlmaLinux9
Expand All @@ -65,35 +64,33 @@ Move inside the directory `development/wsl`:
cd ~/development/wsl/
```

Continue installation by running the below Ansible command:
Continue the installation by running the below Ansible command:

```shell
ansible-playbook -i hosts install.yml --ask-become-pass
```

The installation process will ask for your password (set during the installation process) and will iterate over each
task in the playbook and will output a short summary with the results.
The installation process will ask for your password (set during the installation process) and will iterate over each task in the playbook and will output a short summary with the results.

Now check if everything works by opening in your browser:

- [http://localhost/](http://localhost/) - Apache's default home page
- [http://localhost/info.php](http://localhost/info.php) - PHP info page
- [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/) - PhpMyAdmin (login with `root` + the root password you
configured in `config.yml` under `mariadb` -> `root_password`)
* [http://localhost/](http://localhost/): Apache's default home page
* [http://localhost/info.php](http://localhost/info.php): PHP info page
* [http://localhost/phpmyadmin/](http://localhost/phpmyadmin/): PhpMyAdmin (login with `root` + the root password you configured in `config.yml` under `mariadb` -> `root_password`)

The installation is complete, your **AlmaLinux 9** development environment is ready to use.
The installation is complete, your **AlmaLinux9** development environment is ready to use.

## Running AlmaLinux 9
## Running AlmaLinux9

Open `Windows Terminal`.

Start **AlmaLinux 9**:
Start **AlmaLinux9**:

```shell
wsl -d AlmaLinux9
```

### Note

> In order to run your applications using WSL2, you always need to be connected to your AlmaLinux9 distribution.
> To run your applications using WSL2, you always need to be connected to your AlmaLinux9 distribution.
> For this, all you need to do is to keep open an instance of Windows Terminal that is connected to it.
27 changes: 10 additions & 17 deletions docs/book/v1/setup/system-requirements.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# System Requirements

First, you need to check if your system is ready for using **WSL2**. Open `Windows Terminal` and execute the following
command:
First, you need to check if your system is ready for using **WSL2**. Open `Windows Terminal` and execute the following command:

```shell
wsl -v
Expand All @@ -19,28 +18,23 @@ DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.3737
```

If the output starts with `WSL version: 2.x`, you are ready to use **WSL2** and can continue with
[the installation](installation.md).
If the output starts with `WSL version: 2.x`, you are ready to use **WSL2** and can continue with [the installation](installation.md).

Else, you need to install **WSL2** and it's components as shown below.
Else, you need to install **WSL2** and its components as shown below.

Before proceeding with the installation, please consult Microsoft's
[documentation](https://learn.microsoft.com/en-us/windows/wsl/install#prerequisites) regarding the minimum requirements
for running **WSL2**.
Before proceeding with the installation, please consult Microsoft's [documentation](https://learn.microsoft.com/en-us/windows/wsl/install#prerequisites) regarding the minimum requirements for running **WSL2**.

Once you know that your system can run **WSL2**, open the `Run` prompt by pressing `Win`+`r` and type in the dialog
`OptionalFeatures`, then press `Enter`.
Once you know that your system can run **WSL2**, open the `Run` prompt by pressing `Win`+`r` and type in the dialog `OptionalFeatures`, then press `Enter`.

This will open a window where you can turn Windows features on/off.

Make sure the next features are activated (checked):

- `Hyper-V` (including its sub-features)
- `Virtual Machine Platform`
- `Windows Subsystem for Linux`
* `Hyper-V` (including its sub-features)
* `Virtual Machine Platform`
* `Windows Subsystem for Linux`

> If any of the above features is missing, then first you need to install them manually using
> [this guide](https://docs.microsoft.com/en-us/windows/wsl/install-manual) and then continue with the below steps.
> If any of the above features are missing, then first you need to install them manually using [this guide](https://docs.microsoft.com/en-us/windows/wsl/install-manual) and then continue with the below steps.

Click `Ok` and restart your computer.

Expand All @@ -58,5 +52,4 @@ To test, run again the following command:
wsl -v
```

This time the output should display `WSL version: 2.x`, which means that your system is ready for using **WSL2** and you
can continue with the [installation](installation.md).
This time the output should display `WSL version: 2.x`, which means that your system is ready for using **WSL2** and you can continue with the [installation](installation.md).
31 changes: 12 additions & 19 deletions docs/book/v1/virtualhosts/create-virtualhost.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Move inside the directory `development/wsl`:
cd ~/development/wsl/
```

Using your preferred text editor, open `config.yml` and, under the `virtualhosts` key, enter the virtualhosts that you
want to create, each on its own line.
Using your preferred text editor, open `config.yml` and, under the `virtualhosts` key, enter the virtualhosts that you want to create, each on its own line.

Already existing virtualhosts will be skipped, their contents will not be lost, no need to comment or remove them.

Expand All @@ -19,27 +18,21 @@ Create the specified virtualhosts:
ansible-playbook -i hosts create-virtualhost.yml --ask-become-pass
```

This process will ask for your password (set during the installation process) and then iterate over the list of
configured `virtualhosts` and will output a short summary with the results.
This process will ask for your password (set during the installation process) and then iterate over the list of configured `virtualhosts` and will output a short summary with the results.

Your virtualhost should be accessible and ready to use.

You will install your project under the `html` directory of your project, for example:
`/var/www/example.localhost/html`.
You will install your project under the `html` directory of your project, for example `/var/www/example.localhost/html`.

> The virtualhost's document root is set to the `public` directory of the above location, for example
> `/var/www/example.localhost/html/public`.
>
> If you want to have the DocumentRoot directly in `html` folder, you need to modify the file
> `/etc/httpd/sites-available/example.localhost`.
> The virtualhost's document root is set to the `public` directory of the above location, for example `/var/www/example.localhost/html/public`.

> If you want to have the DocumentRoot directly in `html` folder, you need to modify the file `/etc/httpd/sites-available/example.localhost`.

## Good to know

- In order to run your installed projects, you need to start AlmaLinux 9 first.
- If you work with virtualhosts, your projects are created under `/var/www/`.
- You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`.
- If you encounter write permission issues, see [this guide](../faq.md#how-do-i-fix-common-permission-issues).
- This tool installs PHP 8.3 by default. If you need a different version, see
[this guide](../faq.md#how-do-i-switch-to-a-different-version-of-php).
- This tool installs Node.js 22 by default. If you need a different version, see
[this guide](../faq.md#how-do-i-switch-to-a-different-version-of-nodejs).
* To run your installed projects, you need to start AlmaLinux9 first.
* If you work with virtualhosts, your projects are created under `/var/www/`.
* You can still run PHP scripts under the default Apache project directory, located at `/var/www/html/`.
* If you encounter write permission issues, see [this guide](../faq.md#how-do-i-fix-common-permission-issues).
* This tool installs PHP 8.3 by default. If you need a different version, see [this guide](../faq.md#how-do-i-switch-to-a-different-version-of-php).
* This tool installs Node.js 22 by default. If you need a different version, see [this guide](../faq.md#how-do-i-switch-to-a-different-version-of-nodejs).
9 changes: 4 additions & 5 deletions wsl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ This will open a window where you can turn Windows features on/off.

Make sure the next features are activated (checked):

- `Hyper-V` (including its sub-features)
- `Virtual Machine Platform`
- `Windows Subsystem for Linux`
* `Hyper-V` (including its sub-features)
* `Virtual Machine Platform`
* `Windows Subsystem for Linux`

> If any of the above features are missing, then first you need to install them manually using [this guide](https://docs.microsoft.com/en-us/windows/wsl/install-manual) and then continue with the below steps.

Expand All @@ -30,5 +30,4 @@ wsl --set-default-version 2

## Choose the Operating System you want to use for development:

- [Ubuntu 20](os/ubuntu20/README.md)
- [AlmaLinux 9](os/almalinux9/README.md)
* [AlmaLinux9](os/almalinux9/README.md)
2 changes: 0 additions & 2 deletions wsl/create-virtualhost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@
assert:
that: os in os_list
msg: "Operating System '{{ ansible_distribution }} {{ ansible_distribution_major_version }}' is not supported"
- import_playbook: "{{ playbook_dir }}/os/ubuntu20/create-virtualhost.yml"
when: os == "ubuntu20"
- import_playbook: "{{ playbook_dir }}/os/almalinux9/create-virtualhost.yml"
when: os == "almalinux9"
2 changes: 0 additions & 2 deletions wsl/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@
assert:
that: os in os_list
msg: "Operating System '{{ ansible_distribution }} {{ ansible_distribution_major_version }}' is not supported"
- import_playbook: "{{ playbook_dir }}/os/ubuntu20/install.yml"
when: os == "ubuntu20"
- import_playbook: "{{ playbook_dir }}/os/almalinux9/install.yml"
when: os == "almalinux9"
Loading