Add stack --brotli to enable/disable brotli compression
This commit is contained in:
@@ -16,6 +16,8 @@ from wo.core.mysql import WOMysql
|
|||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVar
|
from wo.core.variables import WOVar
|
||||||
|
from wo.core.nginx import check_config
|
||||||
|
from wo.core.git import WOGit
|
||||||
|
|
||||||
|
|
||||||
def wo_stack_hook(app):
|
def wo_stack_hook(app):
|
||||||
@@ -90,6 +92,9 @@ class WOStackController(CementBaseController):
|
|||||||
(['--nanorc'],
|
(['--nanorc'],
|
||||||
dict(help='Install nanorc syntax highlighting',
|
dict(help='Install nanorc syntax highlighting',
|
||||||
action='store_true')),
|
action='store_true')),
|
||||||
|
(['--brotli'],
|
||||||
|
dict(help='Enable/Disable Brotli compression for Nginx',
|
||||||
|
action='store_true')),
|
||||||
(['--force'],
|
(['--force'],
|
||||||
dict(help='Force install/remove/purge without prompt',
|
dict(help='Force install/remove/purge without prompt',
|
||||||
action='store_true')),
|
action='store_true')),
|
||||||
@@ -278,6 +283,26 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "ProFTPd already installed")
|
Log.debug(self, "ProFTPd already installed")
|
||||||
Log.info(self, "ProFTPd already installed")
|
Log.info(self, "ProFTPd already installed")
|
||||||
|
|
||||||
|
# brotli
|
||||||
|
if pargs.brotli:
|
||||||
|
Log.wait(self, "Enabling Brotli")
|
||||||
|
if os.path.exists('/etc/nginx/conf.d/brotli.conf.disabled'):
|
||||||
|
WOFileUtils.mvfile(self, '/etc/nginx/conf.d/brotli.conf.disabled',
|
||||||
|
'/etc/nginx/conf.d/brotli.conf')
|
||||||
|
else:
|
||||||
|
Log.failed(self, "Enabling Brotli")
|
||||||
|
Log.error(self, "Brotli is already enabled")
|
||||||
|
if os.path.exists('/etc/nginx/conf.d/gzip.conf'):
|
||||||
|
WOFileUtils.mvfile(self, '/etc/nginx/conf.d/gzip.conf',
|
||||||
|
'/etc/nginx/conf.d/gzip.conf.disabled')
|
||||||
|
if check_config(self):
|
||||||
|
Log.valide(self, "Enabling Brotli")
|
||||||
|
WOGit.add(self, "/etc/nginx")
|
||||||
|
WOService.reload_service(self, "nginx")
|
||||||
|
else:
|
||||||
|
Log.failed(self, "Enabling Brotli")
|
||||||
|
WOGit.rollback(self, '/etc/nginx')
|
||||||
|
|
||||||
# PHPMYADMIN
|
# PHPMYADMIN
|
||||||
if pargs.phpmyadmin:
|
if pargs.phpmyadmin:
|
||||||
pargs.composer = True
|
pargs.composer = True
|
||||||
@@ -656,6 +681,26 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Remove apt_packages variable for ProFTPd")
|
Log.debug(self, "Remove apt_packages variable for ProFTPd")
|
||||||
apt_packages = apt_packages + ["proftpd-basic"]
|
apt_packages = apt_packages + ["proftpd-basic"]
|
||||||
|
|
||||||
|
# brotli
|
||||||
|
if pargs.brotli:
|
||||||
|
Log.wait(self, "Disabling Brotli")
|
||||||
|
if os.path.exists('/etc/nginx/conf.d/brotli.conf'):
|
||||||
|
WOFileUtils.mvfile(self, '/etc/nginx/conf.d/brotli.conf',
|
||||||
|
'/etc/nginx/conf.d/brotli.conf.disabled')
|
||||||
|
else:
|
||||||
|
Log.failed(self, "Disabling Brotli")
|
||||||
|
Log.error(self, "Brotli is already disabled")
|
||||||
|
if os.path.exists('/etc/nginx/conf.d/gzip.conf.disabled'):
|
||||||
|
WOFileUtils.mvfile(self, '/etc/nginx/conf.d/gzip.conf.disabled',
|
||||||
|
'/etc/nginx/conf.d/gzip.conf')
|
||||||
|
if check_config(self):
|
||||||
|
Log.valide(self, "Disabling Brotli")
|
||||||
|
WOGit.add(self, "/etc/nginx")
|
||||||
|
WOService.reload_service(self, "nginx")
|
||||||
|
else:
|
||||||
|
Log.failed(self, "Disabling Brotli")
|
||||||
|
WOGit.rollback(self, '/etc/nginx')
|
||||||
|
|
||||||
# UFW
|
# UFW
|
||||||
if pargs.ufw:
|
if pargs.ufw:
|
||||||
if WOAptGet.is_installed(self, 'ufw'):
|
if WOAptGet.is_installed(self, 'ufw'):
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
"Name: WordOps"] +
|
"Name: WordOps"] +
|
||||||
["HTTP Auth Password : {0}"
|
["HTTP Auth Password : {0}"
|
||||||
.format(passwd)])
|
.format(passwd)])
|
||||||
self.msg = (self.msg + [f'WordOps backend is available on https://{server_ip}:22222]) '
|
self.msg = (self.msg + [f'WordOps backend is available on https://{server_ip}:22222 '
|
||||||
f'or https://{WOVar.wo_fqdn}:22222'])
|
f'or https://{WOVar.wo_fqdn}:22222'])
|
||||||
|
|
||||||
data = dict(release=WOVar.wo_version)
|
data = dict(release=WOVar.wo_version)
|
||||||
|
|||||||
Reference in New Issue
Block a user