Browse Source

Now using Suse builder for nginx

release/v3.3.0
gau1991 10 years ago
parent
commit
b65aeadfc2
  1. 13
      ee/cli/plugins/info.py
  2. 38
      ee/cli/plugins/stack.py
  3. 26
      ee/cli/plugins/stack_upgrade.py
  4. 15
      ee/core/nginxhashbucket.py
  5. 22
      ee/core/variables.py
  6. 4
      install

13
ee/cli/plugins/info.py

@ -48,15 +48,10 @@ class EEInfoController(CementBaseController):
worker_processes = nc.get('worker_processes')[1]
worker_connections = nc.get([('events',), 'worker_connections'])[1]
keepalive_timeout = nc.get([('http',), 'keepalive_timeout'])[1]
if os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf'):
nc.loadf('/etc/nginx/conf.d/ee-nginx.conf')
fastcgi_read_timeout = nc.get('fastcgi_read_timeout')[1]
client_max_body_size = nc.get('client_max_body_size')[1]
else:
fastcgi_read_timeout = nc.get([('http',),
'fastcgi_read_timeout'])[1]
client_max_body_size = nc.get([('http',),
'client_max_body_size'])[1]
fastcgi_read_timeout = nc.get([('http',),
'fastcgi_read_timeout'])[1]
client_max_body_size = nc.get([('http',),
'client_max_body_size'])[1]
data = dict(version=version, allow=allow, user=user,
worker_processes=worker_processes,
keepalive_timeout=keepalive_timeout,

38
ee/cli/plugins/stack.py

@ -153,12 +153,9 @@ class EEStackController(CementBaseController):
if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
Log.info(self, "Adding repository for NGINX, please wait...")
if EEVariables.ee_platform_distro == 'debian':
Log.debug(self, 'Adding Dotdeb/nginx GPG key')
EERepo.add(self, repo_url=EEVariables.ee_nginx_repo)
else:
EERepo.add(self, ppa=EEVariables.ee_nginx_repo)
Log.debug(self, 'Adding ppa of Nginx')
EERepo.add(self, repo_url=EEVariables.ee_nginx_repo)
Log.debug(self, 'Adding ppa of Nginx')
EERepo.add_key(self, EEVariables.ee_nginx_key)
if set(EEVariables.ee_php).issubset(set(apt_packages)):
Log.info(self, "Adding repository for PHP, please wait...")
@ -207,35 +204,6 @@ class EEStackController(CementBaseController):
if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
if ((not EEShellExec.cmd_exec(self, "grep -q -Hr EasyEngine "
"/etc/nginx")) and os.path.isfile('/etc/nginx/nginx.conf')):
nc = NginxConfig()
Log.debug(self, 'Loading file /etc/nginx/nginx.conf ')
nc.loadf('/etc/nginx/nginx.conf')
nc.set('worker_processes', 'auto')
nc.append(('worker_rlimit_nofile', '100000'), position=2)
nc.remove(('events', ''))
nc.append({'name': 'events', 'param': '', 'value':
[('worker_connections', '4096'),
('multi_accept', 'on')]}, position=4)
nc.set([('http',), 'keepalive_timeout'], '30')
Log.debug(self, "Writting nginx configuration to "
"file /etc/nginx/nginx.conf ")
nc.savef('/etc/nginx/nginx.conf')
# Custom Nginx configuration by EasyEngine
if EEVariables.ee_platform_distro == 'ubuntu':
data = dict(version=EEVariables.ee_version,
Ubuntu=True)
else:
data = dict(version=EEVariables.ee_version,
Debian=True)
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/ee-nginx.conf ')
ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'nginx-core.mustache',
out=ee_nginx)
ee_nginx.close()
data = dict()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/blockips.conf')

26
ee/cli/plugins/stack_upgrade.py

@ -191,33 +191,7 @@ class EEStackUpgradeController(CementBaseController):
# Post Actions after package updates
if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
# Fix whitescreen of death beacuse of missing value
# fastcgi_param SCRIPT_FILENAME $request_filename; in file
# /etc/nginx/fastcgi_params
if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params',
'SCRIPT_FILENAME'):
with open('/etc/nginx/fastcgi_params',
encoding='utf-8', mode='a') as ee_nginx:
ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
'\t$request_filename;\n')
# Fix "ssl_prefer_server_ciphers" directive is duplicate
# that is arrived in latest Debian update
if EEVariables.ee_platform_distro == 'ubuntu':
data = dict(version=EEVariables.ee_version, Ubuntu=True)
else:
data = dict(version=EEVariables.ee_version, Debian=True)
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/conf.d/ee-nginx.conf ')
ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'nginx-core.mustache', out=ee_nginx)
ee_nginx.close()
EEGit.add(self, ["/etc/nginx"], msg="Updated Nginx")
EEService.restart_service(self, 'nginx')
if set(EEVariables.ee_php).issubset(set(apt_packages)):
EEService.restart_service(self, 'php5-fpm')
if set(EEVariables.ee_hhvm).issubset(set(apt_packages)):

15
ee/core/nginxhashbucket.py

@ -36,21 +36,6 @@ def hashbucket(self):
else:
print(line, end='')
elif os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf'):
if EEFileUtils.grep(self, "/etc/nginx/conf.d/ee-nginx.conf",
"server_names_hash_bucket_size"):
for line in fileinput.FileInput("/etc/nginx/conf.d/ee-nginx.conf",
inplace=1):
if "server_names_hash_bucket_size" in line:
print("server_names_hash_bucket_size {0};"
.format(ngx_hash))
else:
print(line, end='')
else:
with open('/etc/nginx/conf.d/ee-nginx.conf', 'a') as conf:
conf.write("server_names_hash_bucket_size {0};\n"
.format(ngx_hash))
else:
EEFileUtils.searchreplace(self, '/etc/nginx/nginx.conf',
"gzip_disable \"msie6\";",

22
ee/core/variables.py

@ -76,13 +76,21 @@ class EEVariables():
# EasyEngine stack installation varibales
# Nginx repo and packages
if ee_platform_distro == 'ubuntu':
ee_nginx_repo = "ppa:rtcamp/nginx"
ee_nginx = ["nginx-custom", "nginx-common"]
elif ee_platform_distro == 'debian':
ee_nginx_repo = ("deb http://packages.dotdeb.org {codename} all"
.format(codename=ee_platform_codename))
ee_nginx = ["nginx-extras", "nginx-common"]
if ee_platform_codename == 'precise':
ee_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/xUbuntu_12.04/ /")
elif ee_platform_codename == 'trusty':
ee_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/xUbuntu_14.04/ /")
elif ee_platform_codename == 'wheezy':
ee_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/Debian_7.0/ /")
elif ee_platform_codename == 'jessie':
ee_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
"/rtCamp:/EasyEngine/Debian_8.0/ /")
ee_nginx = ["nginx-custom", "nginx-common"]
ee_nginx_key = '3050AC3CD2AE6F03'
# PHP repo and packages
if ee_platform_distro == 'ubuntu':

4
install

@ -283,9 +283,7 @@ function ee_update()
function ee_update_latest()
{
ee_lib_echo "Updating Nginx configuration, please wait..."
if [ -f /etc/nginx/ee-nginx.conf ]; then
sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $ee_version_new\";/" /etc/nginx/nginx.conf &>> /dev/null
elif [ -f /etc/nginx/nginx.conf ]; then
if [ -f /etc/nginx/nginx.conf ]; then
sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $ee_version_new\";/" /etc/nginx/nginx.conf &>> /dev/null
fi

Loading…
Cancel
Save