Skip to content

Commit af741be

Browse files
authored
Merge pull request #228 from ByteInternet/install_laravel_on_hypernode
2 parents c453d27 + a797a9d commit af741be

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

docs/framework/laravel.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
myst:
3+
html_meta:
4+
description: This table of contents gives an overview of all Laravel related articles
5+
for Hypernode.
6+
title: Laravel on Hypernode | Everything you need to know
7+
---
8+
9+
# Laravel
10+
11+
```{toctree}
12+
---
13+
caption: Table of Contents
14+
maxdepth: 1
15+
glob:
16+
---
17+
laravel/*
18+
```
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
myst:
3+
html_meta:
4+
description: This article will explain how to install Laravel on your Hypernode.
5+
Laravel is a PHP framework that is used to build web applications.
6+
title: How to install Laravel on Hypernode
7+
---
8+
9+
# How to install Laravel on Hypernode
10+
11+
This article will explain how to install Laravel on your Hypernode. Laravel is a PHP framework that is used to build web applications.
12+
13+
## Upgrade your PHP version
14+
15+
Laravel only has a few system requirements. One of which, is that PHP needs to be at least 8.1. Run the following command to upgrade to PHP 8.1:
16+
17+
```console
18+
app@abcdef-example-magweb-cmbl:~$ hypernode-systemctl settings php_version 8.2
19+
```
20+
21+
## Installing Laravel
22+
23+
To install Laravel, there are two options:
24+
25+
1. Using our preinstall command-line tool
26+
1. Installing Laravel manually
27+
28+
### Install Laravel using the preinstall
29+
30+
On Hypernode we offer an easy way to install Laravel using one of our preinstall presets. Use the following command to install Laravel:
31+
32+
```console
33+
app@abcdef-example-magweb-cmbl:~$ hypernode-systemctl preinstall laravel
34+
```
35+
36+
To follow the progress of the preinstall, run the program `livelog`.
37+
38+
### Installing Laravel manually
39+
40+
Manual installation is also possible, which also doesn't take much time.
41+
42+
First you need to create a database for the Laravel application and create some directories:
43+
44+
```console
45+
app@abcdef-example-magweb-cmbl:~$ echo create database laravel | mysql
46+
```
47+
48+
Then you can install Laravel using Composer:
49+
50+
```console
51+
app@abcdef-example-magweb-cmbl:~$ composer create-project laravel/laravel /data/web/laravel
52+
```
53+
54+
Before we can run the application, we need to adjust some configurations. Open the `.env` file in the root of the Laravel application and run the following commands:
55+
56+
```console
57+
app@abcdef-example-magweb-cmbl:~$ export MYSQL_PASSWORD=$(grep password /data/web/.my.cnf | awk '{print $3}')
58+
app@abcdef-example-magweb-cmbl:~$ sed -i "s/DB_HOST=.*/DB_HOST=mysqlmaster/g" /data/web/laravel/.env
59+
app@abcdef-example-magweb-cmbl:~$ sed -i "s/DB_DATABASE=.*/DB_DATABASE=laravel/g" /data/web/laravel/.env
60+
app@abcdef-example-magweb-cmbl:~$ sed -i "s/DB_USERNAME=.*/DB_USERNAME=app/g" /data/web/laravel/.env
61+
app@abcdef-example-magweb-cmbl:~$ sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=$MYSQL_PASSWORD/g" /data/web/laravel/.env
62+
app@abcdef-example-magweb-cmbl:~$ sed -i "s/REDIS_HOST=.*/REDIS_HOST=redismaster/g" /data/web/laravel/.env
63+
app@abcdef-example-magweb-cmbl:~$ sed -i "s/MAIL_MAILER=.*/MAIL_MAILER=sendmail/g" /data/web/laravel/.env
64+
app@abcdef-example-magweb-cmbl:~$ sed -i "s#APP_URL=.*#APP_URL=https://example.hypernode.io#g" /data/web/laravel/.env
65+
```
66+
67+
With these commands we set the database credentials, the Redis host, the mailer backend and the application URL.
68+
69+
Now we can install the application:
70+
71+
```console
72+
app@abcdef-example-magweb-cmbl:~$ cd /data/web/laravel
73+
app@abcdef-example-magweb-cmbl:~$ php artisan migrate
74+
```
75+
76+
## Setting up the NGINX vhost
77+
78+
Finally, we need to set up the NGINX vhost.
79+
80+
We need to configure the vhost to point to the `public` directory of the Laravel application and to have the `generic-php` vhost type.
81+
We also generate a new SSL certificate for the domain using the `--https` flag.
82+
83+
```console
84+
app@abcdef-example-magweb-cmbl:~$ hypernode-manage-vhosts example.hypernode.io --webroot /data/web/laravel/public --type generic-php --https
85+
...
86+
INFO: Managing configs for example.hypernode.io
87+
INFO: Writing HTTP config for example.hypernode.io
88+
INFO: Writing HTTPS config for example.hypernode.io
89+
```
90+
91+
## Your journey begins
92+
93+
There you go! You have installed a Laravel application on your Hypernode. Your journey starts here.
94+
If you have any questions along the way, feel free to contact our support team. We're happy to help!

docs/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ glob:
3636
ecommerce-applications/*
3737
```
3838

39+
```{toctree}
40+
---
41+
caption: Frameworks
42+
maxdepth: 2
43+
glob:
44+
---
45+
framework/*
46+
```
47+
3948
```{toctree}
4049
---
4150
caption: Hypernode Deploy

0 commit comments

Comments
 (0)