Sfoglia il codice sorgente

Add Vvveb CMS as quick install app (#4509)

* Add Vvveb CMS as quick install app

* Fixed formatting with prettier --fix
Givan 1 anno fa
parent
commit
15afcef37a

+ 116 - 0
install/deb/templates/web/nginx/php-fpm/vvveb.stpl

@@ -0,0 +1,116 @@
+#=========================================================================#
+# Default Web Domain Template                                             #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
+# https://hestiacp.com/docs/server-administration/web-templates.html      #
+#=========================================================================#
+
+server {
+	listen      %ip%:%web_ssl_port% ssl;
+	server_name %domain_idn% %alias_idn%;
+	root        %sdocroot%/public;
+	index       index.php index.html index.htm;
+	access_log  /var/log/nginx/domains/%domain%.log combined;
+	access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+	error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+	ssl_certificate     %ssl_pem%;
+	ssl_certificate_key %ssl_key%;
+	ssl_stapling        on;
+	ssl_stapling_verify on;
+
+	# TLS 1.3 0-RTT anti-replay
+	if ($anti_replay = 307) { return 307 https://$host$request_uri; }
+	if ($anti_replay = 425) { return 425; }
+
+	include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
+
+
+	set $skip_cache 0;
+	set $cache_uri $request_uri;
+
+	if ($query_string != "") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# Don't cache uris containing the following segments
+	if ($request_uri ~* "/admin/|/user/|/cart/|/feed/|index.php|sitemap(_index)?.xml") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}  
+
+	# Don't use the cache for logged in users or if products in cart
+	if ($http_cookie ~* "nocache|user|cart") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# POST requests and urls with a query string should always go to PHP
+	if ($request_method = POST) {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	location = /favicon.ico {
+		log_not_found off;
+		access_log off;
+	}
+
+	location = /robots.txt {
+		try_files $uri $uri/ /index.php?$args;
+		log_not_found off;
+		access_log off;
+	}
+
+	location ~ /\.(?!well-known\/) {
+		deny all;
+		return 404;
+	}
+
+	location / {
+		default_type  text/html;
+		index index.php index.html index.htm;
+		try_files /page-cache/$host$cache_uri /page-cache/$host$cache_uri/index.html $uri $uri/ /index.php$is_args$args;
+
+		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+			expires 30d;
+			fastcgi_hide_header "Set-Cookie";
+		}
+
+		location ~ /media/.+?\.php$ {
+			deny all;
+			return 404;
+		}
+
+		location ~ [^/]\.php(/|$) {
+			try_files $uri =404;
+
+			include /etc/nginx/fastcgi_params;
+
+			fastcgi_index index.php;
+			fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
+			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+
+			fastcgi_pass %backend_lsnr%;
+		}
+	}
+
+	location /error/ {
+		alias %home%/%user%/web/%domain%/document_errors/;
+	}
+
+	location /vstats/ {
+		alias   %home%/%user%/web/%domain%/stats/;
+		include %home%/%user%/web/%domain%/stats/auth.conf*;
+	}
+
+	proxy_hide_header Upgrade;
+
+	include /etc/nginx/conf.d/phpmyadmin.inc*;
+	include /etc/nginx/conf.d/phppgadmin.inc*;
+	include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+}

+ 103 - 0
install/deb/templates/web/nginx/php-fpm/vvveb.tpl

@@ -0,0 +1,103 @@
+#=========================================================================#
+# Default Web Domain Template                                             #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
+# https://hestiacp.com/docs/server-administration/web-templates.html      #
+#=========================================================================#
+
+server {
+	listen      %ip%:%web_port%;
+	server_name %domain_idn% %alias_idn%;
+	root        %docroot%/public;
+	index       index.php index.html index.htm;
+	access_log  /var/log/nginx/domains/%domain%.log combined;
+	access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+	error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+	include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
+
+	set $skip_cache 0;
+	set $cache_uri $request_uri;
+
+	if ($query_string != "") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# Don't cache uris containing the following segments
+	if ($request_uri ~* "/admin/|/user/|/cart/|/feed/|index.php|sitemap(_index)?.xml") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}  
+
+	# Don't use the cache for logged in users or if products in cart
+	if ($http_cookie ~* "nocache|user|cart") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# POST requests and urls with a query string should always go to PHP
+	if ($request_method = POST) {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	location = /favicon.ico {
+		log_not_found off;
+		access_log off;
+	}
+
+	location = /robots.txt {
+		try_files $uri $uri/ /index.php?$args;
+		log_not_found off;
+		access_log off;
+	}
+
+	location ~ /\.(?!well-known\/) {
+		deny all;
+		return 404;
+	}
+
+	location / {
+		default_type  text/html;
+		index index.php index.html index.htm;
+		try_files /page-cache/$host$cache_uri /page-cache/$host$cache_uri/index.html $uri $uri/ /index.php$is_args$args;
+
+		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+			expires 30d;
+			fastcgi_hide_header "Set-Cookie";
+		}
+
+		location ~ /media/.+?\.php$ {
+			deny all;
+			return 404;
+		}
+
+		location ~ [^/]\.php(/|$) {
+			try_files $uri =404;
+
+			include /etc/nginx/fastcgi_params;
+
+			fastcgi_index index.php;
+			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+
+			fastcgi_pass %backend_lsnr%;
+		}
+	}
+
+	location /error/ {
+		alias %home%/%user%/web/%domain%/document_errors/;
+	}
+
+	location /vstats/ {
+		alias   %home%/%user%/web/%domain%/stats/;
+		include %home%/%user%/web/%domain%/stats/auth.conf*;
+	}
+
+	include /etc/nginx/conf.d/phpmyadmin.inc*;
+	include /etc/nginx/conf.d/phppgadmin.inc*;
+	include %home%/%user%/conf/web/%domain%/nginx.conf_*;
+}

+ 116 - 0
install/rpm/templates/web/nginx/php-fpm/vvveb.stpl

@@ -0,0 +1,116 @@
+#=========================================================================#
+# Default Web Domain Template                                             #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
+# https://hestiacp.com/docs/server-administration/web-templates.html      #
+#=========================================================================#
+
+server {
+	listen      %ip%:%web_ssl_port% ssl;
+	server_name %domain_idn% %alias_idn%;
+	root        %sdocroot%/public;
+	index       index.php index.html index.htm;
+	access_log  /var/log/nginx/domains/%domain%.log combined;
+	access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+	error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+	ssl_certificate     %ssl_pem%;
+	ssl_certificate_key %ssl_key%;
+	ssl_stapling        on;
+	ssl_stapling_verify on;
+
+	# TLS 1.3 0-RTT anti-replay
+	if ($anti_replay = 307) { return 307 https://$host$request_uri; }
+	if ($anti_replay = 425) { return 425; }
+
+	include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
+
+
+	set $skip_cache 0;
+	set $cache_uri $request_uri;
+
+	if ($query_string != "") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# Don't cache uris containing the following segments
+	if ($request_uri ~* "/admin/|/user/|/cart/|/feed/|index.php|sitemap(_index)?.xml") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}  
+
+	# Don't use the cache for logged in users or if products in cart
+	if ($http_cookie ~* "nocache|user|cart") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# POST requests and urls with a query string should always go to PHP
+	if ($request_method = POST) {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	location = /favicon.ico {
+		log_not_found off;
+		access_log off;
+	}
+
+	location = /robots.txt {
+		try_files $uri $uri/ /index.php?$args;
+		log_not_found off;
+		access_log off;
+	}
+
+	location ~ /\.(?!well-known\/) {
+		deny all;
+		return 404;
+	}
+
+	location / {
+		default_type  text/html;
+		index index.php index.html index.htm;
+		try_files /page-cache/$host$cache_uri /page-cache/$host$cache_uri/index.html $uri $uri/ /index.php$is_args$args;
+
+		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+			expires 30d;
+			fastcgi_hide_header "Set-Cookie";
+		}
+
+		location ~ /media/.+?\.php$ {
+			deny all;
+			return 404;
+		}
+
+		location ~ [^/]\.php(/|$) {
+			try_files $uri =404;
+
+			include /etc/nginx/fastcgi_params;
+
+			fastcgi_index index.php;
+			fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty;
+			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+
+			fastcgi_pass %backend_lsnr%;
+		}
+	}
+
+	location /error/ {
+		alias %home%/%user%/web/%domain%/document_errors/;
+	}
+
+	location /vstats/ {
+		alias   %home%/%user%/web/%domain%/stats/;
+		include %home%/%user%/web/%domain%/stats/auth.conf*;
+	}
+
+	proxy_hide_header Upgrade;
+
+	include /etc/nginx/conf.d/phpmyadmin.inc*;
+	include /etc/nginx/conf.d/phppgadmin.inc*;
+	include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+}

+ 103 - 0
install/rpm/templates/web/nginx/php-fpm/vvveb.tpl

@@ -0,0 +1,103 @@
+#=========================================================================#
+# Default Web Domain Template                                             #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
+# https://hestiacp.com/docs/server-administration/web-templates.html      #
+#=========================================================================#
+
+server {
+	listen      %ip%:%web_port%;
+	server_name %domain_idn% %alias_idn%;
+	root        %docroot%/public;
+	index       index.php index.html index.htm;
+	access_log  /var/log/nginx/domains/%domain%.log combined;
+	access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+	error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+	include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
+
+	set $skip_cache 0;
+	set $cache_uri $request_uri;
+
+	if ($query_string != "") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# Don't cache uris containing the following segments
+	if ($request_uri ~* "/admin/|/user/|/cart/|/feed/|index.php|sitemap(_index)?.xml") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}  
+
+	# Don't use the cache for logged in users or if products in cart
+	if ($http_cookie ~* "nocache|user|cart") {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	# POST requests and urls with a query string should always go to PHP
+	if ($request_method = POST) {
+		set $skip_cache 1;
+		set $cache_uri null;
+		set $no_cache 1;
+	}
+
+	location = /favicon.ico {
+		log_not_found off;
+		access_log off;
+	}
+
+	location = /robots.txt {
+		try_files $uri $uri/ /index.php?$args;
+		log_not_found off;
+		access_log off;
+	}
+
+	location ~ /\.(?!well-known\/) {
+		deny all;
+		return 404;
+	}
+
+	location / {
+		default_type  text/html;
+		index index.php index.html index.htm;
+		try_files /page-cache/$host$cache_uri /page-cache/$host$cache_uri/index.html $uri $uri/ /index.php$is_args$args;
+
+		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+			expires 30d;
+			fastcgi_hide_header "Set-Cookie";
+		}
+
+		location ~ /media/.+?\.php$ {
+			deny all;
+			return 404;
+		}
+
+		location ~ [^/]\.php(/|$) {
+			try_files $uri =404;
+
+			include /etc/nginx/fastcgi_params;
+
+			fastcgi_index index.php;
+			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+
+			fastcgi_pass %backend_lsnr%;
+		}
+	}
+
+	location /error/ {
+		alias %home%/%user%/web/%domain%/document_errors/;
+	}
+
+	location /vstats/ {
+		alias   %home%/%user%/web/%domain%/stats/;
+		include %home%/%user%/web/%domain%/stats/auth.conf*;
+	}
+
+	include /etc/nginx/conf.d/phpmyadmin.inc*;
+	include /etc/nginx/conf.d/phppgadmin.inc*;
+	include %home%/%user%/conf/web/%domain%/nginx.conf_*;
+}

+ 65 - 0
web/src/app/WebApp/Installers/Vvveb/VvvebSetup.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace Hestia\WebApp\Installers\Vvveb;
+
+use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
+
+class VvvebSetup extends BaseSetup {
+	protected $appInfo = [
+		"name" => "Vvveb",
+		"group" => "cms",
+		"enabled" => true,
+		"version" => "latest",
+		"thumbnail" => "vvveb-symbol.svg",
+	];
+
+	protected $appname = "vvveb";
+
+	protected $config = [
+		"form" => [
+			"vvveb_account_username" => ["value" => "admin"],
+			"vvveb_account_email" => "text",
+			"vvveb_account_password" => "password",
+		],
+		"database" => true,
+		"resources" => [
+			"archive" => [
+				"src" => "https://www.vvveb.com/latest.zip",
+			],
+		],
+		"server" => [
+			"nginx" => [
+				"template" => "vvveb",
+			],
+			"php" => [
+				"supported" => ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"],
+			],
+		],
+	];
+
+	public function install(array $options = null): bool {
+		parent::install($options);
+		parent::setup($options);
+
+		$this->appcontext->runUser(
+			"v-run-cli-cmd",
+			[
+				"/usr/bin/php" . $options["php_version"],
+				$this->getDocRoot("/cli.php"),
+				"install",
+				"host=" . addcslashes("localhost", "\\'"),
+				"user=" . $this->appcontext->user() . "_" . $options["database_user"],
+				"password=" . $options["database_password"],
+				"database=" . $this->appcontext->user() . "_" . $options["database_name"],
+				"admin[user]=" . $options["vvveb_account_username"],
+				"admin[password]=" . $options["vvveb_account_password"],
+				"admin[email]=" . $options["vvveb_account_email"],
+			],
+			$status,
+		);
+
+		$this->cleanup();
+
+		return $status->code === 0;
+	}
+}

+ 5 - 0
web/src/app/WebApp/Installers/Vvveb/vvveb-symbol.svg

@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" viewBox="0 0 79.375 79.375">
+    <path d="M44.121-13.047h-1.764l-7.829-15.657h2.406l6.257 12.834 5.807-12.834h2.31l-7.187 15.657" style="fill:#50b450;fill-opacity:1;stroke:none;"  transform="translate(-12.79 59.978)"/>
+    <path style="fill:#444;fill-opacity:1;stroke:none;" d="M62.81-29.287c-2.589 0-4.632.781-6.13 2.342-1.497 1.562-2.245 3.53-2.245 5.903 0 2.503.664 4.46 1.99 5.872 1.433 1.518 3.507 2.277 6.223 2.277 1.84 0 3.444-.364 4.813-1.091 1.54-.813 2.662-2.32 3.368-4.524h-2.181c-.963 2.46-2.94 3.69-5.935 3.69-3.85 0-5.914-1.818-6.192-5.454-.007-.638-.03-1.303.063-1.924.235-1.647.91-2.92 2.022-3.818 1.112-.899 2.514-1.35 4.203-1.35 1.883 0 3.369.536 4.46 1.606.94.92 1.474 2.107 1.603 3.562l-3.634.065v1.903l5.945-.076v-1.316c0-2.353-.771-4.213-2.311-5.582-1.519-1.39-3.539-2.085-6.063-2.085zM74.322-31.915v11.51a8.552 8.552 0 0 0 2.119 4.854v-.004c.097.11.202.207.303.31.305.308.625.6.973.856v.004c1.334.972 2.94 1.46 4.82 1.46 2.63 0 4.684-.792 6.16-2.375 1.39-1.476 2.086-3.442 2.086-5.902 0-2.481-.686-4.48-2.055-6-1.475-1.625-3.528-2.437-6.159-2.437-2.63 0-4.673.843-6.128 2.533v-4.81zm8.376 4.233c1.946 0 3.454.619 4.523 1.86.984 1.133 1.476 2.662 1.476 4.587 0 1.882-.504 3.39-1.509 4.524-1.048 1.219-2.534 1.83-4.46 1.83-1.903 0-3.432-.59-4.587-1.766-1.134-1.177-1.7-2.673-1.7-4.49 0-2.033.514-3.626 1.54-4.781 1.048-1.177 2.62-1.764 4.717-1.764z" transform="translate(-12.79 59.978)"/>
+    <path d="M34.003-12.863H32.24L24.41-28.52h2.406l6.257 12.833s1.426 2.546.93 2.824M23.852-12.752h-1.764l-7.829-15.657h2.407l6.256 12.834s1.426 2.545.93 2.823" style="fill:#50b450;" transform="translate(-12.79 59.978)"/>
+</svg>