Skip to content

Commit 4ae8cb9

Browse files
authored
Merge pull request #75 from dotkernel/issue-74
Issue #74: Unable to start `Apache`/`MariaDB` on startup
2 parents bdef023 + 215b922 commit 4ae8cb9

File tree

8 files changed

+70
-6
lines changed

8 files changed

+70
-6
lines changed

docs/book/v1/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
* **Apache**: free and open-source cross-platform web server software
99
* **MariaDB**: community-developed, commercially supported fork of the MySQL relational database management system
1010
* **Git**: distributed version control system
11-
* **Composer**: application-level dependency manager for the PHP
11+
* **Composer**: application-level dependency manager
1212
* **Node.js**: JavaScript runtime environment
1313
* **PhpMyAdmin**: open source administration tool for MySQL and MariaDB

docs/book/v1/setup/installation.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@ OracleLinux_9_1 Oracle Linux 9.1
7272

7373
Note the two columns: **NAME** and **FRIENDLY NAME**.
7474
To install a specific distro, use the value from the **NAME** column, in this case: `AlmaLinux-9`.
75+
76+
> If you try to install a distro that is already installed, the installation process will fail:
77+
78+
```text
79+
Downloading: AlmaLinux OS 9
80+
Installing: AlmaLinux OS 9
81+
A distribution with the supplied name already exists. Use --name to choose a different name.
82+
Error code: Wsl/InstallDistro/Service/RegisterDistro/ERROR_ALREADY_EXISTS
83+
```
84+
7585
Install the AlmaLinux9 distro by executing the below command:
7686

7787
```shell
7888
wsl --install -d AlmaLinux-9
7989
```
8090

81-
You should see the download progress - once finished, the output should look like this:
91+
You should see the download progressonce finished, the output should look like this:
8292

8393
```text
8494
Downloading: AlmaLinux OS 9
@@ -101,7 +111,7 @@ Changing password for user dotkernel.
101111
New password:
102112
```
103113

104-
Depending on the strength of your password, you might get a `BAD PASSWORD: <some-reason>` 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):
114+
Depending on the strength of your password, you might get a `BAD PASSWORD: <some-reason>` message (if you want to choose a different password, hit `Enter` and you are taken back to the previous stepelse, continue with retyping your password):
105115

106116
Next, you are asked to retype your password:
107117

docs/book/v1/virtualhosts/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Using this tool, you configure a virtualhost for each of your applications, and
77
**Example**:
88

99
* `api.dotkernel.localhost`: this could be the endpoint where you host your website's API
10-
* `frontend.dotkernel.localhost`: this could be domain you host your website's frontend that will consume the API
10+
* `frontend.dotkernel.localhost`: this could be the subdomain you host your website's frontend that will consume the API
1111

1212
In the above example, the URLs are built like this:
1313

wsl/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,23 @@ OracleLinux_9_1 Oracle Linux 9.1
7272

7373
Note the two columns: **NAME** and **FRIENDLY NAME**.
7474
To install a specific distro, use the value from the **NAME** column, in this case: `AlmaLinux-9`.
75+
76+
> If you try to install a distro that is already installed, the installation process will fail:
77+
78+
```text
79+
Downloading: AlmaLinux OS 9
80+
Installing: AlmaLinux OS 9
81+
A distribution with the supplied name already exists. Use --name to choose a different name.
82+
Error code: Wsl/InstallDistro/Service/RegisterDistro/ERROR_ALREADY_EXISTS
83+
```
84+
7585
Install the AlmaLinux9 distro by executing the below command:
7686

7787
```shell
7888
wsl --install -d AlmaLinux-9
7989
```
8090

81-
You should see the download progress - once finished, the output should look like this:
91+
You should see the download progress-once finished, the output should look like this:
8292

8393
```text
8494
Downloading: AlmaLinux OS 9
@@ -101,7 +111,7 @@ Changing password for user dotkernel.
101111
New password:
102112
```
103113

104-
Depending on the strength of your password, you might get a `BAD PASSWORD: <some-reason>` 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):
114+
Depending on the strength of your password, you might get a `BAD PASSWORD: <some-reason>` message (if you want to choose a different password, hit `Enter` and you are taken back to the previous stepelse, continue with retyping your password):
105115

106116
Next, you are asked to retype your password:
107117

wsl/roles/system/tasks/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,24 @@
2222
template:
2323
src: bash_profile.j2
2424
dest: "{{ bash_profile_dest }}"
25+
- name: Add create runtime directories script
26+
template:
27+
src: runtime-directories.sh.j2
28+
dest: "{{ runtime_directories_script_path }}"
29+
mode: "0755"
30+
- name: Add create runtime directories service
31+
template:
32+
src: runtime-directories.service.j2
33+
dest: "{{ runtime_directories_service_path }}"
34+
mode: "0755"
35+
- name: Reload systemd
36+
ansible.builtin.systemd:
37+
daemon_reload: yes
38+
- name: Enable runtime-directories.service
39+
ansible.builtin.systemd:
40+
name: runtime-directories.service
41+
enabled: yes
42+
- name: Start runtime-directories.service
43+
ansible.builtin.systemd:
44+
name: runtime-directories.service
45+
state: started
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Create runtime directories for Apache and MariaDB
3+
DefaultDependencies=no
4+
After=local-fs.target
5+
Before=httpd.service mariadb.service
6+
7+
[Service]
8+
Type=oneshot
9+
ExecStart={{ runtime_directories_script_path }}
10+
RemainAfterExit=true
11+
12+
[Install]
13+
WantedBy=multi-user.target
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Create /run/httpd with correct ownership and permissions
5+
install -d -o apache -g apache -m 0755 /run/httpd
6+
7+
# Create /run/mariadb with correct ownership and permissions
8+
install -d -o mysql -g mysql -m 0755 /run/mariadb

wsl/roles/system/vars/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
---
22
wsl_config_dest: /etc/wsl.conf
33
bash_profile_dest: "/home/{{ config.system.username }}/.bash_profile"
4+
runtime_directories_script_path: "/usr/local/bin/runtime-directories.sh"
5+
runtime_directories_service_path: "/etc/systemd/system/runtime-directories.service"

0 commit comments

Comments
 (0)