diff --git a/docs/book/v1/introduction.md b/docs/book/v1/introduction.md index c681173..6a3208f 100644 --- a/docs/book/v1/introduction.md +++ b/docs/book/v1/introduction.md @@ -8,6 +8,6 @@ * **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 +* **Composer**: application-level dependency manager * **Node.js**: JavaScript runtime environment * **PhpMyAdmin**: open source administration tool for MySQL and MariaDB diff --git a/docs/book/v1/setup/installation.md b/docs/book/v1/setup/installation.md index 8bcbd04..57280cd 100644 --- a/docs/book/v1/setup/installation.md +++ b/docs/book/v1/setup/installation.md @@ -72,13 +72,23 @@ OracleLinux_9_1 Oracle Linux 9.1 Note the two columns: **NAME** and **FRIENDLY NAME**. To install a specific distro, use the value from the **NAME** column, in this case: `AlmaLinux-9`. + +> If you try to install a distro that is already installed, the installation process will fail: + +```text +Downloading: AlmaLinux OS 9 +Installing: AlmaLinux OS 9 +A distribution with the supplied name already exists. Use --name to choose a different name. +Error code: Wsl/InstallDistro/Service/RegisterDistro/ERROR_ALREADY_EXISTS +``` + Install the AlmaLinux9 distro by executing the below command: ```shell wsl --install -d AlmaLinux-9 ``` -You should see the download progress - once finished, the output should look like this: +You should see the download progress—once finished, the output should look like this: ```text Downloading: AlmaLinux OS 9 @@ -101,7 +111,7 @@ Changing password for user dotkernel. New password: ``` -Depending on the strength of your password, you might get a `BAD PASSWORD: ` message (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 get a `BAD PASSWORD: ` message (if you want to choose a different password, hit `Enter` and you are taken back to the previous step—else, continue with retyping your password): Next, you are asked to retype your password: diff --git a/docs/book/v1/virtualhosts/overview.md b/docs/book/v1/virtualhosts/overview.md index 7dbb17e..5326fb5 100644 --- a/docs/book/v1/virtualhosts/overview.md +++ b/docs/book/v1/virtualhosts/overview.md @@ -7,7 +7,7 @@ Using this tool, you configure a virtualhost for each of your applications, and **Example**: * `api.dotkernel.localhost`: this could be the endpoint where you host your website's API -* `frontend.dotkernel.localhost`: this could be domain you host your website's frontend that will consume the API +* `frontend.dotkernel.localhost`: this could be the subdomain you host your website's frontend that will consume the API In the above example, the URLs are built like this: diff --git a/wsl/README.md b/wsl/README.md index ce9a9dd..caaca4d 100644 --- a/wsl/README.md +++ b/wsl/README.md @@ -72,13 +72,23 @@ OracleLinux_9_1 Oracle Linux 9.1 Note the two columns: **NAME** and **FRIENDLY NAME**. To install a specific distro, use the value from the **NAME** column, in this case: `AlmaLinux-9`. + +> If you try to install a distro that is already installed, the installation process will fail: + +```text +Downloading: AlmaLinux OS 9 +Installing: AlmaLinux OS 9 +A distribution with the supplied name already exists. Use --name to choose a different name. +Error code: Wsl/InstallDistro/Service/RegisterDistro/ERROR_ALREADY_EXISTS +``` + Install the AlmaLinux9 distro by executing the below command: ```shell wsl --install -d AlmaLinux-9 ``` -You should see the download progress - once finished, the output should look like this: +You should see the download progress-once finished, the output should look like this: ```text Downloading: AlmaLinux OS 9 @@ -101,7 +111,7 @@ Changing password for user dotkernel. New password: ``` -Depending on the strength of your password, you might get a `BAD PASSWORD: ` message (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 get a `BAD PASSWORD: ` message (if you want to choose a different password, hit `Enter` and you are taken back to the previous step—else, continue with retyping your password): Next, you are asked to retype your password: diff --git a/wsl/roles/system/tasks/main.yml b/wsl/roles/system/tasks/main.yml index fe0e7f1..b96f5c4 100644 --- a/wsl/roles/system/tasks/main.yml +++ b/wsl/roles/system/tasks/main.yml @@ -22,3 +22,24 @@ template: src: bash_profile.j2 dest: "{{ bash_profile_dest }}" +- name: Add create runtime directories script + template: + src: runtime-directories.sh.j2 + dest: "{{ runtime_directories_script_path }}" + mode: "0755" +- name: Add create runtime directories service + template: + src: runtime-directories.service.j2 + dest: "{{ runtime_directories_service_path }}" + mode: "0755" +- name: Reload systemd + ansible.builtin.systemd: + daemon_reload: yes +- name: Enable runtime-directories.service + ansible.builtin.systemd: + name: runtime-directories.service + enabled: yes +- name: Start runtime-directories.service + ansible.builtin.systemd: + name: runtime-directories.service + state: started diff --git a/wsl/roles/system/templates/runtime-directories.service.j2 b/wsl/roles/system/templates/runtime-directories.service.j2 new file mode 100644 index 0000000..ae28193 --- /dev/null +++ b/wsl/roles/system/templates/runtime-directories.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=Create runtime directories for Apache and MariaDB +DefaultDependencies=no +After=local-fs.target +Before=httpd.service mariadb.service + +[Service] +Type=oneshot +ExecStart={{ runtime_directories_script_path }} +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target diff --git a/wsl/roles/system/templates/runtime-directories.sh.j2 b/wsl/roles/system/templates/runtime-directories.sh.j2 new file mode 100644 index 0000000..a3fcf7d --- /dev/null +++ b/wsl/roles/system/templates/runtime-directories.sh.j2 @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +# Create /run/httpd with correct ownership and permissions +install -d -o apache -g apache -m 0755 /run/httpd + +# Create /run/mariadb with correct ownership and permissions +install -d -o mysql -g mysql -m 0755 /run/mariadb diff --git a/wsl/roles/system/vars/main.yml b/wsl/roles/system/vars/main.yml index e9a659d..b915f62 100644 --- a/wsl/roles/system/vars/main.yml +++ b/wsl/roles/system/vars/main.yml @@ -1,3 +1,5 @@ --- wsl_config_dest: /etc/wsl.conf bash_profile_dest: "/home/{{ config.system.username }}/.bash_profile" +runtime_directories_script_path: "/usr/local/bin/runtime-directories.sh" +runtime_directories_service_path: "/etc/systemd/system/runtime-directories.service"