Skip to content

Commit 65dee1e

Browse files
authored
Gather uniform installation target information before install (hestiacp#4694)
* Gather uniform installation target information before install * cleanup docuwiki installer * Convert dolibarr setup * Introduct Symfony Process to make running commands easier * Cleanup resources and fix Drupal installation * Simplify Flarum installation and add support for document_root change * Cleanup grav installer * Improve download mechanism * Huge overhaul of the installer system with clear order * Add test to run quick install app with test * Cleanup most of the installing logic and revert to htaccess redirect * improve flarum installer with stronger .htaccess file * use separate htaccess files * fix installer and test
1 parent d411cf7 commit 65dee1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3058
-3200
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ indent_style = space
2424
# Views have longer line length for now
2525
[web/templates/**/*.php]
2626
max_line_length = 200
27+
28+
# Modern PHP uses spaces for indentation
29+
[web/src/**/*.php]
30+
indent_size = 4
31+
indent_style = space

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
# Web templates (for now)
2828
web/templates/
2929

30+
# Modern Web (handled by PHPCS)
31+
web/src/
32+
3033
# Patch files
3134
/install/upgrade/patch/*
3235

bin/v-add-user-wp-cli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ WPCLI_DIR="/home/$user/.wp-cli"
4545
WPCLI_BIN="$WPCLI_DIR/wp"
4646

4747
if [ -f "$WPCLI_BIN" ]; then
48-
if [ -f "$update" ]; then
48+
if [ "$update" = 'yes' ]; then
4949
user_exec $WPCLI_BIN cli update --yes
5050
exit
5151
fi

bin/v-quick-install-app

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ $application -> register('install')
6161
return Command::FAILURE;
6262
}
6363
$app_installer_class = "\Hestia\WebApp\Installers\\" . $app . "\\" . $app . "Setup";
64-
$app_installer = new $app_installer_class($v_domain, $hestia);
64+
$app_installer = new $app_installer_class($hestia);
6565

6666
// check for default fields
6767
$WebappInstaller = new \Hestia\WebApp\AppWizard($app_installer, $v_domain, $hestia);

bin/v-run-cli-cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fi
4949
basecmd="$(basename "$clicmd")"
5050
if [ "$basecmd" != 'ps' -a \
5151
"$basecmd" != 'ls' -a \
52+
"$basecmd" != 'wget' -a \
5253
"$basecmd" != 'tar' -a \
5354
"$basecmd" != 'zip' -a \
5455
"$basecmd" != 'unzip' -a \
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://hestiacp.com/docs/server-administration/web-templates.html #
5+
#=========================================================================#
6+
7+
server {
8+
listen %ip%:%web_ssl_port% ssl;
9+
server_name %domain_idn% %alias_idn%;
10+
root %sdocroot%/public;
11+
index index.php index.html index.htm;
12+
access_log /var/log/nginx/domains/%domain%.log combined;
13+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
14+
error_log /var/log/nginx/domains/%domain%.error.log error;
15+
16+
ssl_certificate %ssl_pem%;
17+
ssl_certificate_key %ssl_key%;
18+
ssl_stapling on;
19+
ssl_stapling_verify on;
20+
21+
# TLS 1.3 0-RTT anti-replay
22+
if ($anti_replay = 307) { return 307 https://$host$request_uri; }
23+
if ($anti_replay = 425) { return 425; }
24+
25+
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
26+
27+
# Pass requests that don't refer directly to files in the filesystem to index.php
28+
location / {
29+
try_files $uri $uri/ /index.php?$query_string;
30+
}
31+
32+
location ~ \.php$ {
33+
try_files $uri =404;
34+
35+
include /etc/nginx/fastcgi_params;
36+
37+
fastcgi_index index.php;
38+
fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
39+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
40+
41+
fastcgi_pass %backend_lsnr%;
42+
43+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
44+
}
45+
46+
# Uncomment the following lines if you are not using a "public" directory
47+
# to prevent sensitive resources from being exposed.
48+
location ~* ^/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor) {
49+
deny all;
50+
return 404;
51+
}
52+
53+
# The following directives are based on best practices from H5BP Nginx Server Configs
54+
# https://github.com/h5bp/server-configs-nginx
55+
56+
# Expire rules for static content
57+
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
58+
add_header Cache-Control "max-age=0";
59+
}
60+
61+
location ~* \.(?:rss|atom)$ {
62+
add_header Cache-Control "max-age=3600";
63+
}
64+
65+
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
66+
add_header Cache-Control "max-age=2592000";
67+
access_log off;
68+
}
69+
70+
location ~* \.(?:css|js)$ {
71+
add_header Cache-Control "max-age=31536000";
72+
access_log off;
73+
}
74+
75+
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
76+
add_header Cache-Control "max-age=2592000";
77+
access_log off;
78+
}
79+
80+
location /error/ {
81+
alias %home%/%user%/web/%domain%/document_errors/;
82+
}
83+
84+
location /vstats/ {
85+
alias %home%/%user%/web/%domain%/stats/;
86+
include %home%/%user%/web/%domain%/stats/auth.conf*;
87+
}
88+
89+
proxy_hide_header Upgrade;
90+
91+
include /etc/nginx/conf.d/phpmyadmin.inc*;
92+
include /etc/nginx/conf.d/phppgadmin.inc*;
93+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
94+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#=========================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
# https://hestiacp.com/docs/server-administration/web-templates.html #
5+
#=========================================================================#
6+
7+
server {
8+
listen %ip%:%web_port%;
9+
server_name %domain_idn% %alias_idn%;
10+
root %docroot%/public;
11+
index index.php index.html index.htm;
12+
access_log /var/log/nginx/domains/%domain%.log combined;
13+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
14+
error_log /var/log/nginx/domains/%domain%.error.log error;
15+
16+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
17+
18+
# Pass requests that don't refer directly to files in the filesystem to index.php
19+
location / {
20+
try_files $uri $uri/ /index.php?$query_string;
21+
}
22+
23+
location ~ \.php$ {
24+
try_files $uri =404;
25+
26+
include /etc/nginx/fastcgi_params;
27+
28+
fastcgi_index index.php;
29+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
30+
31+
fastcgi_pass %backend_lsnr%;
32+
33+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
34+
}
35+
36+
# Uncomment the following lines if you are not using a "public" directory
37+
# to prevent sensitive resources from being exposed.
38+
location ~* ^/(\.git|composer\.(json|lock)|auth\.json|config\.php|flarum|storage|vendor) {
39+
deny all;
40+
return 404;
41+
}
42+
43+
# The following directives are based on best practices from H5BP Nginx Server Configs
44+
# https://github.com/h5bp/server-configs-nginx
45+
46+
# Expire rules for static content
47+
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
48+
add_header Cache-Control "max-age=0";
49+
}
50+
51+
location ~* \.(?:rss|atom)$ {
52+
add_header Cache-Control "max-age=3600";
53+
}
54+
55+
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
56+
add_header Cache-Control "max-age=2592000";
57+
access_log off;
58+
}
59+
60+
location ~* \.(?:css|js)$ {
61+
add_header Cache-Control "max-age=31536000";
62+
access_log off;
63+
}
64+
65+
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
66+
add_header Cache-Control "max-age=2592000";
67+
access_log off;
68+
}
69+
70+
location /error/ {
71+
alias %home%/%user%/web/%domain%/document_errors/;
72+
}
73+
74+
location /vstats/ {
75+
alias %home%/%user%/web/%domain%/stats/;
76+
include %home%/%user%/web/%domain%/stats/auth.conf*;
77+
}
78+
79+
include /etc/nginx/conf.d/phpmyadmin.inc*;
80+
include /etc/nginx/conf.d/phppgadmin.inc*;
81+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
82+
}

install/deb/templates/web/nginx/php-fpm/opencart.stpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ server {
5656
rewrite ^/(.+)$ /index.php?_route_=$1 last;
5757
}
5858

59-
location /storage/ {
59+
location /system/storage/ {
6060
deny all;
6161
return 404;
6262
}

install/deb/templates/web/nginx/php-fpm/opencart.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ server {
4646
rewrite ^/(.+)$ /index.php?_route_=$1 last;
4747
}
4848

49-
location /storage/ {
49+
location /system/storage/ {
5050
deny all;
5151
return 404;
5252
}

phpcs.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="HestiaCP">
3+
<file>./web/src/app</file>
4+
5+
<exclude-pattern>*.js</exclude-pattern>
6+
7+
<!-- This is the rule we inherit from. If you want to exlude some specific rules, see the docs on how to do that -->
8+
<rule ref="PSR12"/>
9+
10+
<!-- Lines can be a bit longer before they break the build -->
11+
<rule ref="Generic.Files.LineLength">
12+
<properties>
13+
<property name="lineLimit" value="120"/>
14+
<property name="absoluteLineLimit" value="150"/>
15+
</properties>
16+
</rule>
17+
</ruleset>

0 commit comments

Comments
 (0)