Browse Source

Redis with ee site create

release/v3.3.0
gau1991 10 years ago
parent
commit
ec0acebbe4
  1. 20
      ee/cli/plugins/site.py
  2. 6
      ee/cli/plugins/site_functions.py
  3. 26
      ee/cli/plugins/stack.py
  4. 2
      ee/cli/templates/virtualconf.mustache
  5. 10
      ee/core/variables.py

20
ee/cli/plugins/site.py

@ -347,6 +347,9 @@ class EESiteCreateController(CementBaseController):
(['--wpsc'],
dict(help="create wordpress single/multi site with wpsc cache",
action='store_true')),
(['--redis'],
dict(help="create wordpress single/multi site with redis cache",
action='store_true')),
(['--hhvm'],
dict(help="create HHVM site", action='store_true')),
(['--pagespeed'],
@ -441,7 +444,7 @@ class EESiteCreateController(CementBaseController):
data = dict(site_name=ee_domain, www_domain=ee_www_domain,
static=False, basic=True, wp=False, w3tc=False,
wpfc=False, wpsc=False, multisite=False,
wpfc=False, wpsc=False, redis=False, multisite=False,
wpsubdir=False, webroot=ee_site_webroot,
ee_db_name='', ee_db_user='', ee_db_pass='',
ee_db_host='')
@ -512,6 +515,21 @@ class EESiteCreateController(CementBaseController):
data['pagespeed'] = False
pagespeed = 0
if (cache == 'redis' not self.app.pargs.experimental) and :
Log.info(self, "Redis is experimental feature and it may not"
"work with all CSS/JS/Cache of your site.\nYou can "
"disable it by passing --redis=off later.\nDo you wish"
" to enable Redis now for {0}?".format(ee_domain))
# Check prompt
check_prompt = input("Type \"y\" to continue [n]:")
if check_prompt != "Y" and check_prompt != "y":
Log.info(self, "Not using Redis for site.")
cache = 'basic'
data['redis'] = False
data['basic'] = True
self.app.pargs.redis = False
# self.app.args.print_help()
# if not data:
# self.app.close(1)

6
ee/cli/plugins/site_functions.py

@ -440,6 +440,10 @@ def setupwordpress(self, data):
if data['wpsc']:
installwp_plugin(self, 'wp-super-cache', data)
"""Install Redis Cache"""
if data['redis']:
installwp_plugin(self, 'redis-cache', data)
"""Install W3 Total Cache"""
if data['w3tc'] or data['wpfc']:
installwp_plugin(self, 'w3-total-cache', data)
@ -812,7 +816,7 @@ def detSitePar(opts):
if val and key in ['html', 'php', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
typelist.append(key)
elif val and key in ['wpfc', 'wpsc', 'w3tc']:
elif val and key in ['wpfc', 'wpsc', 'w3tc', 'redis']:
cachelist.append(key)
if len(typelist) > 1 or len(cachelist) > 1:

26
ee/cli/plugins/stack.py

@ -74,6 +74,8 @@ class EEStackController(CementBaseController):
dict(help='Install Utils stack', action='store_true')),
(['--pagespeed'],
dict(help='Install Pagespeed', action='store_true')),
(['--redis'],
dict(help='Install Redis', action='store_true')),
]
usage = "ee stack (command) [options]"
@ -194,6 +196,17 @@ class EEStackController(CementBaseController):
except CommandExecutionError as e:
Log.error("Failed to initialize dovecot packages")
if set(EEVariables.ee_redis).issubset(set(apt_packages)):
Log.info(self, "Adding repository for Redis, please wait...")
if EEVariables.ee_platform_distro == 'debian':
Log.debug(self, 'Adding repo_url of redis for debian')
EERepo.add(self, repo_url=EEVariables.ee_redis_repo)
Log.debug(self, 'Adding Dotdeb GPG key')
EERepo.add_key(self, '89DF5277')
else:
Log.debug(self, 'Adding ppa for redis')
EERepo.add(self, ppa=EEVariables.ee_redis_repo)
@expose(hide=True)
def post_pref(self, apt_packages, packages):
"""Post activity after installation of packages"""
@ -1359,7 +1372,8 @@ class EEStackController(CementBaseController):
(not self.app.pargs.phpmyadmin) and (not self.app.pargs.hhvm)
and (not self.app.pargs.pagespeed) and
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)
and (not self.app.pargs.redis)):
self.app.pargs.web = True
self.app.pargs.admin = True
@ -1421,6 +1435,16 @@ class EEStackController(CementBaseController):
else:
Log.info(self, "Nginx already installed")
if self.app.pargs.redis:
if not EEAptGet.is_installed(self, 'redis-server'):
if not EEAptGet.is_installed(self, 'nginx-custom'):
self.app.pargs.nginx = True
if not EEAptGet.is_installed(self, 'php5-fpm'):
self.app.pargs.php = True
apt_packages = apt_packages + EEVariables.ee_redis
else:
Log.info(self, "Redis already installed")
if self.app.pargs.nginx:
Log.debug(self, "Setting apt_packages variable for Nginx")

2
ee/cli/templates/virtualconf.mustache

@ -40,7 +40,7 @@ server {
}
{{/static}}
{{^static}}include {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#w3tc}}common/w3tc-hhvm.conf;{{/w3tc}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}} {{/hhvm}}
{{^static}}include {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}}{{#redis}}common/redis.conf;{{/redis}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#w3tc}}common/w3tc-hhvm.conf;{{/w3tc}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}}{{#redis}}common/redis-hhvm.conf;{{/redis}} {{/hhvm}}
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}}
{{#wp}}include common/wpcommon.conf;{{/wp}}
{{^proxy}}include common/locations.conf;{{/proxy}}

10
ee/core/variables.py

@ -154,6 +154,16 @@ class EEVariables():
ee_hhvm = ["hhvm"]
# Redis repo details
if ee_platform_distro == 'ubuntu':
ee_redis_repo = ("ppa:chris-lea/redis-server")
else:
ee_redis_repo = ("deb http://packages.dotdeb.org {codename} all"
.format(codename=ee_platform_codename))
ee_redis = ['redis-server', 'php5-redis']
# Repo path
ee_repo_file = "ee-repo.list"
ee_repo_file_path = ("/etc/apt/sources.list.d/" + ee_repo_file)

Loading…
Cancel
Save