harshadyeola
9 years ago
129 changed files with 26 additions and 13932 deletions
@ -0,0 +1,20 @@ |
|||||
|
# This file is for unifying the coding style for different editors and IDEs |
||||
|
# editorconfig.org |
||||
|
|
||||
|
root = true |
||||
|
|
||||
|
[*] |
||||
|
end_of_line = lf |
||||
|
charset = utf-8 |
||||
|
trim_trailing_whitespace = true |
||||
|
insert_final_newline = true |
||||
|
|
||||
|
# Matches project php files the composer.json and .travis.yml |
||||
|
[php/**/*.php, php/**/*.php] |
||||
|
indent_style = space |
||||
|
indent_size = 4 |
||||
|
|
||||
|
# Matches the composer.json and .travis.yml |
||||
|
[{composer.json,.travis.yml}] |
||||
|
indent_style = space |
||||
|
indent_size = 2 |
@ -1,66 +1,6 @@ |
|||||
# Byte-compiled / optimized / DLL files |
composer.lock |
||||
__pycache__/ |
config.yml |
||||
*.py[cod] |
/cache |
||||
.idea/ |
/vendor |
||||
|
/*.phar |
||||
# C extensions |
/phpunit.xml |
||||
*.so |
|
||||
|
|
||||
# Distribution / packaging |
|
||||
.Python |
|
||||
env/ |
|
||||
build/ |
|
||||
develop-eggs/ |
|
||||
dist/ |
|
||||
downloads/ |
|
||||
eggs/ |
|
||||
lib/ |
|
||||
lib64/ |
|
||||
parts/ |
|
||||
sdist/ |
|
||||
var/ |
|
||||
*.egg-info/ |
|
||||
.installed.cfg |
|
||||
*.egg |
|
||||
|
|
||||
# PyInstaller |
|
||||
# Usually these files are written by a python script from a template |
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it. |
|
||||
*.manifest |
|
||||
*.spec |
|
||||
|
|
||||
# Installer logs |
|
||||
pip-log.txt |
|
||||
pip-delete-this-directory.txt |
|
||||
|
|
||||
# Unit test / coverage reports |
|
||||
htmlcov/ |
|
||||
.tox/ |
|
||||
.coverage |
|
||||
.cache |
|
||||
nosetests.xml |
|
||||
coverage.xml |
|
||||
|
|
||||
# Translations |
|
||||
*.mo |
|
||||
*.pot |
|
||||
|
|
||||
# Django stuff: |
|
||||
*.log |
|
||||
|
|
||||
# Sphinx documentation |
|
||||
docs/_build/ |
|
||||
|
|
||||
# PyBuilder |
|
||||
target/ |
|
||||
|
|
||||
|
|
||||
# Vim .swp file |
|
||||
*.swp |
|
||||
|
|
||||
# Folder created for Nose testing |
|
||||
bin/ |
|
||||
coverage_report/ |
|
||||
include/ |
|
||||
local/ |
|
||||
man/ |
|
||||
|
@ -1,384 +0,0 @@ |
|||||
_ee_complete() |
|
||||
{ |
|
||||
local cur prev BASE_LEVEL |
|
||||
|
|
||||
COMPREPLY=() |
|
||||
cur=${COMP_WORDS[COMP_CWORD]} |
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
||||
mprev=${COMP_WORDS[COMP_CWORD-2]} |
|
||||
|
|
||||
|
|
||||
# SETUP THE BASE LEVEL (everything after "ee") |
|
||||
if [ $COMP_CWORD -eq 1 ]; then |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "stack site debug clean secure import-slow-log log update sync info --version --help --quiet" \ |
|
||||
-- $cur) ) |
|
||||
|
|
||||
|
|
||||
# SETUP THE SECOND LEVEL (EVERYTHING AFTER "ee second") |
|
||||
elif [ $COMP_CWORD -eq 2 ]; then |
|
||||
case "$prev" in |
|
||||
|
|
||||
# HANDLE EVERYTHING AFTER THE SECOND LEVEL NAMESPACE |
|
||||
"clean") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--memcache --opcache --fastcgi --pagespeed --redis --all" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE |
|
||||
"debug") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql -i --interactive --all --import-slow-log --import-slow-log-interval= --nginx=off --php=off --fpm=off --mysql=off --all=off " \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"stack") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "upgrade install purge reload remove restart start status stop migrate" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"site") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "cd create delete disable edit enable info list log show update" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"secure") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--auth --port --ip" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"info") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--mysql --php --nginx" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"log") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "show reset gzip mail" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
# EVERYTHING ELSE |
|
||||
*) |
|
||||
;; |
|
||||
esac |
|
||||
|
|
||||
# SETUP THE THIRD LEVEL (EVERYTHING AFTER "ee second third") |
|
||||
elif [ $COMP_CWORD -eq 3 ]; then |
|
||||
case "$prev" in |
|
||||
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE |
|
||||
"install" | "purge" | "remove" ) |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--pagespeed --web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --all --mailscanner --hhvm --redis --phpredisadmin" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"upgrade" ) |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--web --mail --nginx --php --mysql --postfix --all --hhvm --php56 --no-prompt --wpcli" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"start" | "stop" | "reload" | "restart" | "status") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--nginx --php --mysql --postfix --memcache --dovecot --redis" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"migrate") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--mariadb" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"list") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--enabled --disabled" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"edit" | "enable" | "info" | "log" | "show" | "cd" | "delete") |
|
||||
if [ ${COMP_WORDS[1]} == "log" ]; then |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \ |
|
||||
-- $cur) ) |
|
||||
else |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null)" \ |
|
||||
-- $cur) ) |
|
||||
fi |
|
||||
;; |
|
||||
"update") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --all" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"gzip") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"mail") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access --to=" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"reset") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --wp --access --slow-log-db" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"disable") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
*) |
|
||||
;; |
|
||||
esac |
|
||||
|
|
||||
if [ ${COMP_WORDS[1]} == "debug" ] && ([ "$prev" != "--start" ] && [ "$prev" != "--nginx" ] && [ "$prev" != "--php" ] && [ "$prev" != "--fpm" ] && [ "$prev" != "--mysql" ] && [ "$prev" != "-i" ] && [ "$prev" != "--interactive" ] && [ "$prev" != "--import-slow-log" ] && [ "$prev" != "--stop" ]); then |
|
||||
retlist="--all --wp --rewrite -i --all=off --wp=off --rewrite=off" |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
fi |
|
||||
|
|
||||
#if [ ${COMP_WORDS[1]} == "log" ] && ([ "$prev" != "--access" ] || [ "$prev" != "--nginx" ] || [ "$prev" != "--php" ] || [ "$prev" != "--fpm" ] || [ "$prev" != "--mysql" ] || [ "$prev" != "-i" ] || ["$prev" != "--interactive" ] || ["$prev" != "--stop" ]); then |
|
||||
# retlist="--all --wp --rewrite -i --all=off --wp=off --rewrite=off" |
|
||||
# ret="${retlist[@]/$prev}" |
|
||||
# COMPREPLY=( $(compgen \ |
|
||||
# -W "$(echo $ret)" \ |
|
||||
# -- $cur) ) |
|
||||
#fi |
|
||||
|
|
||||
|
|
||||
elif [ $COMP_CWORD -eq 4 ]; then |
|
||||
case "$mprev" in |
|
||||
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE |
|
||||
|
|
||||
"create") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--user --pass --email --html --php --mysql --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --proxy= --pagespeed --wpredis" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"update") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--password --php --mysql --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --hhvm=off --pagespeed --pagespeed=off --wpredis" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"delete") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--db --files --all --no-prompt --force -f" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"show") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--wp --nginx --php --fpm --mysql --access" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"gzip") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--wp --nginx --php --fpm --mysql --access" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"mail") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--wp --nginx --php --fpm --mysql --access --to=" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"reset") |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--wp --nginx --php --fpm --mysql --wp --access --slow-log-db" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
edit) |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "--pagespeed" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
*) |
|
||||
;; |
|
||||
esac |
|
||||
|
|
||||
fi |
|
||||
|
|
||||
case "$prev" in |
|
||||
"--wp") |
|
||||
if [ ${COMP_WORDS[1]} != "debug" ]; then |
|
||||
if [ ${COMP_WORDS[2]} == "create" ]; then |
|
||||
retlist="--wp --wpsc --w3tc --wpfc --pagespeed --hhvm --user --email --pass --wpredis" |
|
||||
elif [ ${COMP_WORDS[2]} == "update" ]; then |
|
||||
retlist="--wp --w3tc --wpfc --wpsc --pagespeed --hhvm --pagespeed=off --hhvm=off --wpredis" |
|
||||
else |
|
||||
retlist="" |
|
||||
fi |
|
||||
else |
|
||||
retlist="--wp --wp=off --rewrite --rewrite=off -i --interactive" |
|
||||
fi |
|
||||
|
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--wpsubdir" | "--wpsubdomain") |
|
||||
if [ ${COMP_WORDS[1]} != "debug" ]; then |
|
||||
if [ ${COMP_WORDS[2]} == "create" ]; then |
|
||||
retlist="--wpsc --w3tc --wpfc --pagespeed --hhvm --user --email --pass --wpredis" |
|
||||
elif [ ${COMP_WORDS[2]} == "update" ]; then |
|
||||
retlist="--w3tc --wpfc --wpsc --pagespeed --hhvm --pagespeed=off --hhvm=off --wpredis" |
|
||||
else |
|
||||
retlist="" |
|
||||
fi |
|
||||
else |
|
||||
retlist="--wp=off --rewrite --rewrite=off -i --interactive" |
|
||||
fi |
|
||||
|
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--pagespeed" | "--hhvm" | "--wpredis" | "--w3tc" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp") |
|
||||
if [ ${COMP_WORDS[2]} == "create" ]; then |
|
||||
retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --pagespeed --experimenal --wpredis" |
|
||||
else |
|
||||
retlist="" |
|
||||
fi |
|
||||
|
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--pagespeed" | "--hhvm" | "--wpredis" | "--w3tc" | "--wpfc") |
|
||||
if [ ${COMP_WORDS[2]} == "update" ]; then |
|
||||
retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --hhvm=off --pagespeed --pagespeed=off --experimenal --wpredis" |
|
||||
else |
|
||||
retlist="" |
|
||||
fi |
|
||||
|
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot" | "--redis | --phpredisadmin") |
|
||||
if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then |
|
||||
retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot --redis --phpredisadmin" |
|
||||
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then |
|
||||
retlist="--nginx --php --mysql --postfix --memcache --dovecot --redis" |
|
||||
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then |
|
||||
retlist="--start --nginx --php --fpm --mysql -i --interactive -stop --import-slow-log --import-slow-log-interval= -" |
|
||||
if [[ $prev == '--mysql' ]]; then |
|
||||
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop --import-slow-log" |
|
||||
fi |
|
||||
elif [[ ${COMP_WORDS[1]} == "log" ]]; then |
|
||||
if [ ${COMP_WORDS[2]} == "show" ]; then |
|
||||
retlist="--access --nginx --php --mysql --fpm --wp" |
|
||||
|
|
||||
elif [ ${COMP_WORDS[2]} == "reset" ]; then |
|
||||
retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db" |
|
||||
|
|
||||
elif [ ${COMP_WORDS[2]} == "mail" ]; then |
|
||||
retlist="--access --nginx --php --mysql --fpm --wp --to=" |
|
||||
|
|
||||
fi |
|
||||
fi |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--db" | "--files" | "--force") |
|
||||
retlist="--db --files --all --force" |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--all") |
|
||||
if [ ${COMP_WORDS[1]} == "clean" ]; then |
|
||||
retlist="--memcache --opcache --fastcgi --redis" |
|
||||
elif [ ${COMP_WORDS[2]} == "delete" ]; then |
|
||||
retlist="--db --files --force" |
|
||||
elif [ ${COMP_WORDS[2]} == "update" ]; then |
|
||||
retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --hhvm=off --pagespeed --pagespeed=off --wpredis" |
|
||||
else |
|
||||
retlist="" |
|
||||
fi |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
|
|
||||
"--memcache" | "--opcache" | "--fastcgi" | "--all" | "--redis" | "--pagespeed") |
|
||||
retlist="--memcache --opcache --fastcgi --pagespeed --redis --all" |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"--auth" | "--port" | "--ip") |
|
||||
retlist="--auth --port --ip" |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
"--access" | "--fpm" | "--wp" | "--slow-log-db") |
|
||||
if [[ ${COMP_WORDS[1]} == "log" ]]; then |
|
||||
if [ ${COMP_WORDS[2]} == "show" ]; then |
|
||||
retlist="--access --nginx --php --mysql --fpm --wp" |
|
||||
|
|
||||
elif [ ${COMP_WORDS[2]} == "reset" ]; then |
|
||||
retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db" |
|
||||
|
|
||||
|
|
||||
elif [ ${COMP_WORDS[2]} == "mail" ]; then |
|
||||
retlist="--access --nginx --php --mysql --fpm --wp --to=" |
|
||||
|
|
||||
fi |
|
||||
fi |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
*) |
|
||||
;; |
|
||||
esac |
|
||||
case "$mprev" in |
|
||||
"--user" | "--email" | "--pass") |
|
||||
if [ ${COMP_WORDS[2]} == "create" ]; then |
|
||||
retlist="--user --pass --email --html --php --mysql --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --pagespeed --wpredis" |
|
||||
fi |
|
||||
ret="${retlist[@]/$prev}" |
|
||||
COMPREPLY=( $(compgen \ |
|
||||
-W "$(echo $ret)" \ |
|
||||
-- $cur) ) |
|
||||
;; |
|
||||
esac |
|
||||
|
|
||||
return 0 |
|
||||
|
|
||||
} && |
|
||||
complete -F _ee_complete ee |
|
@ -1,82 +0,0 @@ |
|||||
# EasyEngine Configuration |
|
||||
# |
|
||||
# All commented values are the application default |
|
||||
# |
|
||||
|
|
||||
[ee] |
|
||||
|
|
||||
### Toggle application level debug (does not toggle framework debugging) |
|
||||
# debug = false |
|
||||
|
|
||||
### Where external (third-party) plugins are loaded from |
|
||||
# plugin_dir = /var/lib/ee/plugins/ |
|
||||
|
|
||||
### Where all plugin configurations are loaded from |
|
||||
# plugin_config_dir = /etc/ee/plugins.d/ |
|
||||
|
|
||||
### Where external templates are loaded from |
|
||||
# template_dir = /var/lib/ee/templates/ |
|
||||
|
|
||||
|
|
||||
[log.logging] |
|
||||
|
|
||||
### Where the log file lives (no log file by default) |
|
||||
file = /var/log/ee/ee.log |
|
||||
|
|
||||
### The level for which to log. One of: info, warn, error, fatal, debug |
|
||||
level = debug |
|
||||
|
|
||||
### Whether or not to log to console |
|
||||
to_console = false |
|
||||
|
|
||||
### Whether or not to rotate the log file when it reaches `max_bytes` |
|
||||
rotate = true |
|
||||
|
|
||||
### Max size in bytes that a log file can grow until it is rotated. |
|
||||
max_bytes = 512000 |
|
||||
|
|
||||
### The maximun number of log files to maintain when rotating |
|
||||
max_files = 7 |
|
||||
|
|
||||
[stack] |
|
||||
|
|
||||
### IP address that will be used in Nginx configurations while installing |
|
||||
ip-address = 127.0.0.1 |
|
||||
|
|
||||
[mysql] |
|
||||
|
|
||||
### MySQL database grant host name |
|
||||
grant-host = localhost |
|
||||
|
|
||||
### Ask for MySQL db name while site creation |
|
||||
db-name = False |
|
||||
|
|
||||
### Ask for MySQL user name while site creation |
|
||||
db-user = False |
|
||||
|
|
||||
[wordpress] |
|
||||
|
|
||||
### Ask for WordPress prefix while site creation |
|
||||
prefix = False |
|
||||
|
|
||||
### User name for WordPress sites |
|
||||
user = |
|
||||
|
|
||||
### Password for WordPress sites |
|
||||
password = |
|
||||
|
|
||||
### EMail for WordPress sites |
|
||||
email = |
|
||||
|
|
||||
[update] |
|
||||
|
|
||||
### If enabled, load a plugin named `update` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
||||
|
|
||||
[sync] |
|
||||
### If enabled, load a plugin named `update` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[clean] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[debug] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[import_slow_log] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,11 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[info] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
||||
|
|
||||
### Additional plugin configuration settings |
|
||||
foo = bar |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[log] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[secure] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[site] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[stack] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,8 +0,0 @@ |
|||||
### Example Plugin Configuration for EasyEngine |
|
||||
|
|
||||
[update] |
|
||||
|
|
||||
### If enabled, load a plugin named `example` either from the Python module |
|
||||
### `ee.cli.plugins.example` or from the file path |
|
||||
### `/var/lib/ee/plugins/example.py` |
|
||||
enable_plugin = true |
|
@ -1,329 +0,0 @@ |
|||||
.TH ee 8 "EasyEngine (ee) version: 3.3.8" "Sep 10,2015" "EasyEngine" |
|
||||
.SH NAME |
|
||||
.B EasyEngine (ee) |
|
||||
\- Manage Nginx Based Websites. |
|
||||
.SH SYNOPSIS |
|
||||
ee [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync] |
|
||||
.TP |
|
||||
ee stack [ install | remove | purge | migrate | upgrade] [ --web | --mail | --all | --nginx | --php | --mysql | --admin | --postfix | --mailscanner | --adminer | --redis | --hhvm | --phpmyadmin | --phpredisadmin | --wpcli | --utils ] |
|
||||
.TP |
|
||||
ee stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --mysql | --devcot | --web | --postfix | --memcache | --redis] |
|
||||
.TP |
|
||||
ee site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ] |
|
||||
.TP |
|
||||
ee site create example.com [ --html | --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --pagespeed ]] |
|
||||
.TP |
|
||||
ee site update example.com [ --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --pagespeed ] [--password]] |
|
||||
.TP |
|
||||
ee site delete example.com [--db | --files | --all | --no-prompt | --force/-f ] |
|
||||
.TP |
|
||||
ee debug [ -i | --all=on/off |--nginx=on/off | --rewrite=on/off | --php=on/off | --fpm=on/off | --mysql=on/off ] |
|
||||
.TP |
|
||||
ee debug example.com [ -i | --all=on/off | --nginx=on/off | --rewrite=on/off | --wp=on/off ] |
|
||||
.TP |
|
||||
ee secure [ --auth | --port | --ip ] |
|
||||
.SH DESCRIPTION |
|
||||
EasyEngine aka ee is the opensource project developed with the purpose to automate web-server configuration. |
|
||||
.br |
|
||||
EasyEngine is the collection of python script that provides automation for the web-server |
|
||||
.br |
|
||||
installation, site creation, services debugging & monitoring. |
|
||||
.SH OPTIONS |
|
||||
.TP |
|
||||
.B --version |
|
||||
.br |
|
||||
Display easyengine (ee) version information. |
|
||||
.TP |
|
||||
.B info |
|
||||
.br |
|
||||
ee info - Display Nginx, PHP, MySQL and ee common location information |
|
||||
.br |
|
||||
ee site info - Diplay given website details like enable, disable. weboot and log files. |
|
||||
.TP |
|
||||
.B --help |
|
||||
.br |
|
||||
Display easyengine (ee) help. |
|
||||
.TP |
|
||||
.B stack |
|
||||
.TP |
|
||||
.B install [ --all | --web | --mail | --nginx | --php | --mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] |
|
||||
.br |
|
||||
Install Nginx PHP5 MySQL Postfix stack Packages if not used with |
|
||||
.br |
|
||||
any options.Installs specific package if used with option. |
|
||||
.TP |
|
||||
.B remove [ --all | --web | --mail | --nginx | --php | --mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] |
|
||||
.br |
|
||||
Remove Nginx PHP5 MySQL Postfix stack Packages if not used with |
|
||||
.br |
|
||||
any options. Remove specific package if used with option. |
|
||||
.TP |
|
||||
.B purge [ --all | --web | --mail | --nginx | --php | --mysql | --redis | --postfix | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils ] |
|
||||
.br |
|
||||
Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any |
|
||||
.br |
|
||||
options.Purge specific package if used with option. |
|
||||
.TP |
|
||||
.B status |
|
||||
.br |
|
||||
Display status of NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server services. |
|
||||
.TP |
|
||||
.B start |
|
||||
.br |
|
||||
Start services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. |
|
||||
.TP |
|
||||
.B stop |
|
||||
.br |
|
||||
Stop services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. |
|
||||
.TP |
|
||||
.B reload |
|
||||
.br |
|
||||
Reload services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. |
|
||||
.TP |
|
||||
.B restart |
|
||||
.br |
|
||||
Restart services NGINX, PHP5-FPM, MySQL, Postfix, Redis-Server. |
|
||||
.TP |
|
||||
.B site |
|
||||
.br |
|
||||
.TP |
|
||||
.B cd [ example.com ] |
|
||||
.br |
|
||||
Change directory to webroot of specified site in subshell. |
|
||||
.TP |
|
||||
.B log [ example.com ] |
|
||||
.br |
|
||||
monitor access and error logs for site specified. |
|
||||
.TP |
|
||||
.B list [ --enabled | --disabled ] |
|
||||
.br |
|
||||
Lists all available sites from /etc/nginx/sites-enabled/ |
|
||||
.br |
|
||||
by default & enable argument. Display sites list from |
|
||||
.br |
|
||||
/etc/nginx/sites-available/ if used with available option. |
|
||||
.TP |
|
||||
.B info [ example.com ] |
|
||||
.br |
|
||||
prints information about site such as access log, error log |
|
||||
.br |
|
||||
location and type of site. |
|
||||
.TP |
|
||||
.B show [ example.com ] |
|
||||
.br |
|
||||
Display NGINX configuration of site. |
|
||||
.TP |
|
||||
.B enable [ example.com ] |
|
||||
.br |
|
||||
Enable site by creating softlink with site file in |
|
||||
.br |
|
||||
/etc/nginx/sites-available to /etc/nginx/sites-enabled/. |
|
||||
.TP |
|
||||
.B disable [ example.com ] |
|
||||
.br |
|
||||
Disable site by Destroying softlink with site file in |
|
||||
.br |
|
||||
/etc/nginx/sites-available to /etc/nginx/sites-enabled/. |
|
||||
.TP |
|
||||
.B edit [ example.com ] |
|
||||
.br |
|
||||
Edit NGINX configuration of site. |
|
||||
.TP |
|
||||
.B create [ example.com ] [ --html | --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --pagespeed ]] |
|
||||
.br |
|
||||
Create new site according to given options. If no options provided |
|
||||
.br |
|
||||
create static site with html only. |
|
||||
.TP |
|
||||
.B update [ example.com ] [ --html | --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [ --wpsc | --w3tc | --wpfc | --wpredis | --hhvm | --pagespeed ] [--password]] |
|
||||
.br |
|
||||
Update site configuration according to specified options. |
|
||||
.TP |
|
||||
.B delete [ example.com ] [--no-prompt ] [--force/-f] [ --db | --files | --all ] |
|
||||
.br |
|
||||
Delete site i.e webroot, database, ad configuration permanently. |
|
||||
.TP |
|
||||
.B debug [ -i | --nginx=on/off | --php=on/off | --mysql=on/off | --rewrite=on/off | --fpm=on/off ] |
|
||||
.br |
|
||||
Starts server level debugging. If this is used without arguments it will start debugging |
|
||||
.br |
|
||||
all services.Else it will debug only service provided with argument.This will Stop |
|
||||
.br |
|
||||
Debugging if used with --all=off argument. |
|
||||
.TP |
|
||||
.B debug example.com [ -i | --nginx=on/off | --rewrite=on/off | --wp=on/off | --all=on/off ] |
|
||||
.br |
|
||||
Starts site level debugging. If this is used without arguments it will start debugging all |
|
||||
.br |
|
||||
services.Else it will debug only service provided with argument.This will Stop Debugging |
|
||||
.br |
|
||||
if used with --all=off argument. |
|
||||
.TP |
|
||||
.B secure [ --auth | --port | --ip ] |
|
||||
.br |
|
||||
Update security settings. |
|
||||
.TP |
|
||||
.B clean [ --fastcgi | --opcache | --memcache | --redis | --pagespeed | --all ] |
|
||||
.br |
|
||||
Clean NGINX fastCGI cache, Opcache, Memcache, Redis cache, Pagespeed cache. |
|
||||
.br |
|
||||
Clean NGINX fastCGI cache if no option specified. |
|
||||
.SH ARGUMENTS |
|
||||
.TP |
|
||||
.B -i |
|
||||
.br |
|
||||
setup intractive mode while used with debug. |
|
||||
.TP |
|
||||
.B --nginx=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to start or stop nginx debugging. |
|
||||
.TP |
|
||||
.B --php=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to start or stop php debugging. |
|
||||
.TP |
|
||||
.B --mysql=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to start or stop mysql debugging. |
|
||||
.TP |
|
||||
.B --rewrite=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to start or stop nginx rewrite rules debugging. |
|
||||
.TP |
|
||||
.B --fpm=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to start or stop fpm debugging. |
|
||||
.TP |
|
||||
.B --wp=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to start or stop wordpress site debugging. |
|
||||
.TP |
|
||||
.B --all=on/off |
|
||||
.br |
|
||||
used with ee debug command. used to stop debugging. |
|
||||
.TP |
|
||||
.B --all=off |
|
||||
.br |
|
||||
used with ee debug command. used to stop debugging. |
|
||||
.TP |
|
||||
.B --html |
|
||||
.br |
|
||||
Create a HTML website. |
|
||||
.TP |
|
||||
.B --php |
|
||||
.br |
|
||||
Create a PHP website. |
|
||||
.TP |
|
||||
.B --mysql |
|
||||
.br |
|
||||
Create a PHP+MySQL website. |
|
||||
.TP |
|
||||
.B --wp |
|
||||
.br |
|
||||
Create a WordPress Website. |
|
||||
.TP |
|
||||
.B --wpsubdir |
|
||||
.br |
|
||||
Create a Wordpress Multisite with Sub Directories Setup. |
|
||||
.TP |
|
||||
.B --wpsubdomain |
|
||||
.br |
|
||||
Create a Wordpress Multisite with Sub Domains Setup. |
|
||||
.br |
|
||||
.TP |
|
||||
.B --db |
|
||||
.br |
|
||||
Delete website database. |
|
||||
.br |
|
||||
.TP |
|
||||
.B --files |
|
||||
.br |
|
||||
Delete website webroot. |
|
||||
.br |
|
||||
.TP |
|
||||
.B --no-prompt |
|
||||
.br |
|
||||
Does not prompt for confirmation when delete command used. |
|
||||
.br |
|
||||
.TP |
|
||||
.B --force/-f |
|
||||
.br |
|
||||
Delete website webroot and database forcefully.Remove nginx configuration for site. |
|
||||
.br |
|
||||
.TP |
|
||||
.B --auth |
|
||||
.br |
|
||||
used with ee secure command. Update credential of HTTP authentication |
|
||||
.TP |
|
||||
.B --port |
|
||||
.br |
|
||||
used with ee secure command. Change EasyEngine admin port 22222. |
|
||||
.TP |
|
||||
.B --ip |
|
||||
.br |
|
||||
used with ee secure command. Update whitelist IP address |
|
||||
.SH WORDPRESS CACHING OPTIONS |
|
||||
.TP |
|
||||
.B --w3tc |
|
||||
.br |
|
||||
Install and activate Nginx-helper and W3 Total Cache plugin. |
|
||||
.TP |
|
||||
.B --wpsc |
|
||||
.br |
|
||||
Install and activate Nginx-helper and WP Super Cache plugin. |
|
||||
.TP |
|
||||
.B --wpfc |
|
||||
.br |
|
||||
Install and activate Nginx-helper and W3 Total Cache plugin with |
|
||||
.br |
|
||||
Nginx FastCGI cache. |
|
||||
.TP |
|
||||
.B --wpredis |
|
||||
.br |
|
||||
Install, activate, configure Nginx-helper and Redis Object Cache Plugin, Configure NGINX for Redis Page Caching. |
|
||||
.TP |
|
||||
.B --hhvm |
|
||||
.br |
|
||||
Install, activate Nginx-helper and configure NGINX for HHVM. |
|
||||
.SH FILES |
|
||||
.br |
|
||||
/etc/easyengine/ee.conf |
|
||||
.SH BUGS |
|
||||
Report bugs at <http://github.com/rtCamp/easyengine/issues/> |
|
||||
.SH AUTHOR |
|
||||
.br |
|
||||
.B rtCamp Team |
|
||||
.I \<admin@rtcamp.com\> |
|
||||
.br |
|
||||
.B Mitesh Shah |
|
||||
.I \<Mitesh.Shah@rtcamp.com\> |
|
||||
.br |
|
||||
.B Manish |
|
||||
.I \<Manish.Songirkar@rtcamp.com\> |
|
||||
.br |
|
||||
.B Gaurav |
|
||||
.I \<Gaurav.Astikar@rtcamp.com\> |
|
||||
.br |
|
||||
.B Harshad |
|
||||
.I \<harshad.yeola@rtcamp.com> |
|
||||
.br |
|
||||
.B Shital |
|
||||
.I \<shital.patil@rtcamp.com\> |
|
||||
.br |
|
||||
.B Prabuddha |
|
||||
.I \<prabuddha.chakraborty@rtcamp.com\> |
|
||||
.br |
|
||||
.B Rajdeep Sharma |
|
||||
.I \<rajdeep.sharma@rtcamp.com\> |
|
||||
.br |
|
||||
|
|
||||
.SH "SEE ALSO" |
|
||||
.br |
|
||||
EE: |
|
||||
.I https://rtcamp.com/easyengine/ |
|
||||
.br |
|
||||
FAQ: |
|
||||
.I https://rtcamp.com/easyengine/faq/ |
|
||||
.br |
|
||||
DOCS: |
|
||||
.I https://rtcamp.com/easyengine/docs/ |
|
@ -1 +0,0 @@ |
|||||
__import__('pkg_resources').declare_namespace(__name__) |
|
@ -1,11 +0,0 @@ |
|||||
"""EasyEngine bootstrapping.""" |
|
||||
|
|
||||
# All built-in application controllers should be imported, and registered |
|
||||
# in this file in the same way as EEBaseController. |
|
||||
|
|
||||
from cement.core import handler |
|
||||
from ee.cli.controllers.base import EEBaseController |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
handler.register(EEBaseController) |
|
@ -1,25 +0,0 @@ |
|||||
"""EasyEngine base controller.""" |
|
||||
|
|
||||
from cement.core.controller import CementBaseController, expose |
|
||||
from ee.core.variables import EEVariables |
|
||||
VERSION = EEVariables.ee_version |
|
||||
|
|
||||
BANNER = """ |
|
||||
EasyEngine v%s |
|
||||
Copyright (c) 2015 rtCamp Solutions Pvt. Ltd. |
|
||||
""" % VERSION |
|
||||
|
|
||||
|
|
||||
class EEBaseController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'base' |
|
||||
description = ("EasyEngine is the commandline tool to manage your" |
|
||||
" websites based on WordPress and Nginx with easy to" |
|
||||
" use commands") |
|
||||
arguments = [ |
|
||||
(['-v', '--version'], dict(action='version', version=BANNER)), |
|
||||
] |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
self.app.args.print_help() |
|
@ -1,20 +0,0 @@ |
|||||
# Based on https://github.com/datafolklabs/cement/issues/295 |
|
||||
# To avoid encoding releated error,we defined our custom output handler |
|
||||
# I hope we will remove this when we upgarde to Cement 2.6 (Not released yet) |
|
||||
import os |
|
||||
from cement.utils import fs |
|
||||
from cement.ext.ext_mustache import MustacheOutputHandler |
|
||||
|
|
||||
|
|
||||
class EEOutputHandler(MustacheOutputHandler): |
|
||||
class Meta: |
|
||||
label = 'ee_output_handler' |
|
||||
|
|
||||
def _load_template_from_file(self, path): |
|
||||
for templ_dir in self.app._meta.template_dirs: |
|
||||
full_path = fs.abspath(os.path.join(templ_dir, path)) |
|
||||
if os.path.exists(full_path): |
|
||||
self.app.log.debug('loading template file %s' % full_path) |
|
||||
return open(full_path, encoding='utf-8', mode='r').read() |
|
||||
else: |
|
||||
continue |
|
@ -1,135 +0,0 @@ |
|||||
"""EasyEngine main application entry point.""" |
|
||||
import sys |
|
||||
import os |
|
||||
|
|
||||
# this has to happen after you import sys, but before you import anything |
|
||||
# from Cement "source: https://github.com/datafolklabs/cement/issues/290" |
|
||||
if '--debug' in sys.argv: |
|
||||
sys.argv.remove('--debug') |
|
||||
TOGGLE_DEBUG = True |
|
||||
else: |
|
||||
TOGGLE_DEBUG = False |
|
||||
|
|
||||
from cement.core import foundation |
|
||||
from cement.utils.misc import init_defaults |
|
||||
from cement.core.exc import FrameworkError, CaughtSignal |
|
||||
from cement.ext.ext_argparse import ArgParseArgumentHandler |
|
||||
from ee.core import exc |
|
||||
from ee.cli.ext.ee_outputhandler import EEOutputHandler |
|
||||
|
|
||||
# Application default. Should update config/ee.conf to reflect any |
|
||||
# changes, or additions here. |
|
||||
defaults = init_defaults('ee') |
|
||||
|
|
||||
# All internal/external plugin configurations are loaded from here |
|
||||
defaults['ee']['plugin_config_dir'] = '/etc/ee/plugins.d' |
|
||||
|
|
||||
# External plugins (generally, do not ship with application code) |
|
||||
defaults['ee']['plugin_dir'] = '/var/lib/ee/plugins' |
|
||||
|
|
||||
# External templates (generally, do not ship with application code) |
|
||||
defaults['ee']['template_dir'] = '/var/lib/ee/templates' |
|
||||
|
|
||||
|
|
||||
class EEArgHandler(ArgParseArgumentHandler): |
|
||||
class Meta: |
|
||||
label = 'ee_args_handler' |
|
||||
|
|
||||
def error(self, message): |
|
||||
super(EEArgHandler, self).error("unknown args") |
|
||||
|
|
||||
|
|
||||
class EEApp(foundation.CementApp): |
|
||||
class Meta: |
|
||||
label = 'ee' |
|
||||
|
|
||||
config_defaults = defaults |
|
||||
|
|
||||
# All built-in application bootstrapping (always run) |
|
||||
bootstrap = 'ee.cli.bootstrap' |
|
||||
|
|
||||
# Optional plugin bootstrapping (only run if plugin is enabled) |
|
||||
plugin_bootstrap = 'ee.cli.plugins' |
|
||||
|
|
||||
# Internal templates (ship with application code) |
|
||||
template_module = 'ee.cli.templates' |
|
||||
|
|
||||
# Internal plugins (ship with application code) |
|
||||
plugin_bootstrap = 'ee.cli.plugins' |
|
||||
|
|
||||
extensions = ['mustache'] |
|
||||
|
|
||||
# default output handler |
|
||||
output_handler = EEOutputHandler |
|
||||
|
|
||||
arg_handler = EEArgHandler |
|
||||
|
|
||||
debug = TOGGLE_DEBUG |
|
||||
|
|
||||
|
|
||||
class EETestApp(EEApp): |
|
||||
"""A test app that is better suited for testing.""" |
|
||||
class Meta: |
|
||||
argv = [] |
|
||||
config_files = [] |
|
||||
|
|
||||
|
|
||||
# Define the applicaiton object outside of main, as some libraries might wish |
|
||||
# to import it as a global (rather than passing it into another class/func) |
|
||||
app = EEApp() |
|
||||
|
|
||||
|
|
||||
def main(): |
|
||||
try: |
|
||||
global sys |
|
||||
# Default our exit status to 0 (non-error) |
|
||||
code = 0 |
|
||||
|
|
||||
# if not root...kick out |
|
||||
if not os.geteuid() == 0: |
|
||||
print("\nOnly root or sudo user can run this EasyEngine\n") |
|
||||
app.close(1) |
|
||||
|
|
||||
# Setup the application |
|
||||
app.setup() |
|
||||
|
|
||||
# Dump all arguments into ee log |
|
||||
app.log.debug(sys.argv) |
|
||||
|
|
||||
# Run the application |
|
||||
app.run() |
|
||||
except exc.EEError as e: |
|
||||
# Catch our application errors and exit 1 (error) |
|
||||
code = 1 |
|
||||
print(e) |
|
||||
except FrameworkError as e: |
|
||||
# Catch framework errors and exit 1 (error) |
|
||||
code = 1 |
|
||||
print(e) |
|
||||
except CaughtSignal as e: |
|
||||
# Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error) |
|
||||
code = 0 |
|
||||
print(e) |
|
||||
except Exception as e: |
|
||||
code = 1 |
|
||||
print(e) |
|
||||
finally: |
|
||||
# Print an exception (if it occurred) and --debug was passed |
|
||||
if app.debug: |
|
||||
import sys |
|
||||
import traceback |
|
||||
|
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info() |
|
||||
if exc_traceback is not None: |
|
||||
traceback.print_exc() |
|
||||
|
|
||||
# # Close the application |
|
||||
app.close(code) |
|
||||
|
|
||||
|
|
||||
def get_test_app(**kw): |
|
||||
app = EEApp(**kw) |
|
||||
return app |
|
||||
|
|
||||
if __name__ == '__main__': |
|
||||
main() |
|
@ -1,126 +0,0 @@ |
|||||
"""Clean Plugin for EasyEngine.""" |
|
||||
|
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.aptget import EEAptGet |
|
||||
from ee.core.services import EEService |
|
||||
from ee.core.logging import Log |
|
||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
import os |
|
||||
import urllib.request |
|
||||
|
|
||||
|
|
||||
def ee_clean_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EECleanController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'clean' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
description = ('Clean NGINX FastCGI cache, Opcacache, Memcache, Pagespeed Cache, Redis Cache') |
|
||||
arguments = [ |
|
||||
(['--all'], |
|
||||
dict(help='Clean all cache', action='store_true')), |
|
||||
(['--fastcgi'], |
|
||||
dict(help='Clean FastCGI cache', action='store_true')), |
|
||||
(['--memcache'], |
|
||||
dict(help='Clean MemCache', action='store_true')), |
|
||||
(['--opcache'], |
|
||||
dict(help='Clean OpCache', action='store_true')), |
|
||||
(['--pagespeed'], |
|
||||
dict(help='Clean Pagespeed Cache', action='store_true')), |
|
||||
(['--redis'], |
|
||||
dict(help='Clean Redis Cache', action='store_true')), |
|
||||
] |
|
||||
usage = "ee clean [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
if (not (self.app.pargs.all or self.app.pargs.fastcgi or |
|
||||
self.app.pargs.memcache or self.app.pargs.opcache or |
|
||||
self.app.pargs.pagespeed or self.app.pargs.redis)): |
|
||||
self.clean_fastcgi() |
|
||||
if self.app.pargs.all: |
|
||||
self.clean_memcache() |
|
||||
self.clean_fastcgi() |
|
||||
self.clean_opcache() |
|
||||
self.clean_redis() |
|
||||
self.clean_pagespeed() |
|
||||
if self.app.pargs.fastcgi: |
|
||||
self.clean_fastcgi() |
|
||||
if self.app.pargs.memcache: |
|
||||
self.clean_memcache() |
|
||||
if self.app.pargs.opcache: |
|
||||
self.clean_opcache() |
|
||||
if self.app.pargs.pagespeed: |
|
||||
self.clean_pagespeed() |
|
||||
if self.app.pargs.redis: |
|
||||
self.clean_redis() |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def clean_redis(self): |
|
||||
"""This function clears Redis cache""" |
|
||||
if(EEAptGet.is_installed(self, "redis-server")): |
|
||||
Log.info(self, "Cleaning Redis cache") |
|
||||
EEShellExec.cmd_exec(self, "redis-cli flushall") |
|
||||
else: |
|
||||
Log.info(self, "Redis is not installed") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def clean_memcache(self): |
|
||||
"""This function Clears memcache """ |
|
||||
try: |
|
||||
if(EEAptGet.is_installed(self, "memcached")): |
|
||||
EEService.restart_service(self, "memcached") |
|
||||
Log.info(self, "Cleaning MemCache") |
|
||||
else: |
|
||||
Log.info(self, "Memcache not installed") |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to restart Memcached", False) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def clean_fastcgi(self): |
|
||||
"""This function clears Fastcgi cache""" |
|
||||
if(os.path.isdir("/var/run/nginx-cache")): |
|
||||
Log.info(self, "Cleaning NGINX FastCGI cache") |
|
||||
EEShellExec.cmd_exec(self, "rm -rf /var/run/nginx-cache/*") |
|
||||
else: |
|
||||
Log.error(self, "Unable to clean FastCGI cache", False) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def clean_opcache(self): |
|
||||
"""This function clears opcache""" |
|
||||
try: |
|
||||
Log.info(self, "Cleaning opcache") |
|
||||
wp = urllib.request.urlopen(" https://127.0.0.1:22222/cache" |
|
||||
"/opcache/opgui.php?page=reset").read() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.debug(self, "Unable hit url, " |
|
||||
" https://127.0.0.1:22222/cache/opcache/opgui.php?page=reset," |
|
||||
" please check you have admin tools installed") |
|
||||
Log.debug(self, "please check you have admin tools installed," |
|
||||
" or install them with `ee stack install --admin`") |
|
||||
Log.error(self, "Unable to clean opcache", False) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def clean_pagespeed(self): |
|
||||
"""This function clears Pagespeed cache""" |
|
||||
if(os.path.isdir("/var/ngx_pagespeed_cache")): |
|
||||
Log.info(self, "Cleaning PageSpeed cache") |
|
||||
EEShellExec.cmd_exec(self, "rm -rf /var/ngx_pagespeed_cache/*") |
|
||||
else: |
|
||||
Log.debug(self, "/var/ngx_pagespeed_cache does not exist," |
|
||||
" so cache not cleared") |
|
||||
Log.error(self, "Unable to clean pagespeed cache", False) |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EECleanController) |
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_clean_hook) |
|
@ -1,702 +0,0 @@ |
|||||
"""Debug Plugin for EasyEngine""" |
|
||||
|
|
||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.shellexec import * |
|
||||
from ee.core.mysql import EEMysql |
|
||||
from ee.core.services import EEService |
|
||||
from ee.core.logging import Log |
|
||||
from ee.cli.plugins.site_functions import logwatch |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.fileutils import EEFileUtils |
|
||||
from pynginxconfig import NginxConfig |
|
||||
import os |
|
||||
import configparser |
|
||||
import glob |
|
||||
import signal |
|
||||
import subprocess |
|
||||
|
|
||||
|
|
||||
def ee_debug_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEDebugController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'debug' |
|
||||
description = 'Used for server level debugging' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
arguments = [ |
|
||||
(['--stop'], |
|
||||
dict(help='Stop debug', action='store_true')), |
|
||||
(['--start'], |
|
||||
dict(help='Start debug', action='store_true')), |
|
||||
(['--import-slow-log'], |
|
||||
dict(help='Import MySQL slow log to Anemometer database', |
|
||||
action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='start/stop debugging nginx server ' |
|
||||
'configuration for site', |
|
||||
action='store' or 'store_const', |
|
||||
choices=('on', 'off'), const='on', nargs='?')), |
|
||||
(['--php'], |
|
||||
dict(help='start/stop debugging server php configuration', |
|
||||
action='store' or 'store_const', |
|
||||
choices=('on', 'off'), const='on', nargs='?')), |
|
||||
(['--fpm'], |
|
||||
dict(help='start/stop debugging fastcgi configuration', |
|
||||
action='store' or 'store_const', |
|
||||
choices=('on', 'off'), const='on', nargs='?')), |
|
||||
(['--mysql'], |
|
||||
dict(help='start/stop debugging mysql server', |
|
||||
action='store' or 'store_const', |
|
||||
choices=('on', 'off'), const='on', nargs='?')), |
|
||||
(['--wp'], |
|
||||
dict(help='start/stop wordpress debugging for site', |
|
||||
action='store' or 'store_const', choices=('on', 'off'), |
|
||||
const='on', nargs='?')), |
|
||||
(['--rewrite'], |
|
||||
dict(help='start/stop debugging nginx rewrite rules for site', |
|
||||
action='store' or 'store_const', choices=('on', 'off'), |
|
||||
const='on', nargs='?')), |
|
||||
(['--all'], |
|
||||
dict(help='start/stop debugging all server parameters', |
|
||||
action='store' or 'store_const', choices=('on', 'off'), |
|
||||
const='on', nargs='?')), |
|
||||
(['-i', '--interactive'], |
|
||||
dict(help='Interactive debug', action='store_true')), |
|
||||
(['--import-slow-log-interval'], |
|
||||
dict(help='Import MySQL slow log to Anemometer', |
|
||||
action='store', dest='interval')), |
|
||||
(['site_name'], |
|
||||
dict(help='Website Name', nargs='?', default=None)) |
|
||||
] |
|
||||
usage = "ee debug [<site_name>] [options] " |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def debug_nginx(self): |
|
||||
"""Start/Stop Nginx debug""" |
|
||||
# start global debug |
|
||||
if (self.app.pargs.nginx == 'on' and not self.app.pargs.site_name): |
|
||||
try: |
|
||||
debug_address = (self.app.config.get('stack', 'ip-address') |
|
||||
.split()) |
|
||||
except Exception as e: |
|
||||
debug_address = ['0.0.0.0/0'] |
|
||||
|
|
||||
# Check if IP address is 127.0.0.1 then enable debug globally |
|
||||
if debug_address == ['127.0.0.1'] or debug_address == []: |
|
||||
debug_address = ['0.0.0.0/0'] |
|
||||
|
|
||||
for ip_addr in debug_address: |
|
||||
if not ("debug_connection "+ip_addr in open('/etc/nginx/' |
|
||||
'nginx.conf', encoding='utf-8').read()): |
|
||||
Log.info(self, "Setting up Nginx debug connection" |
|
||||
" for "+ip_addr) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/events {{/a\\ \\ \\ " |
|
||||
"\\ $(echo debug_connection " |
|
||||
"{ip}\;)\" /etc/nginx/" |
|
||||
"nginx.conf".format(ip=ip_addr)) |
|
||||
self.trigger_nginx = True |
|
||||
|
|
||||
if not self.trigger_nginx: |
|
||||
Log.info(self, "Nginx debug connection already enabled") |
|
||||
|
|
||||
self.msg = self.msg + ["/var/log/nginx/*.error.log"] |
|
||||
|
|
||||
# stop global debug |
|
||||
elif (self.app.pargs.nginx == 'off' and not self.app.pargs.site_name): |
|
||||
if "debug_connection " in open('/etc/nginx/nginx.conf', |
|
||||
encoding='utf-8').read(): |
|
||||
Log.info(self, "Disabling Nginx debug connections") |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/debug_connection.*/d\"" |
|
||||
" /etc/nginx/nginx.conf") |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "Nginx debug connection already disabled") |
|
||||
|
|
||||
# start site specific debug |
|
||||
elif (self.app.pargs.nginx == 'on'and self.app.pargs.site_name): |
|
||||
config_path = ("/etc/nginx/sites-available/{0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
if os.path.isfile(config_path): |
|
||||
if not EEShellExec.cmd_exec(self, "grep \"error.log debug\" " |
|
||||
"{0}".format(config_path)): |
|
||||
Log.info(self, "Starting NGINX debug connection for " |
|
||||
"{0}".format(self.app.pargs.site_name)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"s/error.log;/" |
|
||||
"error.log " |
|
||||
"debug;/\" {0}".format(config_path)) |
|
||||
self.trigger_nginx = True |
|
||||
|
|
||||
else: |
|
||||
Log.info(self, "Nginx debug for site already enabled") |
|
||||
|
|
||||
self.msg = self.msg + ['{0}{1}/logs/error.log' |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
|
|
||||
else: |
|
||||
Log.info(self, "{0} domain not valid" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
|
|
||||
# stop site specific debug |
|
||||
elif (self.app.pargs.nginx == 'off' and self.app.pargs.site_name): |
|
||||
config_path = ("/etc/nginx/sites-available/{0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
if os.path.isfile(config_path): |
|
||||
if EEShellExec.cmd_exec(self, "grep \"error.log debug\" {0}" |
|
||||
.format(config_path)): |
|
||||
Log.info(self, "Stoping NGINX debug connection for {0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"s/error.log debug;/" |
|
||||
"error.log;/\" {0}" |
|
||||
.format(config_path)) |
|
||||
self.trigger_nginx = True |
|
||||
|
|
||||
else: |
|
||||
|
|
||||
Log.info(self, "Nginx debug for site already disabled") |
|
||||
else: |
|
||||
Log.info(self, "{0} domain not valid" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def debug_php(self): |
|
||||
"""Start/Stop PHP debug""" |
|
||||
# PHP global debug start |
|
||||
if (self.app.pargs.php == 'on' and not self.app.pargs.site_name): |
|
||||
if not (EEShellExec.cmd_exec(self, "sed -n \"/upstream php" |
|
||||
"{/,/}/p \" /etc/nginx/" |
|
||||
"conf.d/upstream.conf " |
|
||||
"| grep 9001")): |
|
||||
|
|
||||
Log.info(self, "Enabling PHP debug") |
|
||||
|
|
||||
# Change upstream.conf |
|
||||
nc = NginxConfig() |
|
||||
nc.loadf('/etc/nginx/conf.d/upstream.conf') |
|
||||
nc.set([('upstream','php',), 'server'], '127.0.0.1:9001') |
|
||||
if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): |
|
||||
nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:9001') |
|
||||
nc.savef('/etc/nginx/conf.d/upstream.conf') |
|
||||
|
|
||||
# Enable xdebug |
|
||||
EEFileUtils.searchreplace(self, "/etc/php5/mods-available/" |
|
||||
"xdebug.ini", |
|
||||
";zend_extension", |
|
||||
"zend_extension") |
|
||||
|
|
||||
# Fix slow log is not enabled default in PHP5.6 |
|
||||
config = configparser.ConfigParser() |
|
||||
config.read('/etc/php5/fpm/pool.d/debug.conf') |
|
||||
config['debug']['slowlog'] = '/var/log/php5/slow.log' |
|
||||
config['debug']['request_slowlog_timeout'] = '10s' |
|
||||
with open('/etc/php5/fpm/pool.d/debug.conf', |
|
||||
encoding='utf-8', mode='w') as confifile: |
|
||||
Log.debug(self, "Writting debug.conf configuration into " |
|
||||
"/etc/php5/fpm/pool.d/debug.conf") |
|
||||
config.write(confifile) |
|
||||
|
|
||||
self.trigger_php = True |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "PHP debug is already enabled") |
|
||||
|
|
||||
self.msg = self.msg + ['/var/log/php5/slow.log'] |
|
||||
|
|
||||
# PHP global debug stop |
|
||||
elif (self.app.pargs.php == 'off' and not self.app.pargs.site_name): |
|
||||
if EEShellExec.cmd_exec(self, " sed -n \"/upstream php {/,/}/p\" " |
|
||||
"/etc/nginx/conf.d/upstream.conf " |
|
||||
"| grep 9001"): |
|
||||
Log.info(self, "Disabling PHP debug") |
|
||||
|
|
||||
# Change upstream.conf |
|
||||
nc = NginxConfig() |
|
||||
nc.loadf('/etc/nginx/conf.d/upstream.conf') |
|
||||
nc.set([('upstream','php',), 'server'], '127.0.0.1:9000') |
|
||||
if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"): |
|
||||
nc.set([('upstream','hhvm',), 'server'], '127.0.0.1:8000') |
|
||||
nc.savef('/etc/nginx/conf.d/upstream.conf') |
|
||||
|
|
||||
# Disable xdebug |
|
||||
EEFileUtils.searchreplace(self, "/etc/php5/mods-available/" |
|
||||
"xdebug.ini", |
|
||||
"zend_extension", |
|
||||
";zend_extension") |
|
||||
|
|
||||
self.trigger_php = True |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "PHP debug is already disabled") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def debug_fpm(self): |
|
||||
"""Start/Stop PHP5-FPM debug""" |
|
||||
# PHP5-FPM start global debug |
|
||||
if (self.app.pargs.fpm == 'on' and not self.app.pargs.site_name): |
|
||||
if not EEShellExec.cmd_exec(self, "grep \"log_level = debug\" " |
|
||||
"/etc/php5/fpm/php-fpm.conf"): |
|
||||
Log.info(self, "Setting up PHP5-FPM log_level = debug") |
|
||||
config = configparser.ConfigParser() |
|
||||
config.read('/etc/php5/fpm/php-fpm.conf') |
|
||||
config.remove_option('global', 'include') |
|
||||
config['global']['log_level'] = 'debug' |
|
||||
config['global']['include'] = '/etc/php5/fpm/pool.d/*.conf' |
|
||||
with open('/etc/php5/fpm/php-fpm.conf', |
|
||||
encoding='utf-8', mode='w') as configfile: |
|
||||
Log.debug(self, "Writting php5-FPM configuration into " |
|
||||
"/etc/php5/fpm/php-fpm.conf") |
|
||||
config.write(configfile) |
|
||||
self.trigger_php = True |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM log_level = debug already setup") |
|
||||
|
|
||||
self.msg = self.msg + ['/var/log/php5/fpm.log'] |
|
||||
|
|
||||
# PHP5-FPM stop global debug |
|
||||
elif (self.app.pargs.fpm == 'off' and not self.app.pargs.site_name): |
|
||||
if EEShellExec.cmd_exec(self, "grep \"log_level = debug\" " |
|
||||
"/etc/php5/fpm/php-fpm.conf"): |
|
||||
Log.info(self, "Disabling PHP5-FPM log_level = debug") |
|
||||
config = configparser.ConfigParser() |
|
||||
config.read('/etc/php5/fpm/php-fpm.conf') |
|
||||
config.remove_option('global', 'include') |
|
||||
config['global']['log_level'] = 'notice' |
|
||||
config['global']['include'] = '/etc/php5/fpm/pool.d/*.conf' |
|
||||
with open('/etc/php5/fpm/php-fpm.conf', |
|
||||
encoding='utf-8', mode='w') as configfile: |
|
||||
Log.debug(self, "writting php5 configuration into " |
|
||||
"/etc/php5/fpm/php-fpm.conf") |
|
||||
config.write(configfile) |
|
||||
|
|
||||
self.trigger_php = True |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM log_level = debug already disabled") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def debug_mysql(self): |
|
||||
"""Start/Stop MySQL debug""" |
|
||||
# MySQL start global debug |
|
||||
if (self.app.pargs.mysql == 'on' and not self.app.pargs.site_name): |
|
||||
if not EEShellExec.cmd_exec(self, "mysql -e \"show variables like" |
|
||||
" \'slow_query_log\';\" | " |
|
||||
"grep ON"): |
|
||||
Log.info(self, "Setting up MySQL slow log") |
|
||||
EEMysql.execute(self, "set global slow_query_log = " |
|
||||
"\'ON\';") |
|
||||
EEMysql.execute(self, "set global slow_query_log_file = " |
|
||||
"\'/var/log/mysql/mysql-slow.log\';") |
|
||||
EEMysql.execute(self, "set global long_query_time = 2;") |
|
||||
EEMysql.execute(self, "set global log_queries_not_using" |
|
||||
"_indexes = \'ON\';") |
|
||||
else: |
|
||||
Log.info(self, "MySQL slow log is already enabled") |
|
||||
|
|
||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log'] |
|
||||
|
|
||||
# MySQL stop global debug |
|
||||
elif (self.app.pargs.mysql == 'off' and not self.app.pargs.site_name): |
|
||||
if EEShellExec.cmd_exec(self, "mysql -e \"show variables like \'" |
|
||||
"slow_query_log\';\" | grep ON"): |
|
||||
Log.info(self, "Disabling MySQL slow log") |
|
||||
EEMysql.execute(self, "set global slow_query_log = \'OFF\';") |
|
||||
EEMysql.execute(self, "set global slow_query_log_file = \'" |
|
||||
"/var/log/mysql/mysql-slow.log\';") |
|
||||
EEMysql.execute(self, "set global long_query_time = 10;") |
|
||||
EEMysql.execute(self, "set global log_queries_not_using_index" |
|
||||
"es = \'OFF\';") |
|
||||
EEShellExec.cmd_exec(self, "crontab -l | sed \'/#EasyEngine " |
|
||||
"start/,/#EasyEngine end/d\' | crontab -") |
|
||||
else: |
|
||||
Log.info(self, "MySQL slow log already disabled") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def debug_wp(self): |
|
||||
"""Start/Stop WordPress debug""" |
|
||||
if (self.app.pargs.wp == 'on' and self.app.pargs.site_name): |
|
||||
wp_config = ("{0}/{1}/wp-config.php" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)) |
|
||||
webroot = "{0}{1}".format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
# Check wp-config.php file into htdocs folder |
|
||||
if not os.path.isfile(wp_config): |
|
||||
wp_config = ("{0}/{1}/htdocs/wp-config.php" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)) |
|
||||
if os.path.isfile(wp_config): |
|
||||
if not EEShellExec.cmd_exec(self, "grep \"\'WP_DEBUG\'\" {0} |" |
|
||||
" grep true".format(wp_config)): |
|
||||
Log.info(self, "Starting WordPress debug") |
|
||||
open("{0}/htdocs/wp-content/debug.log".format(webroot), |
|
||||
encoding='utf-8', mode='a').close() |
|
||||
EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/wp-" |
|
||||
"content/debug.log" |
|
||||
"".format(webroot, |
|
||||
EEVariables.ee_php_user)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"s/define(\'WP_DEBUG\'" |
|
||||
".*/define(\'WP_DEBUG\', true);\\n" |
|
||||
"define(\'WP_DEBUG_DISPLAY\', false);" |
|
||||
"\\ndefine(\'WP_DEBUG_LOG\', true);" |
|
||||
"\\ndefine(\'SAVEQUERIES\', true);/\"" |
|
||||
" {0}".format(wp_config)) |
|
||||
EEShellExec.cmd_exec(self, "cd {0}/htdocs/ && wp" |
|
||||
" plugin --allow-root install " |
|
||||
"developer query-monitor" |
|
||||
.format(webroot)) |
|
||||
EEShellExec.cmd_exec(self, "chown -R {1}: {0}/htdocs/" |
|
||||
"wp-content/plugins" |
|
||||
.format(webroot, |
|
||||
EEVariables.ee_php_user)) |
|
||||
|
|
||||
self.msg = self.msg + ['{0}{1}/htdocs/wp-content' |
|
||||
'/debug.log' |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
|
|
||||
else: |
|
||||
Log.info(self, "Unable to find wp-config.php for site: {0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
|
|
||||
elif (self.app.pargs.wp == 'off' and self.app.pargs.site_name): |
|
||||
wp_config = ("{0}{1}/wp-config.php" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)) |
|
||||
webroot = "{0}{1}".format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
# Check wp-config.php file into htdocs folder |
|
||||
if not os.path.isfile(wp_config): |
|
||||
wp_config = ("{0}/{1}/htdocs/wp-config.php" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)) |
|
||||
if os.path.isfile(wp_config): |
|
||||
if EEShellExec.cmd_exec(self, "grep \"\'WP_DEBUG\'\" {0} | " |
|
||||
"grep true".format(wp_config)): |
|
||||
Log.info(self, "Disabling WordPress debug") |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"s/define(\'WP_DEBUG\'" |
|
||||
", true);/define(\'WP_DEBUG\', " |
|
||||
"false);/\" {0}".format(wp_config)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/define(\'" |
|
||||
"WP_DEBUG_DISPLAY\', false);/d\" {0}" |
|
||||
.format(wp_config)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/define(\'" |
|
||||
"WP_DEBUG_LOG\', true);/d\" {0}" |
|
||||
.format(wp_config)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/define(\'" |
|
||||
"SAVEQUERIES\', " |
|
||||
"true);/d\" {0}".format(wp_config)) |
|
||||
else: |
|
||||
Log.info(self, "WordPress debug all already disabled") |
|
||||
else: |
|
||||
Log.error(self, "Missing argument site name") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def debug_rewrite(self): |
|
||||
"""Start/Stop Nginx rewrite rules debug""" |
|
||||
# Start Nginx rewrite debug globally |
|
||||
if (self.app.pargs.rewrite == 'on' and not self.app.pargs.site_name): |
|
||||
if not EEShellExec.cmd_exec(self, "grep \"rewrite_log on;\" " |
|
||||
"/etc/nginx/nginx.conf"): |
|
||||
Log.info(self, "Setting up Nginx rewrite logs") |
|
||||
EEShellExec.cmd_exec(self, "sed -i \'/http {/a \\\\t" |
|
||||
"rewrite_log on;\' /etc/nginx/nginx.conf") |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "Nginx rewrite logs already enabled") |
|
||||
|
|
||||
if '/var/log/nginx/*.error.log' not in self.msg: |
|
||||
self.msg = self.msg + ['/var/log/nginx/*.error.log'] |
|
||||
|
|
||||
# Stop Nginx rewrite debug globally |
|
||||
elif (self.app.pargs.rewrite == 'off' |
|
||||
and not self.app.pargs.site_name): |
|
||||
if EEShellExec.cmd_exec(self, "grep \"rewrite_log on;\" " |
|
||||
"/etc/nginx/nginx.conf"): |
|
||||
Log.info(self, "Disabling Nginx rewrite logs") |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/rewrite_log.*/d\"" |
|
||||
" /etc/nginx/nginx.conf") |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "Nginx rewrite logs already disabled") |
|
||||
# Start Nginx rewrite for site |
|
||||
elif (self.app.pargs.rewrite == 'on' and self.app.pargs.site_name): |
|
||||
config_path = ("/etc/nginx/sites-available/{0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
if not EEShellExec.cmd_exec(self, "grep \"rewrite_log on;\" {0}" |
|
||||
.format(config_path)): |
|
||||
Log.info(self, "Setting up Nginx rewrite logs for {0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/access_log/i \\\\\\t" |
|
||||
"rewrite_log on;\" {0}" |
|
||||
.format(config_path)) |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "Nginx rewrite logs for {0} already setup" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
|
|
||||
if ('{0}{1}/logs/error.log'.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
not in self.msg): |
|
||||
self.msg = self.msg + ['{0}{1}/logs/error.log' |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
|
|
||||
# Stop Nginx rewrite for site |
|
||||
elif (self.app.pargs.rewrite == 'off' and self.app.pargs.site_name): |
|
||||
config_path = ("/etc/nginx/sites-available/{0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
if EEShellExec.cmd_exec(self, "grep \"rewrite_log on;\" {0}" |
|
||||
.format(config_path)): |
|
||||
Log.info(self, "Disabling Nginx rewrite logs for {0}" |
|
||||
.format(self.app.pargs.site_name)) |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"/rewrite_log.*/d\" {0}" |
|
||||
.format(config_path)) |
|
||||
self.trigger_nginx = True |
|
||||
else: |
|
||||
Log.info(self, "Nginx rewrite logs for {0} already " |
|
||||
" disabled".format(self.app.pargs.site_name)) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def signal_handler(self, signal, frame): |
|
||||
"""Handle Ctrl+c hevent for -i option of debug""" |
|
||||
self.start = False |
|
||||
if self.app.pargs.nginx: |
|
||||
self.app.pargs.nginx = 'off' |
|
||||
self.debug_nginx() |
|
||||
if self.app.pargs.php: |
|
||||
self.app.pargs.php = 'off' |
|
||||
self.debug_php() |
|
||||
if self.app.pargs.fpm: |
|
||||
self.app.pargs.fpm = 'off' |
|
||||
self.debug_fpm() |
|
||||
if self.app.pargs.mysql: |
|
||||
# MySQL debug will not work for remote MySQL |
|
||||
if EEVariables.ee_mysql_host is "localhost": |
|
||||
self.app.pargs.mysql = 'off' |
|
||||
self.debug_mysql() |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, EasyEngine will not " |
|
||||
"enable remote debug") |
|
||||
if self.app.pargs.wp: |
|
||||
self.app.pargs.wp = 'off' |
|
||||
self.debug_wp() |
|
||||
if self.app.pargs.rewrite: |
|
||||
self.app.pargs.rewrite = 'off' |
|
||||
self.debug_rewrite() |
|
||||
|
|
||||
# Reload Nginx |
|
||||
if self.trigger_nginx: |
|
||||
EEService.reload_service(self, 'nginx') |
|
||||
|
|
||||
# Reload PHP |
|
||||
if self.trigger_php: |
|
||||
EEService.reload_service(self, 'php5-fpm') |
|
||||
self.app.close(0) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
"""Default function of debug""" |
|
||||
# self.start = True |
|
||||
self.interactive = False |
|
||||
self.msg = [] |
|
||||
self.trigger_nginx = False |
|
||||
self.trigger_php = False |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.php) |
|
||||
and (not self.app.pargs.fpm) and (not self.app.pargs.mysql) |
|
||||
and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) |
|
||||
and (not self.app.pargs.all) |
|
||||
and (not self.app.pargs.site_name) |
|
||||
and (not self.app.pargs.import_slow_log) |
|
||||
and (not self.app.pargs.interval)): |
|
||||
if self.app.pargs.stop or self.app.pargs.start: |
|
||||
print("--start/stop option is deprecated since ee3.0.5") |
|
||||
self.app.args.print_help() |
|
||||
else: |
|
||||
self.app.args.print_help() |
|
||||
|
|
||||
if self.app.pargs.import_slow_log: |
|
||||
self.import_slow_log() |
|
||||
|
|
||||
if self.app.pargs.interval: |
|
||||
try: |
|
||||
cron_time = int(self.app.pargs.interval) |
|
||||
except Exception as e: |
|
||||
cron_time = 5 |
|
||||
|
|
||||
try: |
|
||||
if not EEShellExec.cmd_exec(self, "crontab -l | grep " |
|
||||
"'ee debug --import-slow-log'"): |
|
||||
if not cron_time == 0: |
|
||||
Log.info(self, "setting up crontab entry," |
|
||||
" please wait...") |
|
||||
EEShellExec.cmd_exec(self, "/bin/bash -c \"crontab -l " |
|
||||
"2> /dev/null | {{ cat; echo -e" |
|
||||
" \\\"#EasyEngine start MySQL " |
|
||||
"slow log \\n*/{0} * * * * " |
|
||||
"/usr/local/bin/ee debug" |
|
||||
" --import-slow-log\\n" |
|
||||
"#EasyEngine end MySQL slow log" |
|
||||
"\\\"; }} | crontab -\"" |
|
||||
.format(cron_time)) |
|
||||
else: |
|
||||
if not cron_time == 0: |
|
||||
Log.info(self, "updating crontab entry," |
|
||||
" please wait...") |
|
||||
if not EEShellExec.cmd_exec(self, "/bin/bash -c " |
|
||||
"\"crontab " |
|
||||
"-l | sed '/EasyEngine " |
|
||||
"start MySQL slow " |
|
||||
"log/!b;n;c\*\/{0} " |
|
||||
"\* \* \* " |
|
||||
"\* \/usr" |
|
||||
"\/local\/bin\/ee debug " |
|
||||
"--import\-slow\-log' " |
|
||||
"| crontab -\"" |
|
||||
.format(cron_time)): |
|
||||
Log.error(self, "failed to update crontab entry") |
|
||||
else: |
|
||||
Log.info(self, "removing crontab entry," |
|
||||
" please wait...") |
|
||||
if not EEShellExec.cmd_exec(self, "/bin/bash -c " |
|
||||
"\"crontab " |
|
||||
"-l | sed '/EasyEngine " |
|
||||
"start MySQL slow " |
|
||||
"log/,+2d'" |
|
||||
"| crontab -\"" |
|
||||
.format(cron_time)): |
|
||||
Log.error(self, "failed to remove crontab entry") |
|
||||
except CommandExecutionError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
|
|
||||
if self.app.pargs.all == 'on': |
|
||||
if self.app.pargs.site_name: |
|
||||
self.app.pargs.wp = 'on' |
|
||||
self.app.pargs.nginx = 'on' |
|
||||
self.app.pargs.php = 'on' |
|
||||
self.app.pargs.fpm = 'on' |
|
||||
self.app.pargs.mysql = 'on' |
|
||||
self.app.pargs.rewrite = 'on' |
|
||||
|
|
||||
if self.app.pargs.all == 'off': |
|
||||
if self.app.pargs.site_name: |
|
||||
self.app.pargs.wp = 'off' |
|
||||
self.app.pargs.nginx = 'off' |
|
||||
self.app.pargs.php = 'off' |
|
||||
self.app.pargs.fpm = 'off' |
|
||||
self.app.pargs.mysql = 'off' |
|
||||
self.app.pargs.rewrite = 'off' |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.php) |
|
||||
and (not self.app.pargs.fpm) and (not self.app.pargs.mysql) |
|
||||
and (not self.app.pargs.wp) and (not self.app.pargs.rewrite) |
|
||||
and self.app.pargs.site_name): |
|
||||
self.app.args.print_help() |
|
||||
# self.app.pargs.nginx = 'on' |
|
||||
# self.app.pargs.wp = 'on' |
|
||||
# self.app.pargs.rewrite = 'on' |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
self.debug_nginx() |
|
||||
if self.app.pargs.php: |
|
||||
self.debug_php() |
|
||||
if self.app.pargs.fpm: |
|
||||
self.debug_fpm() |
|
||||
if self.app.pargs.mysql: |
|
||||
# MySQL debug will not work for remote MySQL |
|
||||
if EEVariables.ee_mysql_host is "localhost": |
|
||||
self.debug_mysql() |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, EasyEngine will not " |
|
||||
"enable remote debug") |
|
||||
if self.app.pargs.wp: |
|
||||
self.debug_wp() |
|
||||
if self.app.pargs.rewrite: |
|
||||
self.debug_rewrite() |
|
||||
|
|
||||
if self.app.pargs.interactive: |
|
||||
self.interactive = True |
|
||||
|
|
||||
# Reload Nginx |
|
||||
if self.trigger_nginx: |
|
||||
EEService.reload_service(self, 'nginx') |
|
||||
# Reload PHP |
|
||||
if self.trigger_php: |
|
||||
EEService.restart_service(self, 'php5-fpm') |
|
||||
|
|
||||
if len(self.msg) > 0: |
|
||||
if not self.app.pargs.interactive: |
|
||||
disp_msg = ' '.join(self.msg) |
|
||||
Log.info(self, "Use following command to check debug logs:\n" |
|
||||
+ Log.ENDC + "tail -f {0}".format(disp_msg)) |
|
||||
else: |
|
||||
signal.signal(signal.SIGINT, self.signal_handler) |
|
||||
watch_list = [] |
|
||||
for w_list in self.msg: |
|
||||
watch_list = watch_list + glob.glob(w_list) |
|
||||
|
|
||||
logwatch(self, watch_list) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def import_slow_log(self): |
|
||||
"""Default function for import slow log""" |
|
||||
if os.path.isdir("{0}22222/htdocs/db/anemometer" |
|
||||
.format(EEVariables.ee_webroot)): |
|
||||
if os.path.isfile("/var/log/mysql/mysql-slow.log"): |
|
||||
# Get Anemometer user name and password |
|
||||
Log.info(self, "Importing MySQL slow log to Anemometer") |
|
||||
host = os.popen("grep -e \"\'host\'\" {0}22222/htdocs/" |
|
||||
.format(EEVariables.ee_webroot) |
|
||||
+ "db/anemometer/conf/config.inc.php " |
|
||||
"| head -1 | cut -d\\\' -f4 | " |
|
||||
"tr -d '\n'").read() |
|
||||
user = os.popen("grep -e \"\'user\'\" {0}22222/htdocs/" |
|
||||
.format(EEVariables.ee_webroot) |
|
||||
+ "db/anemometer/conf/config.inc.php " |
|
||||
"| head -1 | cut -d\\\' -f4 | " |
|
||||
"tr -d '\n'").read() |
|
||||
password = os.popen("grep -e \"\'password\'\" {0}22222/" |
|
||||
.format(EEVariables.ee_webroot) |
|
||||
+ "htdocs/db/anemometer/conf" |
|
||||
"/config.inc.php " |
|
||||
"| head -1 | cut -d\\\' -f4 | " |
|
||||
"tr -d '\n'").read() |
|
||||
|
|
||||
# Import slow log Anemometer using pt-query-digest |
|
||||
try: |
|
||||
EEShellExec.cmd_exec(self, "pt-query-digest --user={0} " |
|
||||
"--password={1} " |
|
||||
"--review D=slow_query_log," |
|
||||
"t=global_query_review " |
|
||||
"--history D=slow_query_log,t=" |
|
||||
"global_query_review_history " |
|
||||
"--no-report --limit=0% " |
|
||||
"--filter=\" \\$event->{{Bytes}} = " |
|
||||
"length(\\$event->{{arg}}) " |
|
||||
"and \\$event->{{hostname}}=\\\"" |
|
||||
"{2}\\\"\" " |
|
||||
"/var/log/mysql/mysql-slow.log" |
|
||||
.format(user, password, host)) |
|
||||
except CommandExecutionError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
Log.error(self, "MySQL slow log import failed.") |
|
||||
else: |
|
||||
Log.error(self, "MySQL slow log file not found," |
|
||||
" so not imported slow logs") |
|
||||
else: |
|
||||
Log.error(self, "Anemometer is not installed." + |
|
||||
Log.ENDC + "\nYou can install Anemometer with " |
|
||||
"this command " |
|
||||
+ Log.BOLD + "\n `ee stack install --utils`" |
|
||||
+ Log.ENDC) |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EEDebugController) |
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_debug_hook) |
|
@ -1,34 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.variables import EEVariables |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
def ee_import_slow_log_hook(app): |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEImportslowlogController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'import_slow_log' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
description = 'Import MySQL slow log to Anemometer database' |
|
||||
usage = "ee import-slow-log" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
Log.info(self, "This command is deprecated." |
|
||||
" You can use this command instead, " + |
|
||||
Log.ENDC + Log.BOLD + "\n`ee debug --import-slow-log`" + |
|
||||
Log.ENDC) |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EEImportslowlogController) |
|
||||
|
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_import_slow_log_hook) |
|
@ -1,198 +0,0 @@ |
|||||
"""EEInfo Plugin for EasyEngine.""" |
|
||||
|
|
||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from pynginxconfig import NginxConfig |
|
||||
from ee.core.aptget import EEAptGet |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.logging import Log |
|
||||
import os |
|
||||
import configparser |
|
||||
|
|
||||
|
|
||||
def ee_info_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEInfoController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'info' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
description = ('Display configuration information related to Nginx,' |
|
||||
' PHP and MySQL') |
|
||||
arguments = [ |
|
||||
(['--mysql'], |
|
||||
dict(help='Get MySQL configuration information', |
|
||||
action='store_true')), |
|
||||
(['--php'], |
|
||||
dict(help='Get PHP configuration information', |
|
||||
action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='Get Nginx configuration information', |
|
||||
action='store_true')), |
|
||||
] |
|
||||
usage = "ee info [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def info_nginx(self): |
|
||||
"""Display Nginx information""" |
|
||||
version = os.popen("nginx -v 2>&1 | cut -d':' -f2 | cut -d' ' -f2 | " |
|
||||
"cut -d'/' -f2 | tr -d '\n'").read() |
|
||||
allow = os.popen("grep ^allow /etc/nginx/common/acl.conf | " |
|
||||
"cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' '").read() |
|
||||
nc = NginxConfig() |
|
||||
nc.loadf('/etc/nginx/nginx.conf') |
|
||||
user = nc.get('user')[1] |
|
||||
worker_processes = nc.get('worker_processes')[1] |
|
||||
worker_connections = nc.get([('events',), 'worker_connections'])[1] |
|
||||
keepalive_timeout = nc.get([('http',), 'keepalive_timeout'])[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, |
|
||||
worker_connections=worker_connections, |
|
||||
fastcgi_read_timeout=fastcgi_read_timeout, |
|
||||
client_max_body_size=client_max_body_size) |
|
||||
self.app.render((data), 'info_nginx.mustache') |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def info_php(self): |
|
||||
"""Display PHP information""" |
|
||||
version = os.popen("php -v | head -n1 | cut -d' ' -f2 |" |
|
||||
" cut -d'+' -f1 | tr -d '\n'").read |
|
||||
config = configparser.ConfigParser() |
|
||||
config.read('/etc/php5/fpm/php.ini') |
|
||||
expose_php = config['PHP']['expose_php'] |
|
||||
memory_limit = config['PHP']['memory_limit'] |
|
||||
post_max_size = config['PHP']['post_max_size'] |
|
||||
upload_max_filesize = config['PHP']['upload_max_filesize'] |
|
||||
max_execution_time = config['PHP']['max_execution_time'] |
|
||||
|
|
||||
config.read('/etc/php5/fpm/pool.d/www.conf') |
|
||||
www_listen = config['www']['listen'] |
|
||||
www_ping_path = config['www']['ping.path'] |
|
||||
www_pm_status_path = config['www']['pm.status_path'] |
|
||||
www_pm = config['www']['pm'] |
|
||||
www_pm_max_requests = config['www']['pm.max_requests'] |
|
||||
www_pm_max_children = config['www']['pm.max_children'] |
|
||||
www_pm_start_servers = config['www']['pm.start_servers'] |
|
||||
www_pm_min_spare_servers = config['www']['pm.min_spare_servers'] |
|
||||
www_pm_max_spare_servers = config['www']['pm.max_spare_servers'] |
|
||||
www_request_terminate_time = (config['www'] |
|
||||
['request_terminate_timeout']) |
|
||||
try: |
|
||||
www_xdebug = (config['www']['php_admin_flag[xdebug.profiler_enable' |
|
||||
'_trigger]']) |
|
||||
except Exception as e: |
|
||||
www_xdebug = 'off' |
|
||||
|
|
||||
config.read('/etc/php5/fpm/pool.d/debug.conf') |
|
||||
debug_listen = config['debug']['listen'] |
|
||||
debug_ping_path = config['debug']['ping.path'] |
|
||||
debug_pm_status_path = config['debug']['pm.status_path'] |
|
||||
debug_pm = config['debug']['pm'] |
|
||||
debug_pm_max_requests = config['debug']['pm.max_requests'] |
|
||||
debug_pm_max_children = config['debug']['pm.max_children'] |
|
||||
debug_pm_start_servers = config['debug']['pm.start_servers'] |
|
||||
debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] |
|
||||
debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] |
|
||||
debug_request_terminate = (config['debug'] |
|
||||
['request_terminate_timeout']) |
|
||||
try: |
|
||||
debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' |
|
||||
'enable_trigger]']) |
|
||||
except Exception as e: |
|
||||
debug_xdebug = 'off' |
|
||||
|
|
||||
data = dict(version=version, expose_php=expose_php, |
|
||||
memory_limit=memory_limit, post_max_size=post_max_size, |
|
||||
upload_max_filesize=upload_max_filesize, |
|
||||
max_execution_time=max_execution_time, |
|
||||
www_listen=www_listen, www_ping_path=www_ping_path, |
|
||||
www_pm_status_path=www_pm_status_path, www_pm=www_pm, |
|
||||
www_pm_max_requests=www_pm_max_requests, |
|
||||
www_pm_max_children=www_pm_max_children, |
|
||||
www_pm_start_servers=www_pm_start_servers, |
|
||||
www_pm_min_spare_servers=www_pm_min_spare_servers, |
|
||||
www_pm_max_spare_servers=www_pm_max_spare_servers, |
|
||||
www_request_terminate_timeout=www_request_terminate_time, |
|
||||
www_xdebug_profiler_enable_trigger=www_xdebug, |
|
||||
debug_listen=debug_listen, debug_ping_path=debug_ping_path, |
|
||||
debug_pm_status_path=debug_pm_status_path, |
|
||||
debug_pm=debug_pm, |
|
||||
debug_pm_max_requests=debug_pm_max_requests, |
|
||||
debug_pm_max_children=debug_pm_max_children, |
|
||||
debug_pm_start_servers=debug_pm_start_servers, |
|
||||
debug_pm_min_spare_servers=debug_pm_min_spare_servers, |
|
||||
debug_pm_max_spare_servers=debug_pm_max_spare_servers, |
|
||||
debug_request_terminate_timeout=debug_request_terminate, |
|
||||
debug_xdebug_profiler_enable_trigger=debug_xdebug) |
|
||||
self.app.render((data), 'info_php.mustache') |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def info_mysql(self): |
|
||||
"""Display MySQL information""" |
|
||||
version = os.popen("mysql -V | awk '{print($5)}' | cut -d ',' " |
|
||||
"-f1 | tr -d '\n'").read() |
|
||||
host = "localhost" |
|
||||
port = os.popen("mysql -e \"show variables\" | grep ^port | awk " |
|
||||
"'{print($2)}' | tr -d '\n'").read() |
|
||||
wait_timeout = os.popen("mysql -e \"show variables\" | grep " |
|
||||
"^wait_timeout | awk '{print($2)}' | " |
|
||||
"tr -d '\n'").read() |
|
||||
interactive_timeout = os.popen("mysql -e \"show variables\" | grep " |
|
||||
"^interactive_timeout | awk " |
|
||||
"'{print($2)}' | tr -d '\n'").read() |
|
||||
max_used_connections = os.popen("mysql -e \"show global status\" | " |
|
||||
"grep Max_used_connections | awk " |
|
||||
"'{print($2)}' | tr -d '\n'").read() |
|
||||
datadir = os.popen("mysql -e \"show variables\" | grep datadir | awk" |
|
||||
" '{print($2)}' | tr -d '\n'").read() |
|
||||
socket = os.popen("mysql -e \"show variables\" | grep \"^socket\" | " |
|
||||
"awk '{print($2)}' | tr -d '\n'").read() |
|
||||
data = dict(version=version, host=host, port=port, |
|
||||
wait_timeout=wait_timeout, |
|
||||
interactive_timeout=interactive_timeout, |
|
||||
max_used_connections=max_used_connections, |
|
||||
datadir=datadir, socket=socket) |
|
||||
self.app.render((data), 'info_mysql.mustache') |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
"""default function for info""" |
|
||||
if (not self.app.pargs.nginx and not self.app.pargs.php |
|
||||
and not self.app.pargs.mysql): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-common'): |
|
||||
self.info_nginx() |
|
||||
else: |
|
||||
Log.error(self, "Nginx is not installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
self.info_php() |
|
||||
else: |
|
||||
Log.error(self, "PHP5 is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if EEShellExec.cmd_exec(self, "mysqladmin ping"): |
|
||||
self.info_mysql() |
|
||||
else: |
|
||||
Log.error(self, "MySQL is not installed") |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EEInfoController) |
|
||||
|
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_info_hook) |
|
@ -1,578 +0,0 @@ |
|||||
"""Debug Plugin for EasyEngine""" |
|
||||
|
|
||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.logging import Log |
|
||||
from ee.cli.plugins.site_functions import logwatch |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.fileutils import EEFileUtils |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.sendmail import EESendMail |
|
||||
from ee.core.mysql import EEMysql |
|
||||
import os |
|
||||
import glob |
|
||||
import gzip |
|
||||
|
|
||||
|
|
||||
def ee_log_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EELogController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'log' |
|
||||
description = 'Perform operations on Nginx, PHP, MySQL log file' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
usage = "ee log [<site_name>] [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
self.app.args.print_help() |
|
||||
|
|
||||
|
|
||||
class EELogShowController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'show' |
|
||||
description = 'Show Nginx, PHP, MySQL log file' |
|
||||
stacked_on = 'log' |
|
||||
stacked_type = 'nested' |
|
||||
arguments = [ |
|
||||
(['--all'], |
|
||||
dict(help='Show All logs file', action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='Show Nginx Error logs file', action='store_true')), |
|
||||
(['--php'], |
|
||||
dict(help='Show PHP Error logs file', action='store_true')), |
|
||||
(['--fpm'], |
|
||||
dict(help='Show PHP5-fpm slow logs file', |
|
||||
action='store_true')), |
|
||||
(['--mysql'], |
|
||||
dict(help='Show MySQL logs file', action='store_true')), |
|
||||
(['--wp'], |
|
||||
dict(help='Show Site specific WordPress logs file', |
|
||||
action='store_true')), |
|
||||
(['--access'], |
|
||||
dict(help='Show Nginx access log file', |
|
||||
action='store_true')), |
|
||||
(['site_name'], |
|
||||
dict(help='Website Name', nargs='?', default=None)) |
|
||||
] |
|
||||
usage = "ee log show [<site_name>] [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
"""Default function of log show""" |
|
||||
self.msg = [] |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
self.app.pargs.nginx = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.fpm = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.access = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.wp = True |
|
||||
self.app.pargs.access = True |
|
||||
self.app.pargs.mysql = True |
|
||||
|
|
||||
if self.app.pargs.nginx and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*error.log"] |
|
||||
|
|
||||
if self.app.pargs.access and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*access.log"] |
|
||||
|
|
||||
if self.app.pargs.fpm: |
|
||||
open('/var/log/php5/slow.log', 'a').close() |
|
||||
open('/var/log/php5/fpm.log', 'a').close() |
|
||||
self.msg = self.msg + ['/var/log/php5/slow.log', |
|
||||
'/var/log/php5/fpm.log'] |
|
||||
if self.app.pargs.mysql: |
|
||||
# MySQL debug will not work for remote MySQL |
|
||||
if EEVariables.ee_mysql_host is "localhost": |
|
||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'): |
|
||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL slow-log not found, skipped") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, EasyEngine is not able to" |
|
||||
"show MySQL log file") |
|
||||
|
|
||||
if self.app.pargs.site_name: |
|
||||
webroot = "{0}{1}".format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
|
|
||||
if not os.path.isdir(webroot): |
|
||||
Log.error(self, "Site not present, quitting") |
|
||||
if self.app.pargs.access: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/access.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.nginx: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/error.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.wp: |
|
||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)): |
|
||||
if not os.path.isfile('{0}/logs/debug.log' |
|
||||
.format(webroot)): |
|
||||
if not os.path.isfile('{0}/htdocs/wp-content/debug.log' |
|
||||
.format(webroot)): |
|
||||
open("{0}/htdocs/wp-content/debug.log" |
|
||||
.format(webroot), |
|
||||
encoding='utf-8', mode='a').close() |
|
||||
EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/" |
|
||||
"wp-content/debug.log" |
|
||||
"".format(webroot, |
|
||||
EEVariables |
|
||||
.ee_php_user) |
|
||||
) |
|
||||
# create symbolic link for debug log |
|
||||
EEFileUtils.create_symlink(self, ["{0}/htdocs/wp-content/" |
|
||||
"debug.log" |
|
||||
.format(webroot), |
|
||||
'{0}/logs/debug.log' |
|
||||
.format(webroot)]) |
|
||||
|
|
||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
else: |
|
||||
Log.info(self, "Site is not WordPress site, skipping " |
|
||||
"WordPress logs") |
|
||||
|
|
||||
watch_list = [] |
|
||||
for w_list in self.msg: |
|
||||
watch_list = watch_list + glob.glob(w_list) |
|
||||
|
|
||||
logwatch(self, watch_list) |
|
||||
|
|
||||
|
|
||||
class EELogResetController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'reset' |
|
||||
description = 'Reset Nginx, PHP, MySQL log file' |
|
||||
stacked_on = 'log' |
|
||||
stacked_type = 'nested' |
|
||||
arguments = [ |
|
||||
(['--all'], |
|
||||
dict(help='Reset All logs file', action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='Reset Nginx Error logs file', action='store_true')), |
|
||||
(['--php'], |
|
||||
dict(help='Reset PHP Error logs file', action='store_true')), |
|
||||
(['--fpm'], |
|
||||
dict(help='Reset PHP5-fpm slow logs file', |
|
||||
action='store_true')), |
|
||||
(['--mysql'], |
|
||||
dict(help='Reset MySQL logs file', action='store_true')), |
|
||||
(['--wp'], |
|
||||
dict(help='Reset Site specific WordPress logs file', |
|
||||
action='store_true')), |
|
||||
(['--access'], |
|
||||
dict(help='Reset Nginx access log file', |
|
||||
action='store_true')), |
|
||||
(['--slow-log-db'], |
|
||||
dict(help='Drop all rows from slowlog table in database', |
|
||||
action='store_true')), |
|
||||
(['site_name'], |
|
||||
dict(help='Website Name', nargs='?', default=None)) |
|
||||
] |
|
||||
usage = "ee log reset [<site_name>] [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
"""Default function of log reset""" |
|
||||
self.msg = [] |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
self.app.pargs.nginx = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name) |
|
||||
and (not self.app.pargs.slow_log_db)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.fpm = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.access = True |
|
||||
self.app.pargs.slow_log_db = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name) |
|
||||
and (not self.app.pargs.slow-log-db)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.wp = True |
|
||||
self.app.pargs.access = True |
|
||||
self.app.pargs.mysql = True |
|
||||
|
|
||||
if self.app.pargs.slow_log_db: |
|
||||
if os.path.isdir("/var/www/22222/htdocs/db/anemometer"): |
|
||||
Log.info(self, "Resetting MySQL slow_query_log database table") |
|
||||
EEMysql.execute(self, "TRUNCATE TABLE " |
|
||||
"slow_query_log.global_query_review_history") |
|
||||
EEMysql.execute(self, "TRUNCATE TABLE " |
|
||||
"slow_query_log.global_query_review") |
|
||||
|
|
||||
if self.app.pargs.nginx and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*error.log"] |
|
||||
|
|
||||
if self.app.pargs.access and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*access.log"] |
|
||||
|
|
||||
if self.app.pargs.fpm: |
|
||||
open('/var/log/php5/slow.log', 'a').close() |
|
||||
open('/var/log/php5/fpm.log', 'a').close() |
|
||||
self.msg = self.msg + ['/var/log/php5/slow.log', |
|
||||
'/var/log/php5/fpm.log'] |
|
||||
if self.app.pargs.mysql: |
|
||||
# MySQL debug will not work for remote MySQL |
|
||||
if EEVariables.ee_mysql_host is "localhost": |
|
||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'): |
|
||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL slow-log not found, skipped") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, EasyEngine is not able to" |
|
||||
"show MySQL log file") |
|
||||
|
|
||||
if self.app.pargs.site_name: |
|
||||
webroot = "{0}{1}".format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
|
|
||||
if not os.path.isdir(webroot): |
|
||||
Log.error(self, "Site not present, quitting") |
|
||||
if self.app.pargs.access: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/access.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.nginx: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/error.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.wp: |
|
||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)): |
|
||||
if not os.path.isfile('{0}/logs/debug.log' |
|
||||
.format(webroot)): |
|
||||
if not os.path.isfile('{0}/htdocs/wp-content/debug.log' |
|
||||
.format(webroot)): |
|
||||
open("{0}/htdocs/wp-content/debug.log" |
|
||||
.format(webroot), |
|
||||
encoding='utf-8', mode='a').close() |
|
||||
EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/" |
|
||||
"wp-content/debug.log" |
|
||||
"".format(webroot, |
|
||||
EEVariables |
|
||||
.ee_php_user) |
|
||||
) |
|
||||
# create symbolic link for debug log |
|
||||
EEFileUtils.create_symlink(self, ["{0}/htdocs/wp-content/" |
|
||||
"debug.log" |
|
||||
.format(webroot), |
|
||||
'{0}/logs/debug.log' |
|
||||
.format(webroot)]) |
|
||||
|
|
||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
else: |
|
||||
Log.info(self, "Site is not WordPress site, skipping " |
|
||||
"WordPress logs") |
|
||||
|
|
||||
reset_list = [] |
|
||||
for r_list in self.msg: |
|
||||
reset_list = reset_list + glob.glob(r_list) |
|
||||
|
|
||||
# Clearing content of file |
|
||||
for r_list in reset_list: |
|
||||
Log.info(self, "Resetting file {file}".format(file=r_list)) |
|
||||
open(r_list, 'w').close() |
|
||||
|
|
||||
|
|
||||
class EELogGzipController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'gzip' |
|
||||
description = 'GZip Nginx, PHP, MySQL log file' |
|
||||
stacked_on = 'log' |
|
||||
stacked_type = 'nested' |
|
||||
arguments = [ |
|
||||
(['--all'], |
|
||||
dict(help='GZip All logs file', action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='GZip Nginx Error logs file', action='store_true')), |
|
||||
(['--php'], |
|
||||
dict(help='GZip PHP Error logs file', action='store_true')), |
|
||||
(['--fpm'], |
|
||||
dict(help='GZip PHP5-fpm slow logs file', |
|
||||
action='store_true')), |
|
||||
(['--mysql'], |
|
||||
dict(help='GZip MySQL logs file', action='store_true')), |
|
||||
(['--wp'], |
|
||||
dict(help='GZip Site specific WordPress logs file', |
|
||||
action='store_true')), |
|
||||
(['--access'], |
|
||||
dict(help='GZip Nginx access log file', |
|
||||
action='store_true')), |
|
||||
(['site_name'], |
|
||||
dict(help='Website Name', nargs='?', default=None)) |
|
||||
] |
|
||||
usage = "ee log gzip [<site_name>] [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
"""Default function of log GZip""" |
|
||||
self.msg = [] |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
self.app.pargs.nginx = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.fpm = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.access = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.wp = True |
|
||||
self.app.pargs.access = True |
|
||||
self.app.pargs.mysql = True |
|
||||
|
|
||||
if self.app.pargs.nginx and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*error.log"] |
|
||||
|
|
||||
if self.app.pargs.access and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*access.log"] |
|
||||
|
|
||||
if self.app.pargs.fpm: |
|
||||
open('/var/log/php5/slow.log', 'a').close() |
|
||||
open('/var/log/php5/fpm.log', 'a').close() |
|
||||
self.msg = self.msg + ['/var/log/php5/slow.log', |
|
||||
'/var/log/php5/fpm.log'] |
|
||||
if self.app.pargs.mysql: |
|
||||
# MySQL debug will not work for remote MySQL |
|
||||
if EEVariables.ee_mysql_host is "localhost": |
|
||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'): |
|
||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL slow-log not found, skipped") |
|
||||
|
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, EasyEngine is not able to" |
|
||||
"show MySQL log file") |
|
||||
|
|
||||
if self.app.pargs.site_name: |
|
||||
webroot = "{0}{1}".format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
|
|
||||
if not os.path.isdir(webroot): |
|
||||
Log.error(self, "Site not present, quitting") |
|
||||
if self.app.pargs.access: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/access.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.nginx: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/error.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.wp: |
|
||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)): |
|
||||
if not os.path.isfile('{0}/logs/debug.log' |
|
||||
.format(webroot)): |
|
||||
if not os.path.isfile('{0}/htdocs/wp-content/debug.log' |
|
||||
.format(webroot)): |
|
||||
open("{0}/htdocs/wp-content/debug.log" |
|
||||
.format(webroot), |
|
||||
encoding='utf-8', mode='a').close() |
|
||||
EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/" |
|
||||
"wp-content/debug.log" |
|
||||
"".format(webroot, |
|
||||
EEVariables |
|
||||
.ee_php_user) |
|
||||
) |
|
||||
# create symbolic link for debug log |
|
||||
EEFileUtils.create_symlink(self, ["{0}/htdocs/wp-content/" |
|
||||
"debug.log" |
|
||||
.format(webroot), |
|
||||
'{0}/logs/debug.log' |
|
||||
.format(webroot)]) |
|
||||
|
|
||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
else: |
|
||||
Log.info(self, "Site is not WordPress site, skipping " |
|
||||
"WordPress logs") |
|
||||
|
|
||||
gzip_list = [] |
|
||||
for g_list in self.msg: |
|
||||
gzip_list = gzip_list + glob.glob(g_list) |
|
||||
|
|
||||
# Gzip content of file |
|
||||
for g_list in gzip_list: |
|
||||
Log.info(self, "Gzipping file {file}".format(file=g_list)) |
|
||||
in_file = g_list |
|
||||
in_data = open(in_file, "rb").read() |
|
||||
out_gz = g_list + ".gz" |
|
||||
gzf = gzip.open(out_gz, "wb") |
|
||||
gzf.write(in_data) |
|
||||
gzf.close() |
|
||||
|
|
||||
|
|
||||
class EELogMailController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'mail' |
|
||||
description = 'Mail Nginx, PHP, MySQL log file' |
|
||||
stacked_on = 'log' |
|
||||
stacked_type = 'nested' |
|
||||
arguments = [ |
|
||||
(['--all'], |
|
||||
dict(help='Mail All logs file', action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='Mail Nginx Error logs file', action='store_true')), |
|
||||
(['--php'], |
|
||||
dict(help='Mail PHP Error logs file', action='store_true')), |
|
||||
(['--fpm'], |
|
||||
dict(help='Mail PHP5-fpm slow logs file', |
|
||||
action='store_true')), |
|
||||
(['--mysql'], |
|
||||
dict(help='Mail MySQL logs file', action='store_true')), |
|
||||
(['--wp'], |
|
||||
dict(help='Mail Site specific WordPress logs file', |
|
||||
action='store_true')), |
|
||||
(['--access'], |
|
||||
dict(help='Mail Nginx access log file', |
|
||||
action='store_true')), |
|
||||
(['site_name'], |
|
||||
dict(help='Website Name', nargs='?', default=None)), |
|
||||
(['--to'], |
|
||||
dict(help='EMail addresses to send log files', action='append', |
|
||||
dest='to', nargs=1, required=True)), |
|
||||
] |
|
||||
usage = "ee log mail [<site_name>] [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
"""Default function of log Mail""" |
|
||||
self.msg = [] |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
self.app.pargs.nginx = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.fpm = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.access = True |
|
||||
|
|
||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) |
|
||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access) |
|
||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.wp = True |
|
||||
self.app.pargs.access = True |
|
||||
self.app.pargs.mysql = True |
|
||||
|
|
||||
if self.app.pargs.nginx and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*error.log"] |
|
||||
|
|
||||
if self.app.pargs.access and (not self.app.pargs.site_name): |
|
||||
self.msg = self.msg + ["/var/log/nginx/*access.log"] |
|
||||
|
|
||||
if self.app.pargs.fpm: |
|
||||
open('/var/log/php5/slow.log', 'a').close() |
|
||||
open('/var/log/php5/fpm.log', 'a').close() |
|
||||
self.msg = self.msg + ['/var/log/php5/slow.log', |
|
||||
'/var/log/php5/fpm.log'] |
|
||||
if self.app.pargs.mysql: |
|
||||
# MySQL debug will not work for remote MySQL |
|
||||
if EEVariables.ee_mysql_host is "localhost": |
|
||||
if os.path.isfile('/var/log/mysql/mysql-slow.log'): |
|
||||
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL slow-log not found, skipped") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, EasyEngine is not able to" |
|
||||
"show MySQL log file") |
|
||||
|
|
||||
if self.app.pargs.site_name: |
|
||||
webroot = "{0}{1}".format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name) |
|
||||
|
|
||||
if not os.path.isdir(webroot): |
|
||||
Log.error(self, "Site not present, quitting") |
|
||||
if self.app.pargs.access: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/access.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.nginx: |
|
||||
self.msg = self.msg + ["{0}/{1}/logs/error.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
if self.app.pargs.wp: |
|
||||
if os.path.isdir('{0}/htdocs/wp-content'.format(webroot)): |
|
||||
if not os.path.isfile('{0}/logs/debug.log' |
|
||||
.format(webroot)): |
|
||||
if not os.path.isfile('{0}/htdocs/wp-content/debug.log' |
|
||||
.format(webroot)): |
|
||||
open("{0}/htdocs/wp-content/debug.log" |
|
||||
.format(webroot), |
|
||||
encoding='utf-8', mode='a').close() |
|
||||
EEShellExec.cmd_exec(self, "chown {1}: {0}/htdocs/" |
|
||||
"wp-content/debug.log" |
|
||||
"".format(webroot, |
|
||||
EEVariables |
|
||||
.ee_php_user) |
|
||||
) |
|
||||
# create symbolic link for debug log |
|
||||
EEFileUtils.create_symlink(self, ["{0}/htdocs/wp-content/" |
|
||||
"debug.log" |
|
||||
.format(webroot), |
|
||||
'{0}/logs/debug.log' |
|
||||
.format(webroot)]) |
|
||||
|
|
||||
self.msg = self.msg + ["{0}/{1}/logs/debug.log" |
|
||||
.format(EEVariables.ee_webroot, |
|
||||
self.app.pargs.site_name)] |
|
||||
else: |
|
||||
Log.info(self, "Site is not WordPress site, skipping " |
|
||||
"WordPress logs") |
|
||||
|
|
||||
mail_list = [] |
|
||||
for m_list in self.msg: |
|
||||
mail_list = mail_list + glob.glob(m_list) |
|
||||
|
|
||||
for tomail in self.app.pargs.to: |
|
||||
Log.info(self, "Sending mail to {0}".format(tomail[0])) |
|
||||
EESendMail("easyengine", tomail[0], "{0} Log Files" |
|
||||
.format(EEVariables.ee_fqdn), |
|
||||
"Hey Hi,\n Please find attached server log files" |
|
||||
"\n\n\nYour's faithfully,\nEasyEngine", |
|
||||
files=mail_list, port=25, isTls=False) |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EELogController) |
|
||||
handler.register(EELogShowController) |
|
||||
handler.register(EELogResetController) |
|
||||
handler.register(EELogGzipController) |
|
||||
handler.register(EELogMailController) |
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_log_hook) |
|
@ -1,57 +0,0 @@ |
|||||
from sqlalchemy import Column, DateTime, String, Integer, Boolean, func |
|
||||
from ee.core.database import Base |
|
||||
|
|
||||
|
|
||||
class SiteDB(Base): |
|
||||
""" |
|
||||
Databse model for site table |
|
||||
""" |
|
||||
__tablename__ = 'sites' |
|
||||
__table_args__ = {'extend_existing': True} |
|
||||
id = Column(Integer, primary_key=True) |
|
||||
sitename = Column(String, unique=True) |
|
||||
|
|
||||
site_type = Column(String) |
|
||||
cache_type = Column(String) |
|
||||
site_path = Column(String) |
|
||||
|
|
||||
# Use default=func.now() to set the default created time |
|
||||
# of a site to be the current time when a |
|
||||
# Site record was created |
|
||||
|
|
||||
created_on = Column(DateTime, default=func.now()) |
|
||||
is_enabled = Column(Boolean, unique=False, default=True, nullable=False) |
|
||||
is_ssl = Column(Boolean, unique=False, default=False) |
|
||||
storage_fs = Column(String) |
|
||||
storage_db = Column(String) |
|
||||
db_name = Column(String) |
|
||||
db_user = Column(String) |
|
||||
db_password = Column(String) |
|
||||
db_host = Column(String) |
|
||||
is_hhvm = Column(Boolean, unique=False, default=False) |
|
||||
is_pagespeed = Column(Boolean, unique=False, default=False) |
|
||||
|
|
||||
def __init__(self, sitename=None, site_type=None, cache_type=None, |
|
||||
site_path=None, site_enabled=None, |
|
||||
is_ssl=None, storage_fs=None, storage_db=None, db_name=None, |
|
||||
db_user=None, db_password=None, db_host='localhost', |
|
||||
hhvm=None, pagespeed=None): |
|
||||
self.sitename = sitename |
|
||||
self.site_type = site_type |
|
||||
self.cache_type = cache_type |
|
||||
self.site_path = site_path |
|
||||
self.is_enabled = site_enabled |
|
||||
self.is_ssl = is_ssl |
|
||||
self.storage_fs = storage_fs |
|
||||
self.storage_db = storage_db |
|
||||
self.db_name = db_name |
|
||||
self.db_user = db_user |
|
||||
self.db_password = db_password |
|
||||
self.db_host = db_host |
|
||||
self.is_hhvm = hhvm |
|
||||
self.is_pagespeed = pagespeed |
|
||||
# def __repr__(self): |
|
||||
# return '<Site %r>' % (self.site_type) |
|
||||
# |
|
||||
# def getType(self): |
|
||||
# return '%r>' % (self.site_type) |
|
@ -1,144 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.git import EEGit |
|
||||
from ee.core.services import EEService |
|
||||
import string |
|
||||
import random |
|
||||
import sys |
|
||||
import hashlib |
|
||||
import getpass |
|
||||
|
|
||||
|
|
||||
def ee_secure_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EESecureController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'secure' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
description = ('Secure command secure auth, ip and port') |
|
||||
arguments = [ |
|
||||
(['--auth'], |
|
||||
dict(help='secure auth', action='store_true')), |
|
||||
(['--port'], |
|
||||
dict(help='secure port', action='store_true')), |
|
||||
(['--ip'], |
|
||||
dict(help='secure ip', action='store_true')), |
|
||||
(['user_input'], |
|
||||
dict(help='user input', nargs='?', default=None)), |
|
||||
(['user_pass'], |
|
||||
dict(help='user pass', nargs='?', default=None))] |
|
||||
usage = "ee secure [options]" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
if self.app.pargs.auth: |
|
||||
self.secure_auth() |
|
||||
if self.app.pargs.port: |
|
||||
self.secure_port() |
|
||||
if self.app.pargs.ip: |
|
||||
self.secure_ip() |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def secure_auth(self): |
|
||||
"""This function Secures authentication""" |
|
||||
passwd = ''.join([random.choice |
|
||||
(string.ascii_letters + string.digits) |
|
||||
for n in range(6)]) |
|
||||
if not self.app.pargs.user_input: |
|
||||
username = input("Provide HTTP authentication user " |
|
||||
"name [{0}] :".format(EEVariables.ee_user)) |
|
||||
self.app.pargs.user_input = username |
|
||||
if username == "": |
|
||||
self.app.pargs.user_input = EEVariables.ee_user |
|
||||
if not self.app.pargs.user_pass: |
|
||||
password = getpass.getpass("Provide HTTP authentication " |
|
||||
"password [{0}] :".format(passwd)) |
|
||||
self.app.pargs.user_pass = password |
|
||||
if password == "": |
|
||||
self.app.pargs.user_pass = passwd |
|
||||
Log.debug(self, "printf username:" |
|
||||
"$(openssl passwd -crypt " |
|
||||
"password 2> /dev/null)\n\"" |
|
||||
"> /etc/nginx/htpasswd-ee 2>/dev/null") |
|
||||
EEShellExec.cmd_exec(self, "printf \"{username}:" |
|
||||
"$(openssl passwd -crypt " |
|
||||
"{password} 2> /dev/null)\n\"" |
|
||||
"> /etc/nginx/htpasswd-ee 2>/dev/null" |
|
||||
.format(username=self.app.pargs.user_input, |
|
||||
password=self.app.pargs.user_pass), |
|
||||
log=False) |
|
||||
EEGit.add(self, ["/etc/nginx"], |
|
||||
msg="Adding changed secure auth into Git") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def secure_port(self): |
|
||||
"""This function Secures port""" |
|
||||
if self.app.pargs.user_input: |
|
||||
while not self.app.pargs.user_input.isdigit(): |
|
||||
Log.info(self, "Please Enter valid port number ") |
|
||||
self.app.pargs.user_input = input("EasyEngine " |
|
||||
"admin port [22222]:") |
|
||||
if not self.app.pargs.user_input: |
|
||||
port = input("EasyEngine admin port [22222]:") |
|
||||
if port == "": |
|
||||
self.app.pargs.user_input = 22222 |
|
||||
while not port.isdigit() and port != "": |
|
||||
Log.info(self, "Please Enter valid port number :") |
|
||||
port = input("EasyEngine admin port [22222]:") |
|
||||
self.app.pargs.user_input = port |
|
||||
if EEVariables.ee_platform_distro == 'ubuntu': |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen " |
|
||||
"{port} default_server ssl spdy;/\" " |
|
||||
"/etc/nginx/sites-available/22222" |
|
||||
.format(port=self.app.pargs.user_input)) |
|
||||
if EEVariables.ee_platform_distro == 'debian': |
|
||||
EEShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen " |
|
||||
"{port} default_server ssl;/\" " |
|
||||
"/etc/nginx/sites-available/22222" |
|
||||
.format(port=self.app.pargs.user_input)) |
|
||||
EEGit.add(self, ["/etc/nginx"], |
|
||||
msg="Adding changed secure port into Git") |
|
||||
if not EEService.reload_service(self, 'nginx'): |
|
||||
Log.error(self, "service nginx reload failed. " |
|
||||
"check issues with `nginx -t` command") |
|
||||
Log.info(self, "Successfully port changed {port}" |
|
||||
.format(port=self.app.pargs.user_input)) |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def secure_ip(self): |
|
||||
"""This function Secures IP""" |
|
||||
# TODO:remaining with ee.conf updation in file |
|
||||
newlist = [] |
|
||||
if not self.app.pargs.user_input: |
|
||||
ip = input("Enter the comma separated IP addresses " |
|
||||
"to white list [127.0.0.1]:") |
|
||||
self.app.pargs.user_input = ip |
|
||||
try: |
|
||||
user_ip = self.app.pargs.user_input.split(',') |
|
||||
except Exception as e: |
|
||||
user_ip = ['127.0.0.1'] |
|
||||
for ip_addr in user_ip: |
|
||||
if not ("exist_ip_address "+ip_addr in open('/etc/nginx/common/' |
|
||||
'acl.conf').read()): |
|
||||
EEShellExec.cmd_exec(self, "sed -i " |
|
||||
"\"/deny/i allow {whitelist_adre}\;\"" |
|
||||
" /etc/nginx/common/acl.conf" |
|
||||
.format(whitelist_adre=ip_addr)) |
|
||||
EEGit.add(self, ["/etc/nginx"], |
|
||||
msg="Adding changed secure ip into Git") |
|
||||
|
|
||||
Log.info(self, "Successfully added IP address in acl.conf file") |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EESecureController) |
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_secure_hook) |
|
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,126 +0,0 @@ |
|||||
from sqlalchemy import Column, DateTime, String, Integer, Boolean |
|
||||
from sqlalchemy import ForeignKey, func |
|
||||
from sqlalchemy.orm import relationship, backref |
|
||||
from sqlalchemy.ext.declarative import declarative_base |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.database import db_session |
|
||||
from ee.cli.plugins.models import SiteDB |
|
||||
import sys |
|
||||
import glob |
|
||||
|
|
||||
|
|
||||
def addNewSite(self, site, stype, cache, path, |
|
||||
enabled=True, ssl=False, fs='ext4', db='mysql', |
|
||||
db_name=None, db_user=None, db_password=None, |
|
||||
db_host='localhost', hhvm=0, pagespeed=0): |
|
||||
""" |
|
||||
Add New Site record information into ee database. |
|
||||
""" |
|
||||
try: |
|
||||
newRec = SiteDB(site, stype, cache, path, enabled, ssl, fs, db, |
|
||||
db_name, db_user, db_password, db_host, hhvm, |
|
||||
pagespeed) |
|
||||
db_session.add(newRec) |
|
||||
db_session.commit() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to add site to database") |
|
||||
|
|
||||
|
|
||||
def getSiteInfo(self, site): |
|
||||
""" |
|
||||
Retrieves site record from ee databse |
|
||||
""" |
|
||||
try: |
|
||||
q = SiteDB.query.filter(SiteDB.sitename == site).first() |
|
||||
return q |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to query database for site info") |
|
||||
|
|
||||
|
|
||||
def updateSiteInfo(self, site, stype='', cache='', webroot='', |
|
||||
enabled=True, ssl=False, fs='', db='', db_name=None, |
|
||||
db_user=None, db_password=None, db_host=None, hhvm=None, |
|
||||
pagespeed=None): |
|
||||
"""updates site record in database""" |
|
||||
try: |
|
||||
q = SiteDB.query.filter(SiteDB.sitename == site).first() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to query database for site info") |
|
||||
|
|
||||
if not q: |
|
||||
Log.error(self, "{0} does not exist in database".format(site)) |
|
||||
|
|
||||
# Check if new record matches old if not then only update database |
|
||||
if stype and q.site_type != stype: |
|
||||
q.site_type = stype |
|
||||
|
|
||||
if cache and q.cache_type != cache: |
|
||||
q.cache_type = cache |
|
||||
|
|
||||
if q.is_enabled != enabled: |
|
||||
q.is_enabled = enabled |
|
||||
|
|
||||
if ssl and q.is_ssl != ssl: |
|
||||
q.is_ssl = ssl |
|
||||
|
|
||||
if db_name and q.db_name != db_name: |
|
||||
q.db_name = db_name |
|
||||
|
|
||||
if db_user and q.db_user != db_user: |
|
||||
q.db_user = db_user |
|
||||
|
|
||||
if db_user and q.db_password != db_password: |
|
||||
q.db_password = db_password |
|
||||
|
|
||||
if db_host and q.db_host != db_host: |
|
||||
q.db_host = db_host |
|
||||
|
|
||||
if webroot and q.site_path != webroot: |
|
||||
q.site_path = webroot |
|
||||
|
|
||||
if (hhvm is not None) and (q.is_hhvm is not hhvm): |
|
||||
q.is_hhvm = hhvm |
|
||||
|
|
||||
if (pagespeed is not None) and (q.is_pagespeed is not pagespeed): |
|
||||
q.is_pagespeed = pagespeed |
|
||||
|
|
||||
try: |
|
||||
q.created_on = func.now() |
|
||||
db_session.commit() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to update site info in application database.") |
|
||||
|
|
||||
|
|
||||
def deleteSiteInfo(self, site): |
|
||||
"""Delete site record in database""" |
|
||||
try: |
|
||||
q = SiteDB.query.filter(SiteDB.sitename == site).first() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to query database") |
|
||||
|
|
||||
if not q: |
|
||||
Log.error(self, "{0} does not exist in database".format(site)) |
|
||||
|
|
||||
try: |
|
||||
db_session.delete(q) |
|
||||
db_session.commit() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to delete site from application database.") |
|
||||
|
|
||||
|
|
||||
def getAllsites(self): |
|
||||
""" |
|
||||
1. returns all records from ee database |
|
||||
""" |
|
||||
try: |
|
||||
q = SiteDB.query.all() |
|
||||
return q |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to query database") |
|
File diff suppressed because it is too large
@ -1,128 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.mysql import EEMysql |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.aptget import EEAptGet |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.apt_repo import EERepo |
|
||||
from ee.core.services import EEService |
|
||||
import configparser |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
class EEStackMigrateController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'migrate' |
|
||||
stacked_on = 'stack' |
|
||||
stacked_type = 'nested' |
|
||||
description = ('Migrate stack safely') |
|
||||
arguments = [ |
|
||||
(['--mariadb'], |
|
||||
dict(help="Migrate database to MariaDB", |
|
||||
action='store_true')), |
|
||||
# (['--PHP'], |
|
||||
# dict(help="update to html site", action='store_true')), |
|
||||
] |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def migrate_mariadb(self): |
|
||||
# Backup all database |
|
||||
EEMysql.backupAll(self) |
|
||||
|
|
||||
# Add MariaDB repo |
|
||||
Log.info(self, "Adding repository for MariaDB, please wait...") |
|
||||
|
|
||||
mysql_pref = ("Package: *\nPin: origin mirror.aarnet.edu.au" |
|
||||
"\nPin-Priority: 1000\n") |
|
||||
with open('/etc/apt/preferences.d/' |
|
||||
'MariaDB.pref', 'w') as mysql_pref_file: |
|
||||
mysql_pref_file.write(mysql_pref) |
|
||||
|
|
||||
EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) |
|
||||
Log.debug(self, 'Adding key for {0}' |
|
||||
.format(EEVariables.ee_mysql_repo)) |
|
||||
EERepo.add_key(self, '0xcbcb082a1bb943db', |
|
||||
keyserver="keyserver.ubuntu.com") |
|
||||
|
|
||||
config = configparser.ConfigParser() |
|
||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'): |
|
||||
config.read('/etc/mysql/conf.d/my.cnf') |
|
||||
else: |
|
||||
config.read(os.path.expanduser("~")+'/.my.cnf') |
|
||||
|
|
||||
try: |
|
||||
chars = config['client']['password'] |
|
||||
except Exception as e: |
|
||||
Log.error(self, "Error: process exited with error %s" |
|
||||
% e) |
|
||||
|
|
||||
Log.debug(self, "Pre-seeding MariaDB") |
|
||||
Log.debug(self, "echo \"mariadb-server-10.0 " |
|
||||
"mysql-server/root_password " |
|
||||
"password \" | " |
|
||||
"debconf-set-selections") |
|
||||
EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " |
|
||||
"mysql-server/root_password " |
|
||||
"password {chars}\" | " |
|
||||
"debconf-set-selections" |
|
||||
.format(chars=chars), |
|
||||
log=False) |
|
||||
Log.debug(self, "echo \"mariadb-server-10.0 " |
|
||||
"mysql-server/root_password_again " |
|
||||
"password \" | " |
|
||||
"debconf-set-selections") |
|
||||
EEShellExec.cmd_exec(self, "echo \"mariadb-server-10.0 " |
|
||||
"mysql-server/root_password_again " |
|
||||
"password {chars}\" | " |
|
||||
"debconf-set-selections" |
|
||||
.format(chars=chars), |
|
||||
log=False) |
|
||||
|
|
||||
# Install MariaDB |
|
||||
apt_packages = EEVariables.ee_mysql |
|
||||
|
|
||||
# If PHP is installed then install php5-mysql |
|
||||
if EEAptGet.is_installed(self, "php5-fpm"): |
|
||||
apt_packages = apt_packages + ["php5-mysql"] |
|
||||
|
|
||||
# If mail server is installed then install dovecot-sql and postfix-sql |
|
||||
if EEAptGet.is_installed(self, "dovecot-core"): |
|
||||
apt_packages = apt_packages + ["dovecot-mysql", "postfix-mysql", |
|
||||
"libclass-dbi-mysql-perl"] |
|
||||
|
|
||||
Log.info(self, "Updating apt-cache, please wait...") |
|
||||
EEAptGet.update(self) |
|
||||
Log.info(self, "Installing MariaDB, please wait...") |
|
||||
EEAptGet.remove(self, ["mysql-common", "libmysqlclient18"]) |
|
||||
EEAptGet.auto_remove(self) |
|
||||
EEAptGet.install(self, apt_packages) |
|
||||
|
|
||||
# Restart dovecot and postfix if installed |
|
||||
if EEAptGet.is_installed(self, "dovecot-core"): |
|
||||
EEService.restart_service(self, 'dovecot') |
|
||||
EEService.restart_service(self, 'postfix') |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
if ((not self.app.pargs.mariadb)): |
|
||||
self.app.args.print_help() |
|
||||
if self.app.pargs.mariadb: |
|
||||
if EEVariables.ee_mysql_host is not "localhost": |
|
||||
Log.error(self, "Remote MySQL found, EasyEngine will not " |
|
||||
"install MariaDB") |
|
||||
|
|
||||
if EEShellExec.cmd_exec(self, "mysqladmin ping") and (not |
|
||||
EEAptGet.is_installed(self, 'mariadb-server')): |
|
||||
|
|
||||
Log.info(self, "If your database size is big, " |
|
||||
"migration may take some time.") |
|
||||
Log.info(self, "During migration non nginx-cached parts of " |
|
||||
"your site may remain down") |
|
||||
start_migrate = input("Type \"mariadb\" to continue:") |
|
||||
if start_migrate != "mariadb": |
|
||||
Log.error(self, "Not starting migration") |
|
||||
self.migrate_mariadb() |
|
||||
else: |
|
||||
Log.error(self, "Your current MySQL is not alive or " |
|
||||
"you allready installed MariaDB") |
|
@ -1,374 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.services import EEService |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.aptget import EEAptGet |
|
||||
|
|
||||
|
|
||||
class EEStackStatusController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'stack_services' |
|
||||
stacked_on = 'stack' |
|
||||
stacked_type = 'embedded' |
|
||||
description = 'Get status of stack' |
|
||||
arguments = [ |
|
||||
(['--memcache'], |
|
||||
dict(help='start/stop/restart memcache', action='store_true')), |
|
||||
(['--dovecot'], |
|
||||
dict(help='start/stop/restart dovecot', action='store_true')), |
|
||||
] |
|
||||
|
|
||||
@expose(help="Start stack services") |
|
||||
def start(self): |
|
||||
"""Start services""" |
|
||||
services = [] |
|
||||
if not (self.app.pargs.nginx or self.app.pargs.php |
|
||||
or self.app.pargs.mysql or self.app.pargs.postfix |
|
||||
or self.app.pargs.hhvm or self.app.pargs.memcache |
|
||||
or self.app.pargs.dovecot or self.app.pargs.redis): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.postfix = True |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-custom'): |
|
||||
services = services + ['nginx'] |
|
||||
else: |
|
||||
Log.info(self, "Nginx is not installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
services = services + ['php5-fpm'] |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if ((EEVariables.ee_mysql_host is "localhost") or |
|
||||
(EEVariables.ee_mysql_host is "127.0.0.1")): |
|
||||
if (EEAptGet.is_installed(self, 'mysql-server') or |
|
||||
EEAptGet.is_installed(self, 'percona-server-server-5.6') or |
|
||||
EEAptGet.is_installed(self, 'mariadb-server')): |
|
||||
services = services + ['mysql'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL is not installed") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, " |
|
||||
"Unable to check MySQL service status") |
|
||||
|
|
||||
if self.app.pargs.postfix: |
|
||||
if EEAptGet.is_installed(self, 'postfix'): |
|
||||
services = services + ['postfix'] |
|
||||
else: |
|
||||
Log.info(self, "Postfix is not installed") |
|
||||
|
|
||||
if self.app.pargs.hhvm: |
|
||||
if EEAptGet.is_installed(self, 'hhvm'): |
|
||||
services = services + ['hhvm'] |
|
||||
else: |
|
||||
Log.info(self, "HHVM is not installed") |
|
||||
if self.app.pargs.memcache: |
|
||||
if EEAptGet.is_installed(self, 'memcached'): |
|
||||
services = services + ['memcached'] |
|
||||
else: |
|
||||
Log.info(self, "Memcache is not installed") |
|
||||
|
|
||||
if self.app.pargs.dovecot: |
|
||||
if EEAptGet.is_installed(self, 'dovecot-core'): |
|
||||
services = services + ['dovecot'] |
|
||||
else: |
|
||||
Log.info(self, "Mail server is not installed") |
|
||||
|
|
||||
if self.app.pargs.redis: |
|
||||
if EEAptGet.is_installed(self, 'redis-server'): |
|
||||
services = services + ['redis-server'] |
|
||||
else: |
|
||||
Log.info(self, "Redis server is not installed") |
|
||||
|
|
||||
for service in services: |
|
||||
Log.debug(self, "Starting service: {0}".format(service)) |
|
||||
EEService.start_service(self, service) |
|
||||
|
|
||||
@expose(help="Stop stack services") |
|
||||
def stop(self): |
|
||||
"""Stop services""" |
|
||||
services = [] |
|
||||
if not (self.app.pargs.nginx or self.app.pargs.php |
|
||||
or self.app.pargs.mysql or self.app.pargs.postfix |
|
||||
or self.app.pargs.hhvm or self.app.pargs.memcache |
|
||||
or self.app.pargs.dovecot or self.app.pargs.redis): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.postfix = True |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-custom'): |
|
||||
services = services + ['nginx'] |
|
||||
else: |
|
||||
Log.info(self, "Nginx is not installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
services = services + ['php5-fpm'] |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if ((EEVariables.ee_mysql_host is "localhost") or |
|
||||
(EEVariables.ee_mysql_host is "127.0.0.1")): |
|
||||
if (EEAptGet.is_installed(self, 'mysql-server') or |
|
||||
EEAptGet.is_installed(self, 'percona-server-server-5.6') or |
|
||||
EEAptGet.is_installed(self, 'mariadb-server')): |
|
||||
services = services + ['mysql'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL is not installed") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, " |
|
||||
"Unable to check MySQL service status") |
|
||||
|
|
||||
if self.app.pargs.postfix: |
|
||||
if EEAptGet.is_installed(self, 'postfix'): |
|
||||
services = services + ['postfix'] |
|
||||
else: |
|
||||
Log.info(self, "Postfix is not installed") |
|
||||
|
|
||||
if self.app.pargs.hhvm: |
|
||||
if EEAptGet.is_installed(self, 'hhvm'): |
|
||||
services = services + ['hhvm'] |
|
||||
else: |
|
||||
Log.info(self, "HHVM is not installed") |
|
||||
if self.app.pargs.memcache: |
|
||||
if EEAptGet.is_installed(self, 'memcached'): |
|
||||
services = services + ['memcached'] |
|
||||
else: |
|
||||
Log.info(self, "Memcache is not installed") |
|
||||
|
|
||||
if self.app.pargs.dovecot: |
|
||||
if EEAptGet.is_installed(self, 'dovecot-core'): |
|
||||
services = services + ['dovecot'] |
|
||||
else: |
|
||||
Log.info(self, "Mail server is not installed") |
|
||||
|
|
||||
if self.app.pargs.redis: |
|
||||
if EEAptGet.is_installed(self, 'redis-server'): |
|
||||
services = services + ['redis-server'] |
|
||||
else: |
|
||||
Log.info(self, "Redis server is not installed") |
|
||||
|
|
||||
for service in services: |
|
||||
Log.debug(self, "Stopping service: {0}".format(service)) |
|
||||
EEService.stop_service(self, service) |
|
||||
|
|
||||
@expose(help="Restart stack services") |
|
||||
def restart(self): |
|
||||
"""Restart services""" |
|
||||
services = [] |
|
||||
if not (self.app.pargs.nginx or self.app.pargs.php |
|
||||
or self.app.pargs.mysql or self.app.pargs.postfix |
|
||||
or self.app.pargs.hhvm or self.app.pargs.memcache |
|
||||
or self.app.pargs.dovecot or self.app.pargs.redis): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.postfix = True |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-custom'): |
|
||||
services = services + ['nginx'] |
|
||||
else: |
|
||||
Log.info(self, "Nginx is not installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
services = services + ['php5-fpm'] |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if ((EEVariables.ee_mysql_host is "localhost") or |
|
||||
(EEVariables.ee_mysql_host is "127.0.0.1")): |
|
||||
if (EEAptGet.is_installed(self, 'mysql-server') or |
|
||||
EEAptGet.is_installed(self, 'percona-server-server-5.6') or |
|
||||
EEAptGet.is_installed(self, 'mariadb-server')): |
|
||||
services = services + ['mysql'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL is not installed") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, " |
|
||||
"Unable to check MySQL service status") |
|
||||
|
|
||||
if self.app.pargs.postfix: |
|
||||
if EEAptGet.is_installed(self, 'postfix'): |
|
||||
services = services + ['postfix'] |
|
||||
else: |
|
||||
Log.info(self, "Postfix is not installed") |
|
||||
|
|
||||
if self.app.pargs.hhvm: |
|
||||
if EEAptGet.is_installed(self, 'hhvm'): |
|
||||
services = services + ['hhvm'] |
|
||||
else: |
|
||||
Log.info(self, "HHVM is not installed") |
|
||||
if self.app.pargs.memcache: |
|
||||
if EEAptGet.is_installed(self, 'memcached'): |
|
||||
services = services + ['memcached'] |
|
||||
else: |
|
||||
Log.info(self, "Memcache is not installed") |
|
||||
|
|
||||
if self.app.pargs.dovecot: |
|
||||
if EEAptGet.is_installed(self, 'dovecot-core'): |
|
||||
services = services + ['dovecot'] |
|
||||
else: |
|
||||
Log.info(self, "Mail server is not installed") |
|
||||
|
|
||||
if self.app.pargs.redis: |
|
||||
if EEAptGet.is_installed(self, 'redis-server'): |
|
||||
services = services + ['redis-server'] |
|
||||
else: |
|
||||
Log.info(self, "Redis server is not installed") |
|
||||
|
|
||||
for service in services: |
|
||||
Log.debug(self, "Restarting service: {0}".format(service)) |
|
||||
EEService.restart_service(self, service) |
|
||||
|
|
||||
@expose(help="Get stack status") |
|
||||
def status(self): |
|
||||
"""Status of services""" |
|
||||
services = [] |
|
||||
if not (self.app.pargs.nginx or self.app.pargs.php |
|
||||
or self.app.pargs.mysql or self.app.pargs.postfix |
|
||||
or self.app.pargs.hhvm or self.app.pargs.memcache |
|
||||
or self.app.pargs.dovecot or self.app.pargs.redis): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.postfix = True |
|
||||
self.app.pargs.hhvm = True |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-custom'): |
|
||||
services = services + ['nginx'] |
|
||||
else: |
|
||||
Log.info(self, "Nginx is not installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
services = services + ['php5-fpm'] |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if ((EEVariables.ee_mysql_host is "localhost") or |
|
||||
(EEVariables.ee_mysql_host is "127.0.0.1")): |
|
||||
if (EEAptGet.is_installed(self, 'mysql-server') or |
|
||||
EEAptGet.is_installed(self, 'percona-server-server-5.6') or |
|
||||
EEAptGet.is_installed(self, 'mariadb-server')): |
|
||||
services = services + ['mysql'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL is not installed") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, " |
|
||||
"Unable to check MySQL service status") |
|
||||
|
|
||||
if self.app.pargs.postfix: |
|
||||
if EEAptGet.is_installed(self, 'postfix'): |
|
||||
services = services + ['postfix'] |
|
||||
else: |
|
||||
Log.info(self, "Postfix is not installed") |
|
||||
|
|
||||
if self.app.pargs.hhvm: |
|
||||
if EEAptGet.is_installed(self, 'hhvm'): |
|
||||
services = services + ['hhvm'] |
|
||||
else: |
|
||||
Log.info(self, "HHVM is not installed") |
|
||||
if self.app.pargs.memcache: |
|
||||
if EEAptGet.is_installed(self, 'memcached'): |
|
||||
services = services + ['memcached'] |
|
||||
else: |
|
||||
Log.info(self, "Memcache is not installed") |
|
||||
|
|
||||
if self.app.pargs.dovecot: |
|
||||
if EEAptGet.is_installed(self, 'dovecot-core'): |
|
||||
services = services + ['dovecot'] |
|
||||
else: |
|
||||
Log.info(self, "Mail server is not installed") |
|
||||
|
|
||||
if self.app.pargs.redis: |
|
||||
if EEAptGet.is_installed(self, 'redis-server'): |
|
||||
services = services + ['redis-server'] |
|
||||
else: |
|
||||
Log.info(self, "Redis server is not installed") |
|
||||
|
|
||||
for service in services: |
|
||||
if EEService.get_service_status(self, service): |
|
||||
Log.info(self, "{0:10}: {1}".format(service, "Running")) |
|
||||
|
|
||||
@expose(help="Reload stack services") |
|
||||
def reload(self): |
|
||||
"""Reload service""" |
|
||||
services = [] |
|
||||
if not (self.app.pargs.nginx or self.app.pargs.php |
|
||||
or self.app.pargs.mysql or self.app.pargs.postfix |
|
||||
or self.app.pargs.hhvm or self.app.pargs.memcache |
|
||||
or self.app.pargs.dovecot or self.app.pargs.redis): |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.postfix = True |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-custom'): |
|
||||
services = services + ['nginx'] |
|
||||
else: |
|
||||
Log.info(self, "Nginx is not installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
services = services + ['php5-fpm'] |
|
||||
else: |
|
||||
Log.info(self, "PHP5-FPM is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if ((EEVariables.ee_mysql_host is "localhost") or |
|
||||
(EEVariables.ee_mysql_host is "127.0.0.1")): |
|
||||
if (EEAptGet.is_installed(self, 'mysql-server') or |
|
||||
EEAptGet.is_installed(self, 'percona-server-server-5.6') or |
|
||||
EEAptGet.is_installed(self, 'mariadb-server')): |
|
||||
services = services + ['mysql'] |
|
||||
else: |
|
||||
Log.info(self, "MySQL is not installed") |
|
||||
else: |
|
||||
Log.warn(self, "Remote MySQL found, " |
|
||||
"Unable to check MySQL service status") |
|
||||
|
|
||||
if self.app.pargs.postfix: |
|
||||
if EEAptGet.is_installed(self, 'postfix'): |
|
||||
services = services + ['postfix'] |
|
||||
else: |
|
||||
Log.info(self, "Postfix is not installed") |
|
||||
|
|
||||
if self.app.pargs.hhvm: |
|
||||
Log.info(self, "HHVM does not support to reload") |
|
||||
|
|
||||
if self.app.pargs.memcache: |
|
||||
if EEAptGet.is_installed(self, 'memcached'): |
|
||||
services = services + ['memcached'] |
|
||||
else: |
|
||||
Log.info(self, "Memcache is not installed") |
|
||||
|
|
||||
if self.app.pargs.dovecot: |
|
||||
if EEAptGet.is_installed(self, 'dovecot-core'): |
|
||||
services = services + ['dovecot'] |
|
||||
else: |
|
||||
Log.info(self, "Mail server is not installed") |
|
||||
|
|
||||
if self.app.pargs.redis: |
|
||||
if EEAptGet.is_installed(self, 'redis-server'): |
|
||||
services = services + ['redis-server'] |
|
||||
else: |
|
||||
Log.info(self, "Redis server is not installed") |
|
||||
|
|
||||
for service in services: |
|
||||
Log.debug(self, "Reloading service: {0}".format(service)) |
|
||||
EEService.reload_service(self, service) |
|
@ -1,244 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.aptget import EEAptGet |
|
||||
from ee.core.apt_repo import EERepo |
|
||||
from ee.core.services import EEService |
|
||||
from ee.core.fileutils import EEFileUtils |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.git import EEGit |
|
||||
from ee.core.download import EEDownload |
|
||||
import configparser |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
class EEStackUpgradeController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'upgrade' |
|
||||
stacked_on = 'stack' |
|
||||
stacked_type = 'nested' |
|
||||
description = ('Upgrade stack safely') |
|
||||
arguments = [ |
|
||||
(['--all'], |
|
||||
dict(help='Upgrade all stack', action='store_true')), |
|
||||
(['--web'], |
|
||||
dict(help='Upgrade web stack', action='store_true')), |
|
||||
(['--admin'], |
|
||||
dict(help='Upgrade admin tools stack', action='store_true')), |
|
||||
(['--mail'], |
|
||||
dict(help='Upgrade mail server stack', action='store_true')), |
|
||||
(['--mailscanner'], |
|
||||
dict(help='Upgrade mail scanner stack', action='store_true')), |
|
||||
(['--nginx'], |
|
||||
dict(help='Upgrade Nginx stack', action='store_true')), |
|
||||
(['--php'], |
|
||||
dict(help='Upgrade PHP stack', action='store_true')), |
|
||||
(['--mysql'], |
|
||||
dict(help='Upgrade MySQL stack', action='store_true')), |
|
||||
(['--hhvm'], |
|
||||
dict(help='Upgrade HHVM stack', action='store_true')), |
|
||||
(['--postfix'], |
|
||||
dict(help='Upgrade Postfix stack', action='store_true')), |
|
||||
(['--wpcli'], |
|
||||
dict(help='Upgrade WPCLI', action='store_true')), |
|
||||
(['--redis'], |
|
||||
dict(help='Upgrade Redis', action='store_true')), |
|
||||
(['--php56'], |
|
||||
dict(help="Upgrade to PHP5.6 from PHP5.5", |
|
||||
action='store_true')), |
|
||||
(['--no-prompt'], |
|
||||
dict(help="Upgrade Packages without any prompt", |
|
||||
action='store_true')), |
|
||||
] |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def upgrade_php56(self): |
|
||||
if EEVariables.ee_platform_distro == "ubuntu": |
|
||||
if os.path.isfile("/etc/apt/sources.list.d/ondrej-php5-5_6-{0}." |
|
||||
"list".format(EEVariables.ee_platform_codename)): |
|
||||
Log.error(self, "Unable to find PHP 5.5") |
|
||||
else: |
|
||||
if not(os.path.isfile(EEVariables.ee_repo_file_path) and |
|
||||
EEFileUtils.grep(self, EEVariables.ee_repo_file_path, |
|
||||
"php55")): |
|
||||
Log.error(self, "Unable to find PHP 5.5") |
|
||||
|
|
||||
Log.info(self, "During PHP update process non nginx-cached" |
|
||||
" parts of your site may remain down") |
|
||||
|
|
||||
# Check prompt |
|
||||
if (not self.app.pargs.no_prompt): |
|
||||
start_upgrade = input("Do you want to continue:[y/N]") |
|
||||
if start_upgrade != "Y" and start_upgrade != "y": |
|
||||
Log.error(self, "Not starting PHP package update") |
|
||||
|
|
||||
if EEVariables.ee_platform_distro == "ubuntu": |
|
||||
EERepo.remove(self, ppa="ppa:ondrej/php5") |
|
||||
EERepo.add(self, ppa=EEVariables.ee_php_repo) |
|
||||
else: |
|
||||
EEAptGet.remove(self, ["php5-xdebug"]) |
|
||||
EEFileUtils.searchreplace(self, EEVariables.ee_repo_file_path, |
|
||||
"php55", "php56") |
|
||||
|
|
||||
Log.info(self, "Updating apt-cache, please wait...") |
|
||||
EEAptGet.update(self) |
|
||||
Log.info(self, "Installing packages, please wait ...") |
|
||||
EEAptGet.install(self, EEVariables.ee_php) |
|
||||
|
|
||||
if EEVariables.ee_platform_distro == "debian": |
|
||||
EEShellExec.cmd_exec(self, "pecl install xdebug") |
|
||||
|
|
||||
with open("/etc/php5/mods-available/xdebug.ini", |
|
||||
encoding='utf-8', mode='a') as myfile: |
|
||||
myfile.write(";zend_extension=/usr/lib/php5/20131226/" |
|
||||
"xdebug.so\n") |
|
||||
|
|
||||
EEFileUtils.create_symlink(self, ["/etc/php5/mods-available/" |
|
||||
"xdebug.ini", "/etc/php5/fpm/conf.d" |
|
||||
"/20-xedbug.ini"]) |
|
||||
|
|
||||
Log.info(self, "Successfully upgraded from PHP 5.5 to PHP 5.6") |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
# All package update |
|
||||
if ((not self.app.pargs.php56)): |
|
||||
|
|
||||
apt_packages = [] |
|
||||
packages = [] |
|
||||
|
|
||||
if ((not self.app.pargs.web) and (not self.app.pargs.nginx) and |
|
||||
(not self.app.pargs.php) and (not self.app.pargs.mysql) and |
|
||||
(not self.app.pargs.postfix) and (not self.app.pargs.hhvm) and |
|
||||
(not self.app.pargs.mailscanner) and (not self.app.pargs.all) |
|
||||
and (not self.app.pargs.wpcli) and (not self.app.pargs.redis)): |
|
||||
self.app.pargs.web = True |
|
||||
|
|
||||
if self.app.pargs.all: |
|
||||
self.app.pargs.web = True |
|
||||
self.app.pargs.mail = True |
|
||||
|
|
||||
if self.app.pargs.web: |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.postfix = True |
|
||||
self.app.pargs.wpcli = True |
|
||||
|
|
||||
if self.app.pargs.mail: |
|
||||
self.app.pargs.nginx = True |
|
||||
self.app.pargs.php = True |
|
||||
self.app.pargs.mysql = True |
|
||||
self.app.pargs.wpcli = True |
|
||||
self.app.pargs.postfix = True |
|
||||
|
|
||||
if EEAptGet.is_installed(self, 'dovecot-core'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_mail |
|
||||
self.app.pargs.mailscanner = True |
|
||||
else: |
|
||||
Log.info(self, "Mail server is not installed") |
|
||||
|
|
||||
if self.app.pargs.nginx: |
|
||||
if EEAptGet.is_installed(self, 'nginx-custom'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_nginx |
|
||||
else: |
|
||||
Log.info(self, "Nginx is not already installed") |
|
||||
|
|
||||
if self.app.pargs.php: |
|
||||
if EEAptGet.is_installed(self, 'php5-fpm'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_php |
|
||||
else: |
|
||||
Log.info(self, "PHP is not installed") |
|
||||
|
|
||||
if self.app.pargs.hhvm: |
|
||||
if EEAptGet.is_installed(self, 'hhvm'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_hhvm |
|
||||
else: |
|
||||
Log.info(self, "HHVM is not installed") |
|
||||
|
|
||||
if self.app.pargs.mysql: |
|
||||
if EEAptGet.is_installed(self, 'mariadb-server'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_mysql |
|
||||
else: |
|
||||
Log.info(self, "MariaDB is not installed") |
|
||||
|
|
||||
if self.app.pargs.postfix: |
|
||||
if EEAptGet.is_installed(self, 'postfix'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_postfix |
|
||||
else: |
|
||||
Log.info(self, "Postfix is not installed") |
|
||||
|
|
||||
if self.app.pargs.redis: |
|
||||
if EEAptGet.is_installed(self, 'redis-server'): |
|
||||
apt_packages = apt_packages + EEVariables.ee_redis |
|
||||
else: |
|
||||
Log.info(self, "Redis is not installed") |
|
||||
|
|
||||
if self.app.pargs.wpcli: |
|
||||
if os.path.isfile('/usr/bin/wp'): |
|
||||
packages = packages + [["https://github.com/wp-cli/wp-cli/" |
|
||||
"releases/download/v{0}/" |
|
||||
"wp-cli-{0}.phar" |
|
||||
"".format(EEVariables.ee_wp_cli), |
|
||||
"/usr/bin/wp", |
|
||||
"WP-CLI"]] |
|
||||
else: |
|
||||
Log.info(self, "WPCLI is not installed with EasyEngine") |
|
||||
|
|
||||
if self.app.pargs.mailscanner: |
|
||||
if EEAptGet.is_installed(self, 'amavisd-new'): |
|
||||
apt_packages = (apt_packages + EEVariables.ee_mailscanner) |
|
||||
else: |
|
||||
Log.info(self, "MailScanner is not installed") |
|
||||
|
|
||||
if len(packages) or len(apt_packages): |
|
||||
|
|
||||
Log.info(self, "During package update process non nginx-cached" |
|
||||
" parts of your site may remain down") |
|
||||
# Check prompt |
|
||||
if (not self.app.pargs.no_prompt): |
|
||||
start_upgrade = input("Do you want to continue:[y/N]") |
|
||||
if start_upgrade != "Y" and start_upgrade != "y": |
|
||||
Log.error(self, "Not starting package update") |
|
||||
|
|
||||
Log.info(self, "Updating packages, please wait...") |
|
||||
if len(apt_packages): |
|
||||
# apt-get update |
|
||||
EEAptGet.update(self) |
|
||||
# Update packages |
|
||||
EEAptGet.install(self, apt_packages) |
|
||||
|
|
||||
# Post Actions after package updates |
|
||||
if set(EEVariables.ee_nginx).issubset(set(apt_packages)): |
|
||||
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)): |
|
||||
EEService.restart_service(self, 'hhvm') |
|
||||
if set(EEVariables.ee_postfix).issubset(set(apt_packages)): |
|
||||
EEService.restart_service(self, 'postfix') |
|
||||
if set(EEVariables.ee_mysql).issubset(set(apt_packages)): |
|
||||
EEService.restart_service(self, 'hhvm') |
|
||||
if set(EEVariables.ee_mail).issubset(set(apt_packages)): |
|
||||
EEService.restart_service(self, 'dovecot') |
|
||||
if set(EEVariables.ee_redis).issubset(set(apt_packages)): |
|
||||
EEService.restart_service(self, 'redis-server') |
|
||||
|
|
||||
if len(packages): |
|
||||
if self.app.pargs.wpcli: |
|
||||
EEFileUtils.remove(self,['/usr/bin/wp']) |
|
||||
|
|
||||
Log.debug(self, "Downloading following: {0}".format(packages)) |
|
||||
EEDownload.download(self, packages) |
|
||||
|
|
||||
if self.app.pargs.wpcli: |
|
||||
EEFileUtils.chmod(self, "/usr/bin/wp", 0o775) |
|
||||
|
|
||||
Log.info(self, "Successfully updated packages") |
|
||||
|
|
||||
# PHP 5.6 to 5.6 |
|
||||
elif (self.app.pargs.php56): |
|
||||
self.upgrade_php56() |
|
||||
else: |
|
||||
self.app.args.print_help() |
|
@ -1,95 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.fileutils import EEFileUtils |
|
||||
from ee.cli.plugins.sitedb import * |
|
||||
from ee.core.mysql import * |
|
||||
from ee.core.logging import Log |
|
||||
|
|
||||
|
|
||||
def ee_sync_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EESyncController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'sync' |
|
||||
stacked_on = 'base' |
|
||||
stacked_type = 'nested' |
|
||||
description = 'synchronize EasyEngine database' |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
self.sync() |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def sync(self): |
|
||||
""" |
|
||||
1. reads database information from wp/ee-config.php |
|
||||
2. updates records into ee database accordingly. |
|
||||
""" |
|
||||
Log.info(self, "Synchronizing ee database, please wait...") |
|
||||
sites = getAllsites(self) |
|
||||
if not sites: |
|
||||
pass |
|
||||
for site in sites: |
|
||||
if site.site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: |
|
||||
ee_site_webroot = site.site_path |
|
||||
# Read config files |
|
||||
configfiles = glob.glob(ee_site_webroot + '/*-config.php') |
|
||||
|
|
||||
#search for wp-config.php inside htdocs/ |
|
||||
if not configfiles: |
|
||||
Log.debug(self, "Config files not found in {0}/ " |
|
||||
.format(ee_site_webroot)) |
|
||||
if site.site_type != 'mysql': |
|
||||
Log.debug(self, "Searching wp-config.php in {0}/htdocs/ " |
|
||||
.format(ee_site_webroot)) |
|
||||
configfiles = glob.glob(ee_site_webroot + '/htdocs/wp-config.php') |
|
||||
|
|
||||
if configfiles: |
|
||||
if EEFileUtils.isexist(self, configfiles[0]): |
|
||||
ee_db_name = (EEFileUtils.grep(self, configfiles[0], |
|
||||
'DB_NAME').split(',')[1] |
|
||||
.split(')')[0].strip().replace('\'', '')) |
|
||||
ee_db_user = (EEFileUtils.grep(self, configfiles[0], |
|
||||
'DB_USER').split(',')[1] |
|
||||
.split(')')[0].strip().replace('\'', '')) |
|
||||
ee_db_pass = (EEFileUtils.grep(self, configfiles[0], |
|
||||
'DB_PASSWORD').split(',')[1] |
|
||||
.split(')')[0].strip().replace('\'', '')) |
|
||||
ee_db_host = (EEFileUtils.grep(self, configfiles[0], |
|
||||
'DB_HOST').split(',')[1] |
|
||||
.split(')')[0].strip().replace('\'', '')) |
|
||||
|
|
||||
# Check if database really exist |
|
||||
try: |
|
||||
if not EEMysql.check_db_exists(self, ee_db_name): |
|
||||
# Mark it as deleted if not exist |
|
||||
ee_db_name = 'deleted' |
|
||||
ee_db_user = 'deleted' |
|
||||
ee_db_pass = 'deleted' |
|
||||
except StatementExcecutionError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
except Exception as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
|
|
||||
if site.db_name != ee_db_name: |
|
||||
# update records if any mismatch found |
|
||||
Log.debug(self, "Updating ee db record for {0}" |
|
||||
.format(site.sitename)) |
|
||||
updateSiteInfo(self, site.sitename, |
|
||||
db_name=ee_db_name, |
|
||||
db_user=ee_db_user, |
|
||||
db_password=ee_db_pass, |
|
||||
db_host=ee_db_host) |
|
||||
else: |
|
||||
Log.debug(self, "Config files not found for {0} " |
|
||||
.format(site.sitename)) |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EESyncController) |
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_sync_hook) |
|
@ -1,45 +0,0 @@ |
|||||
from cement.core.controller import CementBaseController, expose |
|
||||
from cement.core import handler, hook |
|
||||
from ee.core.download import EEDownload |
|
||||
from ee.core.logging import Log |
|
||||
import time |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
def ee_update_hook(app): |
|
||||
# do something with the ``app`` object here. |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEUpdateController(CementBaseController): |
|
||||
class Meta: |
|
||||
label = 'ee_update' |
|
||||
stacked_on = 'base' |
|
||||
aliases = ['update'] |
|
||||
aliases_only = True |
|
||||
stacked_type = 'nested' |
|
||||
description = ('update EasyEngine to latest version') |
|
||||
usage = "ee update" |
|
||||
|
|
||||
@expose(hide=True) |
|
||||
def default(self): |
|
||||
filename = "eeupdate" + time.strftime("%Y%m%d-%H%M%S") |
|
||||
EEDownload.download(self, [["http://rt.cx/eeup", |
|
||||
"/tmp/{0}".format(filename), |
|
||||
"update script"]]) |
|
||||
try: |
|
||||
Log.info(self, "updating EasyEngine, please wait...") |
|
||||
os.system("bash /tmp/{0}".format(filename)) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
Log.error(self, "EasyEngine update failed !") |
|
||||
except Exception as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
Log.error(self, "EasyEngine update failed !") |
|
||||
|
|
||||
|
|
||||
def load(app): |
|
||||
# register the plugin class.. this only happens if the plugin is enabled |
|
||||
handler.register(EEUpdateController) |
|
||||
# register a hook (function) to run after arguments are parsed. |
|
||||
hook.register('post_argument_parsing', ee_update_hook) |
|
@ -1,27 +0,0 @@ |
|||||
use strict; |
|
||||
|
|
||||
# You can modify this file to re-enable SPAM checking through spamassassin |
|
||||
# and to re-enable antivirus checking. |
|
||||
|
|
||||
# |
|
||||
# Default antivirus checking mode |
|
||||
# Please note, that anti-virus checking is DISABLED by |
|
||||
# default. |
|
||||
# If You wish to enable it, please uncomment the following lines: |
|
||||
|
|
||||
|
|
||||
@bypass_virus_checks_maps = ( |
|
||||
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re); |
|
||||
|
|
||||
|
|
||||
# |
|
||||
# Default SPAM checking mode |
|
||||
# Please note, that anti-spam checking is DISABLED by |
|
||||
# default. |
|
||||
# If You wish to enable it, please uncomment the following lines: |
|
||||
|
|
||||
|
|
||||
@bypass_spam_checks_maps = ( |
|
||||
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re); |
|
||||
|
|
||||
1; # ensure a defined return |
|
@ -1,64 +0,0 @@ |
|||||
# EasyEngine admin NGINX CONFIGURATION |
|
||||
|
|
||||
server { |
|
||||
|
|
||||
listen 22222 default_server ssl spdy; |
|
||||
|
|
||||
access_log /var/log/nginx/22222.access.log rt_cache; |
|
||||
error_log /var/log/nginx/22222.error.log; |
|
||||
|
|
||||
ssl_certificate {{webroot}}22222/cert/22222.crt; |
|
||||
ssl_certificate_key {{webroot}}22222/cert/22222.key; |
|
||||
|
|
||||
# Force HTTP to HTTPS |
|
||||
error_page 497 =200 https://$host:22222$request_uri; |
|
||||
|
|
||||
root {{webroot}}22222/htdocs; |
|
||||
index index.php index.htm index.html; |
|
||||
|
|
||||
# Turn on directory listing |
|
||||
autoindex on; |
|
||||
|
|
||||
# HTTP Authentication on port 22222 |
|
||||
include common/acl.conf; |
|
||||
|
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
|
|
||||
# Display menu at location /fpm/status/ |
|
||||
location = /fpm/status/ {} |
|
||||
|
|
||||
location ~ /fpm/status/(.*) { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_param SCRIPT_NAME /status; |
|
||||
fastcgi_pass $1; |
|
||||
} |
|
||||
|
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
} |
|
||||
|
|
||||
# ViMbAdmin Rules |
|
||||
location = /vimbadmin/ { |
|
||||
return 301 $scheme://$host:22222/vimbadmin/public/; |
|
||||
} |
|
||||
|
|
||||
location ~* \.(js|css|jpg|gif|png)$ { |
|
||||
root {{webroot}}22222/htdocs/; |
|
||||
} |
|
||||
|
|
||||
location ~* /vimbadmin/public/(.*)/(.*) { |
|
||||
root {{webroot}}22222/htdocs/vimbadmin/public; |
|
||||
try_files $uri $uri/ /vimbadmin/public/index.php?$args; |
|
||||
} |
|
||||
|
|
||||
location ~* /vimbadmin/public/(.*) { |
|
||||
root {{webroot}}22222/htdocs/vimbadmin/public; |
|
||||
try_files $uri $uri/ /vimbadmin/public/index.php?$args; |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -1,17 +0,0 @@ |
|||||
use strict; |
|
||||
$sa_spam_subject_tag = undef; |
|
||||
$spam_quarantine_to = undef; |
|
||||
$sa_tag_level_deflt = undef; |
|
||||
|
|
||||
# Prevent spams from automatically rejected by mail-server |
|
||||
$final_spam_destiny = D_PASS; |
|
||||
|
|
||||
# We need to provide list of domains for which filtering need to be done |
|
||||
@lookup_sql_dsn = ( |
|
||||
['DBI:mysql:database=vimbadmin;host={{host}};port=3306', |
|
||||
'vimbadmin', |
|
||||
'{{password}}']); |
|
||||
|
|
||||
$sql_select_policy = 'SELECT domain FROM domain WHERE CONCAT("@",domain) IN (%k)'; |
|
||||
|
|
||||
1; # ensure a defined return |
|
@ -1,8 +0,0 @@ |
|||||
# EasyEngine (ee) protect locations using |
|
||||
# HTTP authentication || IP address |
|
||||
satisfy any; |
|
||||
auth_basic "Restricted Area"; |
|
||||
auth_basic_user_file htpasswd-ee; |
|
||||
# Allowed IP Address List |
|
||||
allow 127.0.0.1; |
|
||||
deny all; |
|
@ -1,255 +0,0 @@ |
|||||
<?php |
|
||||
$conf['datasources']['localhost'] = array( |
|
||||
'host' => '{{host}}', |
|
||||
'port' => '{{port}}', |
|
||||
'db' => 'slow_query_log', |
|
||||
'user' => '{{user}}', |
|
||||
'password' => '{{password}}', |
|
||||
'tables' => array( |
|
||||
'global_query_review' => 'fact', |
|
||||
'global_query_review_history' => 'dimension' |
|
||||
), |
|
||||
'source_type' => 'slow_query_log' |
|
||||
); |
|
||||
|
|
||||
$conf['default_report_action'] = 'report'; |
|
||||
|
|
||||
$conf['reviewers'] = array( 'dba1','dba2'); |
|
||||
$conf['review_types'] = array( 'good', 'bad', 'ticket-created', 'needs-fix', 'fixed', 'needs-analysis', 'review-again'); |
|
||||
|
|
||||
$conf['history_defaults'] = array( |
|
||||
'output' => 'table', |
|
||||
'fact-group' => 'date', |
|
||||
'fact-order' => 'date DESC', |
|
||||
'fact-limit' => '90', |
|
||||
'dimension-ts_min_start' => date("Y-m-d H:i:s", strtotime( '-90 day')), |
|
||||
'dimension-ts_min_end' => date("Y-m-d H:i:s"), |
|
||||
'table_fields' => array('date', 'index_ratio','query_time_avg','rows_sent_avg','ts_cnt','Query_time_sum','Lock_time_sum','Rows_sent_sum','Rows_examined_sum','Tmp_table_sum','Filesort_sum','Full_scan_sum') |
|
||||
); |
|
||||
|
|
||||
$conf['report_defaults'] = array( |
|
||||
'fact-group' => 'checksum', |
|
||||
'fact-order' => 'Query_time_sum DESC', |
|
||||
'fact-limit' => '20', |
|
||||
'dimension-ts_min_start' => date("Y-m-d H:i:s", strtotime( '-1 day')), |
|
||||
'dimension-ts_min_end' => date("Y-m-d H:i:s"), |
|
||||
'table_fields' => array('checksum','snippet', 'index_ratio','query_time_avg','rows_sent_avg','ts_cnt','Query_time_sum','Lock_time_sum','Rows_sent_sum','Rows_examined_sum','Tmp_table_sum','Filesort_sum','Full_scan_sum'), |
|
||||
'dimension-pivot-hostname_max' => null |
|
||||
); |
|
||||
|
|
||||
$conf['graph_defaults'] = array( |
|
||||
'fact-group' => 'minute_ts', |
|
||||
'fact-order' => 'minute_ts', |
|
||||
'fact-limit' => '', |
|
||||
'dimension-ts_min_start' => date("Y-m-d H:i:s", strtotime( '-7 day')), |
|
||||
'dimension-ts_min_end' => date("Y-m-d H:i:s"), |
|
||||
'table_fields' => array('minute_ts'), |
|
||||
'plot_field' => 'Query_time_sum', |
|
||||
); |
|
||||
|
|
||||
$conf['report_defaults']['performance_schema'] = array( |
|
||||
'fact-order' => 'SUM_TIMER_WAIT DESC', |
|
||||
'fact-limit' => '20', |
|
||||
'fact-group' => 'DIGEST', |
|
||||
'table_fields' => array( 'DIGEST', 'snippet', 'index_ratio', 'COUNT_STAR', 'SUM_TIMER_WAIT', 'SUM_LOCK_TIME','SUM_ROWS_AFFECTED','SUM_ROWS_SENT','SUM_ROWS_EXAMINED','SUM_CREATED_TMP_TABLES','SUM_SORT_SCAN','SUM_NO_INDEX_USED' ) |
|
||||
); |
|
||||
|
|
||||
$conf['history_defaults']['performance_schema'] = array( |
|
||||
'fact-order' => 'SUM_TIMER_WAIT DESC', |
|
||||
'fact-limit' => '20', |
|
||||
'fact-group' => 'DIGEST', |
|
||||
'table_fields' => array( 'DIGEST', 'index_ratio', 'COUNT_STAR', 'SUM_LOCK_TIME','SUM_ROWS_AFFECTED','SUM_ROWS_SENT','SUM_ROWS_EXAMINED','SUM_CREATED_TMP_TABLES','SUM_SORT_SCAN','SUM_NO_INDEX_USED' ) |
|
||||
); |
|
||||
|
|
||||
$conf['report_defaults']['performance_schema_history'] = array( |
|
||||
'fact-group' => 'DIGEST', |
|
||||
'fact-order' => 'SUM_TIMER_WAIT DESC', |
|
||||
'fact-limit' => '20', |
|
||||
'dimension-FIRST_SEEN_start' => date("Y-m-d H:i:s", strtotime( '-1 day')), |
|
||||
'dimension-FIRST_SEEN_end' => date("Y-m-d H:i:s"), |
|
||||
'table_fields' => array( 'DIGEST', 'snippet', 'index_ratio', 'COUNT_STAR', 'SUM_LOCK_TIME','SUM_ROWS_AFFECTED','SUM_ROWS_SENT','SUM_ROWS_EXAMINED','SUM_CREATED_TMP_TABLES','SUM_SORT_SCAN','SUM_NO_INDEX_USED' ) |
|
||||
); |
|
||||
|
|
||||
$conf['graph_defaults']['performance_schema_history'] = array( |
|
||||
'fact-group' => 'minute_ts', |
|
||||
'fact-order' => 'minute_ts', |
|
||||
'fact-limit' => '', |
|
||||
'dimension-FIRST_SEEN_start' => date("Y-m-d H:i:s", strtotime( '-7 day')), |
|
||||
'dimension-FIRST_SEEN_end' => date("Y-m-d H:i:s"), |
|
||||
'table_fields' => array('minute_ts'), |
|
||||
'plot_field' => 'SUM_TIMER_WAIT', |
|
||||
'dimension-pivot-hostname_max' => null |
|
||||
); |
|
||||
|
|
||||
$conf['history_defaults']['performance_schema_history'] = array( |
|
||||
'output' => 'table', |
|
||||
'fact-group' => 'date', |
|
||||
'fact-order' => 'date DESC', |
|
||||
'fact-limit' => '90', |
|
||||
'dimension-FIRST_SEEN_start' => date("Y-m-d H:i:s", strtotime( '-90 day')), |
|
||||
'dimension-FIRST_SEEN_end' => date("Y-m-d H:i:s"), |
|
||||
'table_fields' => array( 'date', 'snippet', 'index_ratio', 'COUNT_STAR', 'SUM_LOCK_TIME','SUM_ROWS_AFFECTED','SUM_ROWS_SENT','SUM_ROWS_EXAMINED','SUM_CREATED_TMP_TABLES','SUM_SORT_SCAN','SUM_NO_INDEX_USED' ) |
|
||||
); |
|
||||
$conf['plugins'] = array( |
|
||||
|
|
||||
'visual_explain' => '/usr/bin/pt-visual-explain', |
|
||||
'query_advisor' => '/usr/bin/pt-query-advisor', |
|
||||
|
|
||||
'show_create' => true, |
|
||||
'show_status' => true, |
|
||||
|
|
||||
'explain' => function ($sample) { |
|
||||
$conn = array(); |
|
||||
|
|
||||
if (!array_key_exists('hostname_max',$sample) or strlen($sample['hostname_max']) < 5) |
|
||||
{ |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
$pos = strpos($sample['hostname_max'], ':'); |
|
||||
if ($pos === false) |
|
||||
{ |
|
||||
$conn['port'] = 3306; |
|
||||
$conn['host'] = $sample['hostname_max']; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
$parts = preg_split("/:/", $sample['hostname_max']); |
|
||||
$conn['host'] = $parts[0]; |
|
||||
$conn['port'] = $parts[1]; |
|
||||
} |
|
||||
|
|
||||
$conn['db'] = 'mysql'; |
|
||||
if ($sample['db_max'] != '') |
|
||||
{ |
|
||||
$conn['db'] = $sample['db_max']; |
|
||||
} |
|
||||
|
|
||||
$conn['user'] = '{{user}}'; |
|
||||
$conn['password'] = '{{password}}'; |
|
||||
|
|
||||
return $conn; |
|
||||
}, |
|
||||
); |
|
||||
|
|
||||
$conf['reports']['slow_query_log'] = array( |
|
||||
'join' => array ( |
|
||||
'dimension' => 'USING (`checksum`)' |
|
||||
), |
|
||||
'fields' => array( |
|
||||
'fact' => array( |
|
||||
'group' => 'group', |
|
||||
'order' => 'order', |
|
||||
'having' => 'having', |
|
||||
'limit' => 'limit', |
|
||||
'first_seen'=> 'clear|reldate|ge|where', |
|
||||
'where' => 'raw_where', |
|
||||
'sample' => 'clear|like|where', |
|
||||
'checksum' => 'clear|where', |
|
||||
'reviewed_status' => 'clear|where', |
|
||||
|
|
||||
), |
|
||||
|
|
||||
'dimension' => array( |
|
||||
'extra_fields' => 'where', |
|
||||
'hostname_max' => 'clear|where', |
|
||||
'ts_min' => 'date_range|reldate|clear|where', |
|
||||
'pivot-hostname_max' => 'clear|pivot|select', |
|
||||
'pivot-checksum' => 'clear|pivot|select', |
|
||||
), |
|
||||
), |
|
||||
'custom_fields' => array( |
|
||||
'checksum' => 'checksum', |
|
||||
'date' => 'DATE(ts_min)', |
|
||||
'hour' => 'substring(ts_min,1,13)', |
|
||||
'hour_ts' => 'round(unix_timestamp(substring(ts_min,1,13)))', |
|
||||
'minute_ts' => 'round(unix_timestamp(substring(ts_min,1,16)))', |
|
||||
'minute' => 'substring(ts_min,1,16)', |
|
||||
'snippet' => 'LEFT(dimension.sample,20)', |
|
||||
'index_ratio' =>'ROUND(SUM(Rows_examined_sum)/SUM(rows_sent_sum),2)', |
|
||||
'query_time_avg' => 'SUM(Query_time_sum) / SUM(ts_cnt)', |
|
||||
'rows_sent_avg' => 'ROUND(SUM(Rows_sent_sum)/SUM(ts_cnt),0)', |
|
||||
), |
|
||||
|
|
||||
'callbacks' => array( |
|
||||
'table' => array( |
|
||||
'date' => function ($x) { $type=''; if ( date('N',strtotime($x)) >= 6) { $type = 'weekend'; } return array($x,$type); }, |
|
||||
'checksum' => function ($x) { return array(dec2hex($x), ''); } |
|
||||
) |
|
||||
) |
|
||||
|
|
||||
); |
|
||||
|
|
||||
$conf['reports']['performance_schema'] = array( |
|
||||
'fields' => array( |
|
||||
'fact' => array( |
|
||||
'order' => 'order', |
|
||||
'having' => 'having', |
|
||||
'limit' => 'limit', |
|
||||
'first_seen' => 'date_range|reldate|clear|where', |
|
||||
'where' => 'raw_where', |
|
||||
'DIGEST' => 'clear|where', |
|
||||
'DIGEST_TEXT' => 'clear|like|where', |
|
||||
'group' => 'group', |
|
||||
), |
|
||||
), |
|
||||
'custom_fields' => array( |
|
||||
'snippet' => 'LEFT(fact.DIGEST_TEXT,20)', |
|
||||
'index_ratio' =>'ROUND(SUM_ROWS_EXAMINED/SUM_ROWS_SENT,2)', |
|
||||
'rows_sent_avg' => 'ROUND(SUM_ROWS_SENT/COUNT_STAR,0)', |
|
||||
|
|
||||
), |
|
||||
|
|
||||
'special_field_names' => array( |
|
||||
'time' => 'FIRST_SEEN', |
|
||||
'checksum' => 'DIGEST', |
|
||||
'sample' => 'DIGEST_TEXT', |
|
||||
'fingerprint' => 'DIGEST_TEXT', |
|
||||
), |
|
||||
); |
|
||||
|
|
||||
$conf['reports']['performance_schema_history'] = array( |
|
||||
'join' => array ( |
|
||||
'dimension' => 'USING (`DIGEST`)' |
|
||||
), |
|
||||
'fields' => array( |
|
||||
'fact' => array( |
|
||||
'group' => 'group', |
|
||||
'order' => 'order', |
|
||||
'having' => 'having', |
|
||||
'limit' => 'limit', |
|
||||
'first_seen'=> 'clear|reldate|ge|where', |
|
||||
'where' => 'raw_where', |
|
||||
'DIGEST_TEXT' => 'clear|like|where', |
|
||||
'DIGEST' => 'clear|where', |
|
||||
'reviewed_status' => 'clear|where', |
|
||||
|
|
||||
), |
|
||||
|
|
||||
'dimension' => array( |
|
||||
'extra_fields' => 'where', |
|
||||
'hostname' => 'clear|where', |
|
||||
'FIRST_SEEN' => 'date_range|reldate|clear|where', |
|
||||
'pivot-hostname' => 'clear|pivot|select', |
|
||||
), |
|
||||
), |
|
||||
'custom_fields' => array( |
|
||||
'date' => 'DATE(fact.FIRST_SEEN)', |
|
||||
'snippet' => 'LEFT(fact.DIGEST_TEXT,20)', |
|
||||
'index_ratio' =>'ROUND(SUM_ROWS_EXAMINED/SUM_ROWS_SENT,2)', |
|
||||
'rows_sent_avg' => 'ROUND(SUM_ROWS_SENT/COUNT_STAR,0)', |
|
||||
'hour' => 'substring(dimension.FIRST_SEEN,1,13)', |
|
||||
'hour_ts' => 'round(unix_timestamp(substring(dimension.FIRST_SEEN,1,13)))', |
|
||||
'minute_ts' => 'round(unix_timestamp(substring(dimension.FIRST_SEEN,1,16)))', |
|
||||
'minute' => 'substring(dimension.FIRST_SEEN,1,16)', |
|
||||
), |
|
||||
|
|
||||
'special_field_names' => array( |
|
||||
'time' => 'FIRST_SEEN', |
|
||||
'checksum' => 'DIGEST', |
|
||||
'hostname' => 'hostname', |
|
||||
'sample' => 'DIGEST_TEXT' |
|
||||
), |
|
||||
); |
|
||||
|
|
||||
?> |
|
@ -1,11 +0,0 @@ |
|||||
passdb { |
|
||||
driver = sql |
|
||||
args = /etc/dovecot/dovecot-sql.conf.ext |
|
||||
} |
|
||||
userdb { |
|
||||
driver = prefetch |
|
||||
} |
|
||||
userdb { |
|
||||
driver = sql |
|
||||
args = /etc/dovecot/dovecot-sql.conf.ext |
|
||||
} |
|
@ -1,2 +0,0 @@ |
|||||
# Block IP Address |
|
||||
# deny 1.1.1.1; |
|
@ -1,4 +0,0 @@ |
|||||
require "fileinto"; |
|
||||
if header :contains "X-Spam-Flag" "YES" { |
|
||||
fileinto "Junk"; |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
driver = mysql |
|
||||
connect = host={{host}} user=vimbadmin password={{password}} dbname=vimbadmin |
|
||||
default_pass_scheme = MD5 |
|
||||
password_query = SELECT username as user, password as password, \ |
|
||||
homedir AS home, maildir AS mail, \ |
|
||||
concat('*:bytes=', quota) as quota_rule, uid, gid \ |
|
||||
FROM mailbox \ |
|
||||
WHERE username = '%Lu' AND active = '1' \ |
|
||||
AND ( access_restriction = 'ALL' OR LOCATE( access_restriction, '%Us' ) > 0 ) |
|
||||
user_query = SELECT homedir AS home, maildir AS mail, \ |
|
||||
concat('*:bytes=', quota) as quota_rule, uid, gid \ |
|
||||
FROM mailbox WHERE username = '%u' |
|
@ -1,60 +0,0 @@ |
|||||
protocols = imap pop3 lmtp sieve |
|
||||
|
|
||||
mail_location = maildir:/var/vmail/%d/%n |
|
||||
|
|
||||
disable_plaintext_auth = no |
|
||||
auth_mechanisms = plain login |
|
||||
#!include auth-system.conf.ext |
|
||||
!include auth-sql.conf.ext |
|
||||
|
|
||||
ssl_protocols = !SSLv2 !SSLv3 |
|
||||
|
|
||||
service lmtp { |
|
||||
unix_listener /var/spool/postfix/private/dovecot-lmtp { |
|
||||
mode = 0600 |
|
||||
user = postfix |
|
||||
group = postfix |
|
||||
} |
|
||||
} |
|
||||
service auth { |
|
||||
unix_listener /var/spool/postfix/private/auth { |
|
||||
mode = 0666 |
|
||||
user = postfix |
|
||||
group = postfix |
|
||||
} |
|
||||
unix_listener auth-userdb { |
|
||||
mode = 0600 |
|
||||
user = vmail |
|
||||
} |
|
||||
user = dovecot |
|
||||
} |
|
||||
service auth-worker { |
|
||||
user = vmail |
|
||||
} |
|
||||
|
|
||||
log_path = /var/log/dovecot.log |
|
||||
|
|
||||
mail_plugins = $mail_plugins autocreate |
|
||||
|
|
||||
plugin { |
|
||||
autocreate = Trash |
|
||||
autocreate2 = Junk |
|
||||
autocreate3 = Drafts |
|
||||
autocreate4 = Sent |
|
||||
autosubscribe = Trash |
|
||||
autosubscribe2 = Junk |
|
||||
autosubscribe3 = Drafts |
|
||||
autosubscribe4 = Sent |
|
||||
} |
|
||||
|
|
||||
protocol lmtp { |
|
||||
postmaster_address = {{email}} |
|
||||
mail_plugins = $mail_plugins sieve |
|
||||
} |
|
||||
|
|
||||
plugin { |
|
||||
sieve = ~/.dovecot.sieve |
|
||||
sieve_global_path = /var/lib/dovecot/sieve/default.sieve |
|
||||
sieve_global_dir = /var/lib/dovecot/sieve/ |
|
||||
sieve_dir = ~/sieve |
|
||||
} |
|
@ -1,84 +0,0 @@ |
|||||
## |
|
||||
# EasyEngine Settings |
|
||||
## |
|
||||
|
|
||||
|
|
||||
tcp_nopush on; |
|
||||
tcp_nodelay on; |
|
||||
types_hash_max_size 2048; |
|
||||
|
|
||||
server_tokens off; |
|
||||
reset_timedout_connection on; |
|
||||
add_header X-Powered-By "EasyEngine {{ version }}"; |
|
||||
add_header rt-Fastcgi-Cache $upstream_cache_status; |
|
||||
|
|
||||
# Limit Request |
|
||||
limit_req_status 403; |
|
||||
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; |
|
||||
|
|
||||
# Proxy Settings |
|
||||
# set_real_ip_from proxy-server-ip; |
|
||||
# real_ip_header X-Forwarded-For; |
|
||||
|
|
||||
fastcgi_read_timeout 300; |
|
||||
client_max_body_size 100m; |
|
||||
|
|
||||
## |
|
||||
# SSL Settings |
|
||||
## |
|
||||
|
|
||||
ssl_session_cache shared:SSL:20m; |
|
||||
ssl_session_timeout 10m; |
|
||||
ssl_prefer_server_ciphers on; |
|
||||
ssl_ciphers HIGH:!aNULL:!MD5:!kEDH; |
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
|
||||
|
|
||||
## |
|
||||
# Basic Settings |
|
||||
## |
|
||||
server_names_hash_bucket_size 16384; |
|
||||
# server_name_in_redirect off; |
|
||||
|
|
||||
|
|
||||
## |
|
||||
# Logging Settings |
|
||||
## |
|
||||
|
|
||||
access_log /var/log/nginx/access.log; |
|
||||
error_log /var/log/nginx/error.log; |
|
||||
|
|
||||
# Log format Settings |
|
||||
log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' |
|
||||
'$http_host "$request" $status $body_bytes_sent ' |
|
||||
'"$http_referer" "$http_user_agent" "$request_body"'; |
|
||||
|
|
||||
## |
|
||||
# Gzip Settings |
|
||||
## |
|
||||
|
|
||||
gzip on; |
|
||||
gzip_disable "msie6"; |
|
||||
|
|
||||
gzip_vary on; |
|
||||
gzip_proxied any; |
|
||||
gzip_comp_level 6; |
|
||||
gzip_buffers 16 8k; |
|
||||
gzip_http_version 1.1; |
|
||||
gzip_types |
|
||||
application/atom+xml |
|
||||
application/javascript |
|
||||
application/json |
|
||||
application/rss+xml |
|
||||
application/vnd.ms-fontobject |
|
||||
application/x-font-ttf |
|
||||
application/x-web-app-manifest+json |
|
||||
application/xhtml+xml |
|
||||
application/xml |
|
||||
font/opentype |
|
||||
image/svg+xml |
|
||||
image/x-icon |
|
||||
text/css |
|
||||
text/plain |
|
||||
text/x-component |
|
||||
text/xml |
|
||||
text/javascript; |
|
@ -1,10 +0,0 @@ |
|||||
# FastCGI cache settings |
|
||||
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m; |
|
||||
fastcgi_cache_key "$scheme$request_method$host$request_uri"; |
|
||||
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503; |
|
||||
fastcgi_cache_valid 200 301 302 404 1h; |
|
||||
fastcgi_buffers 16 16k; |
|
||||
fastcgi_buffer_size 32k; |
|
||||
fastcgi_param SERVER_NAME $http_host; |
|
||||
fastcgi_ignore_headers Cache-Control Expires Set-Cookie; |
|
||||
fastcgi_keep_conn on; |
|
@ -1,9 +0,0 @@ |
|||||
|
|
||||
MySQL ({{version}}) on {{host}}: |
|
||||
|
|
||||
port {{port}} |
|
||||
wait_timeout {{wait_timeout}} |
|
||||
interactive_timeout {{interactive_timeout}} |
|
||||
max_used_connections {{max_used_connections}} |
|
||||
datadir {{datadir}} |
|
||||
socket {{socket}} |
|
@ -1,10 +0,0 @@ |
|||||
|
|
||||
NGINX ({{version}}): |
|
||||
|
|
||||
user {{user}} |
|
||||
worker_processes {{worker_processes}} |
|
||||
worker_connections {{worker_connections}} |
|
||||
keepalive_timeout {{keepalive_timeout}} |
|
||||
fastcgi_read_timeout {{fastcgi_read_timeout}} |
|
||||
client_max_body_size {{client_max_body_size}} |
|
||||
allow {{allow}} |
|
@ -1,35 +0,0 @@ |
|||||
|
|
||||
PHP ({{version}}): |
|
||||
|
|
||||
user {{user}} |
|
||||
expose_php {{expose_php}} |
|
||||
memory_limit {{memory_limit}} |
|
||||
post_max_size {{post_max_size}} |
|
||||
upload_max_filesize {{upload_max_filesize}} |
|
||||
max_execution_time {{max_execution_time}} |
|
||||
|
|
||||
Information about www.conf |
|
||||
ping.path {{www_ping_path}} |
|
||||
pm.status_path {{www_pm_status_path}} |
|
||||
process_manager {{www_pm}} |
|
||||
pm.max_requests {{www_pm_max_requests}} |
|
||||
pm.max_children {{www_pm_max_children}} |
|
||||
pm.start_servers {{www_pm_start_servers}} |
|
||||
pm.min_spare_servers {{www_pm_min_spare_servers}} |
|
||||
pm.max_spare_servers {{www_pm_max_spare_servers}} |
|
||||
request_terminate_timeout {{www_request_terminate_timeout}} |
|
||||
xdebug.profiler_enable_trigger {{www_xdebug_profiler_enable_trigger}} |
|
||||
listen {{www_listen}} |
|
||||
|
|
||||
Information about debug.conf |
|
||||
ping.path {{debug_ping_path}} |
|
||||
pm.status_path {{debug_pm_status_path}} |
|
||||
process_manager {{debug_pm}} |
|
||||
pm.max_requests {{debug_pm_max_requests}} |
|
||||
pm.max_children {{debug_pm_max_children}} |
|
||||
pm.start_servers {{debug_pm_start_servers}} |
|
||||
pm.min_spare_servers {{debug_pm_min_spare_servers}} |
|
||||
pm.max_spare_servers {{debug_pm_max_spare_servers}} |
|
||||
request_terminate_timeout {{debug_request_terminate_timeout}} |
|
||||
xdebug.profiler_enable_trigger {{debug_xdebug_profiler_enable_trigger}} |
|
||||
listen {{debug_listen}} |
|
@ -1,65 +0,0 @@ |
|||||
# NGINX CONFIGURATION FOR COMMON LOCATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
# Basic locations files |
|
||||
location = /favicon.ico { |
|
||||
access_log off; |
|
||||
log_not_found off; |
|
||||
expires max; |
|
||||
} |
|
||||
location = /robots.txt { |
|
||||
# Some WordPress plugin gererate robots.txt file |
|
||||
# Refer #340 issue |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
access_log off; |
|
||||
log_not_found off; |
|
||||
} |
|
||||
# Cache static files |
|
||||
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ { |
|
||||
add_header "Access-Control-Allow-Origin" "*"; |
|
||||
access_log off; |
|
||||
log_not_found off; |
|
||||
expires max; |
|
||||
} |
|
||||
# Security settings for better privacy |
|
||||
# Deny hidden files |
|
||||
location ~ /\. { |
|
||||
deny all; |
|
||||
access_log off; |
|
||||
log_not_found off; |
|
||||
} |
|
||||
# Deny backup extensions & log files |
|
||||
location ~* ^.+\.(bak|log|old|orig|original|php#|php~|php_bak|save|swo|swp|sql)$ { |
|
||||
deny all; |
|
||||
access_log off; |
|
||||
log_not_found off; |
|
||||
} |
|
||||
# Return 403 forbidden for readme.(txt|html) or license.(txt|html) or example.(txt|html) |
|
||||
if ($request_uri ~* "^.+(readme|license|example)\.(txt|html)$") { |
|
||||
return 403; |
|
||||
} |
|
||||
# Status pages |
|
||||
location /nginx_status { |
|
||||
stub_status on; |
|
||||
access_log off; |
|
||||
include common/acl.conf; |
|
||||
} |
|
||||
location ~ ^/(status|ping) { |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
include common/acl.conf; |
|
||||
} |
|
||||
# EasyEngine (ee) utilities |
|
||||
# phpMyAdmin settings |
|
||||
location /pma { |
|
||||
return 301 https://$host:22222/db/pma; |
|
||||
} |
|
||||
location /phpMyAdmin { |
|
||||
return 301 https://$host:22222/db/pma; |
|
||||
} |
|
||||
location /phpmyadmin { |
|
||||
return 301 https://$host:22222/db/pma; |
|
||||
} |
|
||||
# Adminer settings |
|
||||
location /adminer { |
|
||||
return 301 https://$host:22222/db/adminer; |
|
||||
} |
|
@ -1,60 +0,0 @@ |
|||||
## |
|
||||
# EasyEngine Settings |
|
||||
## |
|
||||
|
|
||||
server_tokens off; |
|
||||
reset_timedout_connection on; |
|
||||
add_header X-Powered-By "EasyEngine {{version}}"; |
|
||||
add_header rt-Fastcgi-Cache $upstream_cache_status; |
|
||||
|
|
||||
# Limit Request |
|
||||
limit_req_status 403; |
|
||||
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; |
|
||||
|
|
||||
# Proxy Settings |
|
||||
# set_real_ip_from proxy-server-ip; |
|
||||
# real_ip_header X-Forwarded-For; |
|
||||
|
|
||||
fastcgi_read_timeout 300; |
|
||||
client_max_body_size 100m; |
|
||||
|
|
||||
# SSL Settings |
|
||||
ssl_session_cache shared:SSL:20m; |
|
||||
ssl_session_timeout 10m; |
|
||||
{{#Ubuntu}} |
|
||||
ssl_prefer_server_ciphers on; |
|
||||
{{/Ubuntu}} |
|
||||
ssl_ciphers HIGH:!aNULL:!MD5:!kEDH; |
|
||||
|
|
||||
# Log format Settings |
|
||||
log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] ' |
|
||||
'$http_host "$request" $status $body_bytes_sent ' |
|
||||
'"$http_referer" "$http_user_agent"'; |
|
||||
|
|
||||
|
|
||||
# GZip settings |
|
||||
gzip_vary on; |
|
||||
gzip_proxied any; |
|
||||
gzip_comp_level 6; |
|
||||
gzip_buffers 16 8k; |
|
||||
gzip_http_version 1.1; |
|
||||
# Compress all output labeled with one of the following MIME-types. |
|
||||
gzip_types |
|
||||
application/atom+xml |
|
||||
application/javascript |
|
||||
application/json |
|
||||
application/rss+xml |
|
||||
application/vnd.ms-fontobject |
|
||||
application/x-font-ttf |
|
||||
application/x-web-app-manifest+json |
|
||||
application/xhtml+xml |
|
||||
application/xml |
|
||||
font/opentype |
|
||||
image/svg+xml |
|
||||
image/x-icon |
|
||||
text/css |
|
||||
text/plain |
|
||||
text/x-component |
|
||||
text/xml |
|
||||
text/javascript; |
|
||||
# text/html is always compressed by HttpGzipModule |
|
@ -1,44 +0,0 @@ |
|||||
# HTTPS Support |
|
||||
# pagespeed FetchHttps enable; |
|
||||
|
|
||||
# PageSpeed Filters |
|
||||
# CSS Minification |
|
||||
# pagespeed EnableFilters combine_css,rewrite_css; |
|
||||
|
|
||||
# JS Minification |
|
||||
# pagespeed EnableFilters combine_javascript,rewrite_javascript; |
|
||||
|
|
||||
# Images Optimization |
|
||||
#pagespeed EnableFilters lazyload_images; |
|
||||
#pagespeed EnableFilters rewrite_images; |
|
||||
#pagespeed EnableFilters convert_jpeg_to_progressive,convert_png_to_jpeg,convert_jpeg_to_webp,convert_to_webp_lossless; |
|
||||
|
|
||||
# Remove comments from HTML |
|
||||
#pagespeed EnableFilters remove_comments; |
|
||||
# Remove WHITESPACE from HTML |
|
||||
#pagespeed EnableFilters collapse_whitespace; |
|
||||
|
|
||||
|
|
||||
# CDN Support |
|
||||
#pagespeed MapRewriteDomain cdn.example.com www.example.com; |
|
||||
|
|
||||
|
|
||||
########################################################################################################################### |
|
||||
# DO NOT EDIT AFTER THIS LINE # |
|
||||
########################################################################################################################### |
|
||||
|
|
||||
# PageSpeed Admin |
|
||||
location /ngx_pagespeed_statistics { include common/acl.conf; } |
|
||||
location /ngx_pagespeed_global_statistics { include common/acl.conf; } |
|
||||
location /ngx_pagespeed_message { include common/acl.conf; } |
|
||||
location /pagespeed_console { include common/acl.conf; } |
|
||||
location ~ ^/pagespeed_admin { include common/acl.conf; } |
|
||||
location ~ ^/pagespeed_global_admin { include common/acl.conf; } |
|
||||
|
|
||||
# Ensure requests for pagespeed optimized resources go to the pagespeed handler |
|
||||
# and no extraneous headers get set. |
|
||||
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { |
|
||||
add_header "" ""; |
|
||||
} |
|
||||
location ~ "^/pagespeed_static/" { } |
|
||||
location ~ "^/ngx_pagespeed_beacon$" { } |
|
@ -1,21 +0,0 @@ |
|||||
# Turning the module on and off |
|
||||
pagespeed on; |
|
||||
|
|
||||
# Configuring PageSpeed Filters |
|
||||
pagespeed RewriteLevel PassThrough; |
|
||||
|
|
||||
# Needs to exist and be writable by nginx. Use tmpfs for best performance. |
|
||||
pagespeed MemcachedServers "127.0.0.1:11211"; |
|
||||
pagespeed FileCachePath /var/ngx_pagespeed_cache; |
|
||||
|
|
||||
# PageSpeed Admin |
|
||||
pagespeed StatisticsPath /ngx_pagespeed_statistics; |
|
||||
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics; |
|
||||
pagespeed MessagesPath /ngx_pagespeed_message; |
|
||||
pagespeed ConsolePath /pagespeed_console; |
|
||||
pagespeed AdminPath /pagespeed_admin; |
|
||||
pagespeed GlobalAdminPath /pagespeed_global_admin; |
|
||||
|
|
||||
# PageSpeed Cache Purge |
|
||||
pagespeed EnableCachePurge on; |
|
||||
pagespeed PurgeMethod PURGE; |
|
@ -1,10 +0,0 @@ |
|||||
# PHP NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass hhvm; |
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
# PHP NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
} |
|
@ -1,58 +0,0 @@ |
|||||
# Redis NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $skip_cache 0; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $skip_cache 0; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
|
|
||||
location /redis-fetch { |
|
||||
internal ; |
|
||||
set $redis_key $args; |
|
||||
redis_pass redis; |
|
||||
} |
|
||||
location /redis-store { |
|
||||
internal ; |
|
||||
set_unescape_uri $key $arg_key ; |
|
||||
redis2_query set $key $echo_request_body; |
|
||||
redis2_query expire $key 14400; |
|
||||
redis2_pass redis; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
location ~ \.php$ { |
|
||||
set $key "nginx-cache:$scheme$request_method$host$request_uri"; |
|
||||
try_files $uri =404; |
|
||||
|
|
||||
srcache_fetch_skip $skip_cache; |
|
||||
srcache_store_skip $skip_cache; |
|
||||
|
|
||||
srcache_response_cache_control off; |
|
||||
|
|
||||
set_escape_uri $escaped_key $key; |
|
||||
|
|
||||
srcache_fetch GET /redis-fetch $key; |
|
||||
srcache_store PUT /redis-store key=$escaped_key; |
|
||||
|
|
||||
more_set_headers 'X-SRCache-Fetch-Status $srcache_fetch_status'; |
|
||||
more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; |
|
||||
|
|
||||
include fastcgi_params; |
|
||||
fastcgi_param HTTP_ACCEPT_ENCODING ""; |
|
||||
fastcgi_pass hhvm; |
|
||||
} |
|
@ -1,57 +0,0 @@ |
|||||
# Redis NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $skip_cache 0; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $skip_cache 0; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
|
|
||||
location /redis-fetch { |
|
||||
internal ; |
|
||||
set $redis_key $args; |
|
||||
redis_pass redis; |
|
||||
} |
|
||||
location /redis-store { |
|
||||
internal ; |
|
||||
set_unescape_uri $key $arg_key ; |
|
||||
redis2_query set $key $echo_request_body; |
|
||||
redis2_query expire $key 14400; |
|
||||
redis2_pass redis; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
location ~ \.php$ { |
|
||||
set $key "nginx-cache:$scheme$request_method$host$request_uri"; |
|
||||
try_files $uri =404; |
|
||||
|
|
||||
srcache_fetch_skip $skip_cache; |
|
||||
srcache_store_skip $skip_cache; |
|
||||
|
|
||||
srcache_response_cache_control off; |
|
||||
|
|
||||
set_escape_uri $escaped_key $key; |
|
||||
|
|
||||
srcache_fetch GET /redis-fetch $key; |
|
||||
srcache_store PUT /redis-store key=$escaped_key; |
|
||||
|
|
||||
more_set_headers 'X-SRCache-Fetch-Status $srcache_fetch_status'; |
|
||||
more_set_headers 'X-SRCache-Store-Status $srcache_store_status'; |
|
||||
|
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
} |
|
@ -1,12 +0,0 @@ |
|||||
Information about {{domain}}: |
|
||||
|
|
||||
Nginx configuration {{type}} {{enable}} |
|
||||
{{#pagespeed}}Pagespeed {{pagespeed}}{{/pagespeed}} |
|
||||
{{#hhvm}}HHVM {{hhvm}}{{/hhvm}} |
|
||||
access_log {{accesslog}} |
|
||||
error_log {{errorlog}} |
|
||||
{{#webroot}}Webroot {{webroot}}{{/webroot}} |
|
||||
{{#dbname}}DB_NAME {{dbname}}{{/dbname}} |
|
||||
{{#dbname}}DB_USER {{dbuser}}{{/dbname}} |
|
||||
{{#dbname}}DB_PASS {{dbpass}}{{/dbname}} |
|
||||
{{#tablepref}}table_prefix {{tableprefix}}{{/tablepref}} |
|
@ -1,16 +0,0 @@ |
|||||
# Common upstream settings |
|
||||
upstream php { |
|
||||
# server unix:/run/php5-fpm.sock; |
|
||||
server 127.0.0.1:{{php}}; |
|
||||
} |
|
||||
upstream debug { |
|
||||
# Debug Pool |
|
||||
server 127.0.0.1:{{debug}}; |
|
||||
} |
|
||||
{{#hhvmconf}} |
|
||||
upstream hhvm { |
|
||||
# HHVM Pool |
|
||||
server 127.0.0.1:{{hhvm}}; |
|
||||
server 127.0.0.1:{{php}} backup; |
|
||||
} |
|
||||
{{/hhvmconf}} |
|
@ -1,662 +0,0 @@ |
|||||
;; This file is licenesed Under GNU GENERAL PUBLIC LICENSE Version 3 |
|
||||
;; © Copyright 2011 - 2014 Open Source Solutions Limited, Dublin, Ireland. |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; ViMbAdmin :: Virtual Mailbox Admin |
|
||||
;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; IMPORTANT: Review and change all options in [user] |
|
||||
;; |
|
||||
;; ** This is for ViMbAdmin V3 and later ** |
|
||||
;; |
|
||||
;; See: https://github.com/opensolutions/ViMbAdmin/wiki/Configuration |
|
||||
|
|
||||
[user] |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Installation Keys and Salts |
|
||||
; |
|
||||
; During installation, you will be prompted to enter strings here. This |
|
||||
; is to verify that you are in fact the person authorised to complete the |
|
||||
; installation as well as provide security for cookies and passwords. |
|
||||
|
|
||||
securitysalt = "{{salt}}" |
|
||||
resources.auth.oss.rememberme.salt = "{{salt}}" |
|
||||
defaults.mailbox.password_salt = "{{salt}}" |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; When installing for the first time, it may be useful to set the following |
|
||||
; to 1 BUT ensure you set it to zero again in a production system |
|
||||
|
|
||||
phpSettings.display_startup_errors = 0 |
|
||||
phpSettings.display_errors = 0 |
|
||||
resources.frontController.params.displayExceptions = 0 |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; You database and caching connection. |
|
||||
;; |
|
||||
|
|
||||
resources.doctrine2.connection.options.driver = 'mysqli' |
|
||||
resources.doctrine2.connection.options.dbname = 'vimbadmin' |
|
||||
resources.doctrine2.connection.options.user = 'vimbadmin' |
|
||||
resources.doctrine2.connection.options.password = '{{password}}' |
|
||||
resources.doctrine2.connection.options.host = '{{host}}' |
|
||||
resources.doctrine2.connection.options.charset = 'utf8' |
|
||||
|
|
||||
;; Doctrine2 requires Memcache for maximum efficency. Without Memcache |
|
||||
;; it can be highly inefficient and will slow page requests down. |
|
||||
;; |
|
||||
;; You are strongly advised to install memcache and comment ArrayCache |
|
||||
;; here and uncomment MemcacheCache. |
|
||||
;; |
|
||||
|
|
||||
resources.doctrine2cache.type = 'ArrayCache' |
|
||||
;resources.doctrine2cache.type = 'MemcacheCache' |
|
||||
;resources.doctrine2cache.memcache.servers.0.host = '127.0.0.1' |
|
||||
resources.doctrine2cache.namespace = 'ViMbAdmin3' |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Default values used when creating domains |
|
||||
; |
|
||||
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Configuration |
|
||||
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Quotas |
|
||||
|
|
||||
defaults.domain.quota = 0 |
|
||||
defaults.domain.maxquota = 0 |
|
||||
defaults.domain.transport = "virtual" |
|
||||
defaults.domain.aliases = 0 |
|
||||
defaults.domain.mailboxes = 0 |
|
||||
|
|
||||
defaults.quota.multiplier = 'MB' |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; Use server side filtering to reduce pagination time on client side |
|
||||
;; Defaults to off / false |
|
||||
defaults.server_side.pagination.enable = false |
|
||||
defaults.server_side.pagination.min_search_str = 3 |
|
||||
defaults.server_side.pagination.max_result_cnt = 500 |
|
||||
|
|
||||
;; Separate configuration for domain list |
|
||||
defaults.server_side.pagination.domain.enable = false |
|
||||
defaults.server_side.pagination.domain.min_search_str = 3 |
|
||||
defaults.server_side.pagination.domain.max_result_cnt = 500 |
|
||||
|
|
||||
; The number of rows displayed in the tables |
|
||||
; must be one of these: 10, 25, 50, 100 |
|
||||
defaults.table.entries = 50 |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; Options for the display of domain and mailbox sizes |
|
||||
;; |
|
||||
;; See: https://github.com/opensolutions/ViMbAdmin/wiki/Mailbox-Sizes |
|
||||
;; |
|
||||
;; Enable or disable display of sizes. Default: disabled |
|
||||
|
|
||||
defaults.list_size.disabled = true |
|
||||
|
|
||||
;; Maildir size units. By default: KB. One of B, KB, MB or GB. |
|
||||
defaults.list_size.multiplier = 'GB' |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Default values for creating mailboxes |
|
||||
|
|
||||
; This sets the uid and gid columns in the mailbox table to the below values |
|
||||
defaults.mailbox.uid = 5000 |
|
||||
defaults.mailbox.gid = 5000 |
|
||||
|
|
||||
|
|
||||
; Set the homedir and maildir values in the mailbox table where the |
|
||||
; following substitutions apply: |
|
||||
; |
|
||||
; %d -> domain part of email address |
|
||||
; %u -> user part of email address |
|
||||
; $m -> full email address |
|
||||
; |
|
||||
; |
|
||||
; http://wiki2.dovecot.org/VirtualUsers/Home |
|
||||
|
|
||||
defaults.mailbox.maildir = "maildir:/var/vmail/%d/%u" |
|
||||
defaults.mailbox.homedir = "/var/vmail/" |
|
||||
|
|
||||
;minimum mailbox password length |
|
||||
defaults.mailbox.min_password_length = 8 |
|
||||
|
|
||||
; The password hashing function to use. Set to one of: |
|
||||
; |
|
||||
; "plain" - password stored as clear text |
|
||||
; "md5" - password hashed using MD5 without salt (PHP md5()) |
|
||||
; "md5.salted" - password hashed using MD5 with salt (see below) |
|
||||
; "sha1" - password hashed using sha1 without salt |
|
||||
; "sha1.salted" - password hashed using sha1 with salt defined below |
|
||||
; "crypt:XXX" - call the PHP crypt function (with random salt) where XXX is one of: md5, blowfish, sha256, sha512 |
|
||||
; "dovecot:XXX" - call the Dovecot password generator (see next option below) and use the |
|
||||
; scheme specified by XXX. To see available schemes, use 'dovecotpw -l' |
|
||||
; or 'doveadm pw -l' |
|
||||
|
|
||||
defaults.mailbox.password_scheme = "md5" |
|
||||
|
|
||||
; The path to (and initial option(s) if necessary) the Dovecot password generator. Typical |
|
||||
; values may be something like: |
|
||||
; |
|
||||
; "/usr/bin/doveadm pw" |
|
||||
; "/usr/bin/dovecotpw" |
|
||||
|
|
||||
defaults.mailbox.dovecot_pw_binary = "/usr/bin/doveadm pw" |
|
||||
|
|
||||
|
|
||||
|
|
||||
;; A "mailbox alias" will, for example add the following entry to |
|
||||
;; the alias table for a mailbox: name@example.com |
|
||||
;; |
|
||||
;; name@example.com -> name@example.com |
|
||||
;; |
|
||||
;; This is required for aliasing an entire domain. If in doubt, leave it enabled. |
|
||||
mailboxAliases = 1 |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Archiving-Mailboxes |
|
||||
|
|
||||
server_id = 1 |
|
||||
|
|
||||
;;Archive options |
|
||||
binary.path.chown_R = "/bin/chown -R" |
|
||||
binary.path.tar_cf = "/bin/tar -cf" |
|
||||
binary.path.tar_xf = "/bin/tar -xf" |
|
||||
binary.path.bzip2_q = "/bin/bzip2 -q" |
|
||||
binary.path.bunzip2_q = "/bin/bunzip2 -q" |
|
||||
binary.path.rm_rf = "/bin/rm -rf" |
|
||||
|
|
||||
archive.path = "/srv/archives" |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Enable mailbox deletion on the file system |
|
||||
; |
|
||||
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Deleting-Mailboxes |
|
||||
; |
|
||||
|
|
||||
mailbox_deletion_fs_enabled = false |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Export Mailbox Settings |
|
||||
; |
|
||||
; See: https://github.com/opensolutions/ViMbAdmin/wiki/Export-Settings |
|
||||
; |
|
||||
defaults.export_settings.disabled = true |
|
||||
|
|
||||
|
|
||||
;; Export settings alowed subnets |
|
||||
defaults.export_settings.allowed_subnet[] = "10." |
|
||||
defaults.export_settings.allowed_subnet[] = "192.168." |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; Settings email default values. |
|
||||
;; |
|
||||
;; Substituions are as follows: |
|
||||
;; |
|
||||
;; %d -> domain part of email address |
|
||||
;; %u -> user part of email address |
|
||||
;; $m -> full email address |
|
||||
;; |
|
||||
;; See (and skin) the following file to see how the below are used: |
|
||||
;; |
|
||||
;; views/mailbox/email/settings.phtml |
|
||||
;; |
|
||||
|
|
||||
server.smtp.enabled = 1 |
|
||||
server.smtp.host = "mail.%d" |
|
||||
server.smtp.user = "%m" |
|
||||
server.smtp.port = "465" |
|
||||
server.smtp.crypt = "SSL" |
|
||||
|
|
||||
server.pop3.enabled = 1 |
|
||||
server.pop3.host = "gpo.%d" |
|
||||
server.pop3.user = "%m" |
|
||||
server.pop3.port = "995" |
|
||||
server.pop3.crypt = "SSL" |
|
||||
|
|
||||
server.imap.enabled = 1 |
|
||||
server.imap.host = "gpo.%d" |
|
||||
server.imap.user = "%m" |
|
||||
server.imap.port = "993" |
|
||||
server.imap.crypt = "SSL" |
|
||||
|
|
||||
server.webmail.enabled = 1 |
|
||||
server.webmail.host = "https://webmail.%d" |
|
||||
server.webmail.user = "%m" |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; Identity |
|
||||
|
|
||||
identity.orgname = "Example Limited" |
|
||||
identity.name = "Example Support Team" |
|
||||
identity.email = "support@example.com" |
|
||||
identity.autobot.name = "ViMbAdmin Autobot" |
|
||||
identity.autobot.email = "autobot@example.com" |
|
||||
identity.mailer.name = "ViMbAdmin Autobot" |
|
||||
identity.mailer.email = "do-not-reply@example.com" |
|
||||
|
|
||||
identity.sitename = "ViMbAdmin" |
|
||||
identity.siteurl = "https://www.example.com/vimbadmin/" |
|
||||
|
|
||||
|
|
||||
;; |
|
||||
;; All mail and correspondence will come from the following;; |
|
||||
|
|
||||
server.email.name = "ViMbAdmin Administrator" |
|
||||
server.email.address = "support@example.com" |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; Skinning |
|
||||
;; |
|
||||
;; You can skin ViMbAdmin pages if you wish. |
|
||||
;; |
|
||||
;; See: https://github.com/opensolutions/ViMbAdmin/wiki/Skinning |
|
||||
|
|
||||
; resources.smarty.skin = "myskin" |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; See: http://framework.zend.com/manual/en/zend.mail.smtp-authentication.html |
|
||||
;; |
|
||||
;; Ensure you have a working mail server configuration so the system can |
|
||||
;; send emails: |
|
||||
;; |
|
||||
resources.mailer.smtphost = "localhost" |
|
||||
;resources.mailer.username = "" |
|
||||
;resources.mailer.password = "" |
|
||||
;resources.mailer.auth = "" |
|
||||
;resources.mailer.ssl = "" |
|
||||
;resources.mailer.port = "25" |
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; Local filesystem logging. |
|
||||
;; |
|
||||
;; We log various things to var/log/YYYY/MM/ if you enable the logger here. |
|
||||
;; |
|
||||
;; It is useful to use the email logger to be alerted of serious errors. |
|
||||
;; |
|
||||
|
|
||||
ondemand_resources.logger.enabled = 1 |
|
||||
|
|
||||
;ondemand_resources.logger.writers.email.from = "admin@example.com" |
|
||||
;ondemand_resources.logger.writers.email.to = "admin@example.com" |
|
||||
;ondemand_resources.logger.writers.email.prefix = "ViMbAdmin_Error" |
|
||||
;ondemand_resources.logger.writers.email.level = 3 |
|
||||
|
|
||||
ondemand_resources.logger.writers.stream.level = 7 |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; ViMbAdmin performs a version check on administrator login and alerts the |
|
||||
;; user if there is a newer version available. |
|
||||
;; |
|
||||
;; This can be disabled by setting the below to 1 |
|
||||
;; |
|
||||
|
|
||||
skipVersionCheck = 0 |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; ViMbAdmin 'pings' the developers as part of the set up process to let |
|
||||
;; them know there is a new installation. |
|
||||
;; |
|
||||
;; All we are interested in is knowing whether people are using the software |
|
||||
;; or not and whether continued support and development is worth the time |
|
||||
;; and effort. |
|
||||
;; |
|
||||
;; Unless you're very shy, PLEASE LET US KNOW YOU'RE USING IT! |
|
||||
;; |
|
||||
;; This can be disabled by setting the below to 1 |
|
||||
;; |
|
||||
|
|
||||
skipInstallPingback = 0 |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Allow admins to dictate whether a user can use BOTH, IMAP ONLY, |
|
||||
; POP3 ONLY when creating mailboxes. |
|
||||
; |
|
||||
; Must be supported by your POP3/IMAP server. |
|
||||
; |
|
||||
; See https://github.com/opensolutions/ViMbAdmin/wiki/POP3-IMAP-Access-Permissions |
|
||||
; for documentation. |
|
||||
; |
|
||||
; This is handled via a plugin |
|
||||
; |
|
||||
|
|
||||
vimbadmin_plugins.AccessPermissions.disabled = false |
|
||||
|
|
||||
; specify the options which should be allowed for access restrictions |
|
||||
vimbadmin_plugins.AccessPermissions.type.SMTP = "SMTP" |
|
||||
vimbadmin_plugins.AccessPermissions.type.IMAP = "IMAP" |
|
||||
vimbadmin_plugins.AccessPermissions.type.POP3 = "POP3" |
|
||||
vimbadmin_plugins.AccessPermissions.type.SIEVE = "SIEVE" |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;; |
|
||||
;; Proceed onwards with caution. |
|
||||
;; |
|
||||
;; The above [user] params are the may ones of consequence. |
|
||||
;; |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Allows to add additional information. |
|
||||
; |
|
||||
; This is handled via a plugin |
|
||||
; |
|
||||
|
|
||||
vimbadmin_plugins.AccessPermissions.disabled = false |
|
||||
vimbadmin_plugins.Jabber.disabled = true |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled = true |
|
||||
vimbadmin_plugins.SharedMailbox.disabled = true |
|
||||
vimbadmin_plugins.SOGo.disabled = true |
|
||||
|
|
||||
|
|
||||
vimbadmin_plugins.AdditionalInfo.disabled = true |
|
||||
vimbadmin_plugins.Addressbook.disabled = true |
|
||||
vimbadmin_plugins.Calendar.disabled = true |
|
||||
vimbadmin_plugins.RoundCube.disabled = true |
|
||||
|
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;;; Disabling directory entry subform element |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
|
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.JpegPhoto = true |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Mail = true |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.PreferredLanguage = true |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Secretary = true |
|
||||
|
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.PersonalTitle = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.GivenName = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Sn = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.DisplayName = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Initials = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.BusinesCategory = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.EmployeeType = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Title = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.DepartmentNumber = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Ou = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.RoomNumber = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.O = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.CarLicense = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.EmployeeNumber = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.HomePhone = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.TelephoneNumber = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Mobile = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Pager = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.FacsimileTelephoneNumber = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.HomePostalAddress = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.LabeledUri = false |
|
||||
vimbadmin_plugins.DirectoryEntry.disabled_elements.Manager = false |
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
;;; Mailbox AdditionalInfo plugin elements |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
|
|
||||
|
|
||||
;;Additional text messages for plugin. |
|
||||
AdditionalInfo.mailbox.formPreBlurb = "<p><strong>NB:</strong> Do not edit the following. It is sync'd on a nightly basis ..." |
|
||||
|
|
||||
; First Name |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.id.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.id.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.id.options.label = "LDAP Id" |
|
||||
|
|
||||
; First Name |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.first_name.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.first_name.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.first_name.options.label = "First Name" |
|
||||
|
|
||||
; Last Name |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.second_name.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.second_name.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.second_name.options.label = "Last Name" |
|
||||
|
|
||||
; Grade |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade.options.label = "Grade" |
|
||||
|
|
||||
; Grade Id |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade_id.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade_id.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade_id.options.label = "Grade Id" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade_id.options.validators.digits[] = 'Digits' |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.grade_id.options.validators.digits[] = true |
|
||||
|
|
||||
; Department |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department.options.label = "Department" |
|
||||
|
|
||||
; Department Id |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department_id.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department_id.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department_id.options.label = "Department Id" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department_id.options.validators.digits[] = 'Digits' |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.department_id.options.validators.digits[] = true |
|
||||
|
|
||||
; Section |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.section.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.section.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.section.options.label = "Section" |
|
||||
|
|
||||
; Extension Number |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.label = "Extension Number" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.validators.digits[] = 'Digits' |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.validators.digits[] = true |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.validators.length[] = 'StringLength' |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.validators.length[] = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.validators.length.range[] = 4 |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.validators.length.range[] = 4 |
|
||||
;;to disable autocomplete functionality |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.ext_no.options.autocomplete = 'off' |
|
||||
|
|
||||
; Direct Dial |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.d_dial.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.d_dial.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.d_dial.options.label = "Direct Dial" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.d_dial.options.autocomplete = 'off' |
|
||||
|
|
||||
; Mobile |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.mobile.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.mobile.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.mobile.options.label = "Mobile" |
|
||||
vimbadmin_plugins.AdditionalInfo.elements.mobile.options.autocomplete = 'off' |
|
||||
|
|
||||
;;;;;;; |
|
||||
;; Aliases additional information |
|
||||
;; |
|
||||
; First Name |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.name.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.name.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.name.options.label = "Name" |
|
||||
|
|
||||
; Extension Number |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.label = "Extension Number" |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.validators.digits[] = 'Digits' |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.validators.digits[] = true |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.validators.length[] = 'StringLength' |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.validators.length[] = false |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.validators.length.range[] = 4 |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.validators.length.range[] = 4 |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.ext_no.options.autocomplete = 'off' |
|
||||
|
|
||||
; Direct Dial |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.d_dial.type = "Zend_Form_Element_Text" |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.d_dial.options.required = false |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.d_dial.options.label = "Direct Dial" |
|
||||
vimbadmin_plugins.AdditionalInfo.alias.elements.d_dial.options.autocomplete = 'off' |
|
||||
|
|
||||
|
|
||||
[production : user] |
|
||||
|
|
||||
includePaths.library = APPLICATION_PATH "/../library" |
|
||||
includePaths.osslibrary = APPLICATION_PATH "/../vendor/opensolutions/oss-framework/src/" |
|
||||
|
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php" |
|
||||
bootstrap.class = "Bootstrap" |
|
||||
appnamespace = "ViMbAdmin" |
|
||||
|
|
||||
temporary_directory = APPLICATION_PATH "/../var/tmp" |
|
||||
|
|
||||
pluginPaths.OSS_Resource = APPLICATION_PATH "/../vendor/opensolutions/oss-framework/src/OSS/Resource" |
|
||||
pluginPaths.ViMbAdmin_Resource = APPLICATION_PATH "/../library/ViMbAdmin/Resource" |
|
||||
|
|
||||
mini_js = 1 |
|
||||
mini_css = 1 |
|
||||
|
|
||||
alias_autocomplete_min_length = 2 |
|
||||
|
|
||||
|
|
||||
|
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" |
|
||||
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" |
|
||||
resources.modules[] = |
|
||||
|
|
||||
|
|
||||
; doctrine2 |
|
||||
resources.doctrine2.models_path = APPLICATION_PATH |
|
||||
resources.doctrine2.proxies_path = APPLICATION_PATH "/Proxies" |
|
||||
resources.doctrine2.repositories_path = APPLICATION_PATH |
|
||||
resources.doctrine2.xml_schema_path = APPLICATION_PATH "/../doctrine2/xml" |
|
||||
resources.doctrine2.autogen_proxies = 0 |
|
||||
resources.doctrine2.logger = 1 |
|
||||
resources.doctrine2.models_namespace = "Entities" |
|
||||
resources.doctrine2.proxies_namespace = "Proxies" |
|
||||
resources.doctrine2.repositories_namespace = "Repositories" |
|
||||
|
|
||||
|
|
||||
resources.doctrine2cache.autoload_method = "composer" |
|
||||
;resources.doctrine2cache.type = 'ArrayCache' |
|
||||
;resources.doctrine2cache.type = 'MemcacheCache' |
|
||||
;resources.doctrine2cache.memcache.servers.0.host = '127.0.0.1' |
|
||||
;resources.doctrine2cache.memcache.servers.0.port = '11211' |
|
||||
;resources.doctrine2cache.memcache.servers.0.persistent = false |
|
||||
;resources.doctrine2cache.memcache.servers.0.weight = 1 |
|
||||
;resources.doctrine2cache.memcache.servers.0.timeout = 1 |
|
||||
;resources.doctrine2cache.memcache.servers.0.retry_int = 15 |
|
||||
|
|
||||
; resources.doctrine2cache.memcache.servers.1.host = 'xxx' |
|
||||
; resources.doctrine2cache.memcache.servers.2.host = 'yyy' |
|
||||
|
|
||||
resources.namespace.checkip = 0 |
|
||||
|
|
||||
resources.auth.enabled = 1 |
|
||||
resources.auth.oss.adapter = "OSS_Auth_Doctrine2Adapter" |
|
||||
resources.auth.oss.pwhash = "bcrypt" |
|
||||
resources.auth.oss.hash_cost = 9 |
|
||||
resources.auth.oss.entity = "\\Entities\\Admin" |
|
||||
resources.auth.oss.disabled.lost-username = 1 |
|
||||
resources.auth.oss.disabled.lost-password = 0 |
|
||||
|
|
||||
resources.auth.oss.rememberme.enabled = 1 |
|
||||
resources.auth.oss.rememberme.timeout = 2592000 |
|
||||
resources.auth.oss.rememberme.secure = true |
|
||||
|
|
||||
resources.auth.oss.lost_password.use_captcha = true |
|
||||
|
|
||||
resources.session.save_path = APPLICATION_PATH "/../var/session" |
|
||||
resources.session.use_only_cookies = true |
|
||||
resources.session.remember_me_seconds = 3600 |
|
||||
resources.session.name = 'VIMBADMIN3' |
|
||||
|
|
||||
ondemand_resources.logger.writers.stream.path = APPLICATION_PATH "/../var/log" |
|
||||
ondemand_resources.logger.writers.stream.owner = {{php_user}} |
|
||||
ondemand_resources.logger.writers.stream.group = {{php_user}} |
|
||||
ondemand_resources.logger.writers.stream.mode = single |
|
||||
ondemand_resources.logger.writers.stream.logname = vimbadmin.log |
|
||||
|
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
; Smarty View |
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
||||
|
|
||||
resources.smarty.enabled = 1 |
|
||||
resources.smarty.templates = APPLICATION_PATH "/views" |
|
||||
; resources.smarty.skin = "myskin" |
|
||||
resources.smarty.compiled = APPLICATION_PATH "/../var/templates_c" |
|
||||
resources.smarty.cache = APPLICATION_PATH "/../var/cache" |
|
||||
resources.smarty.config = APPLICATION_PATH "/configs/smarty" |
|
||||
resources.smarty.plugins[] = APPLICATION_PATH "/../library/ViMbAdmin/Smarty/functions" |
|
||||
resources.smarty.plugins[] = APPLICATION_PATH "/../vendor/opensolutions/oss-framework/src/OSS/Smarty/functions" |
|
||||
resources.smarty.plugins[] = APPLICATION_PATH "/../vendor/smarty/smarty/libs/plugins" |
|
||||
resources.smarty.plugins[] = APPLICATION_PATH "/../vendor/smarty/smarty/libs/sysplugins" |
|
||||
resources.smarty.debugging = 0 |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
[development : production] |
|
||||
|
|
||||
mini_js = 0 |
|
||||
mini_css = 0 |
|
||||
|
|
||||
phpSettings.display_startup_errors = 1 |
|
||||
phpSettings.display_errors = 1 |
|
||||
resources.frontController.params.displayExceptions = 1 |
|
@ -1,5 +0,0 @@ |
|||||
user = vimbadmin |
|
||||
password = {{password}} |
|
||||
hosts = {{host}} |
|
||||
dbname = vimbadmin |
|
||||
query = SELECT goto FROM alias WHERE address = '%s' AND active = '1' |
|
@ -1,5 +0,0 @@ |
|||||
user = vimbadmin |
|
||||
password = {{password}} |
|
||||
hosts = {{host}} |
|
||||
dbname = vimbadmin |
|
||||
query = SELECT domain FROM domain WHERE domain = '%s' AND backupmx = '0' AND active = '1' |
|
@ -1,7 +0,0 @@ |
|||||
user = vimbadmin |
|
||||
password = {{password}} |
|
||||
hosts = {{host}} |
|
||||
dbname = vimbadmin |
|
||||
table = mailbox |
|
||||
select_field = maildir |
|
||||
where_field = username |
|
@ -1,49 +0,0 @@ |
|||||
|
|
||||
server { |
|
||||
|
|
||||
{{#multisite}} |
|
||||
# Uncomment the following line for domain mapping |
|
||||
# listen 80 default_server; |
|
||||
{{/multisite}} |
|
||||
|
|
||||
server_name {{^vma}}{{^rc}}{{site_name}}{{/rc}}{{/vma}} {{#vma}}vma.*{{/vma}} {{#rc}}webmail.*{{/rc}} {{^vma}}{{^rc}}{{#multisite}}*{{/multisite}}{{^multisite}}www{{/multisite}}.{{site_name}}{{/rc}}{{/vma}}; |
|
||||
|
|
||||
{{#multisite}} |
|
||||
# Uncomment the following line for domain mapping |
|
||||
#server_name_in_redirect off; |
|
||||
{{/multisite}} |
|
||||
|
|
||||
access_log /var/log/nginx/{{site_name}}.access.log {{^wpredis}}{{^static}}rt_cache{{/static}}{{/wpredis}}{{#wpredis}}rt_cache_redis{{/wpredis}}; |
|
||||
error_log /var/log/nginx/{{site_name}}.error.log; |
|
||||
|
|
||||
{{#proxy}} |
|
||||
add_header X-Proxy-Cache $upstream_cache_status; |
|
||||
location / { |
|
||||
proxy_pass http://{{host}}:{{port}}; |
|
||||
proxy_redirect off; |
|
||||
proxy_set_header Host $host; |
|
||||
proxy_set_header X-Real-IP $remote_addr; |
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
||||
} |
|
||||
{{/proxy}} |
|
||||
|
|
||||
{{^proxy}} |
|
||||
{{^vma}}{{^rc}}root {{webroot}}/htdocs;{{/rc}}{{/vma}} |
|
||||
{{#vma}}root /var/www/22222/htdocs/vimbadmin/public;{{/vma}} |
|
||||
{{#rc}}root /var/www/roundcubemail/htdocs/;{{/rc}} |
|
||||
|
|
||||
{{^proxy}}index {{^static}}index.php{{/static}} index.html index.htm;{{/proxy}} |
|
||||
|
|
||||
{{#static}} |
|
||||
location / { |
|
||||
try_files $uri $uri/ =404; |
|
||||
} |
|
||||
{{/static}} |
|
||||
|
|
||||
{{^static}}include {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}}{{#wpredis}}common/redis.conf;{{/wpredis}} {{/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}}{{#wpredis}}common/redis-hhvm.conf;{{/wpredis}} {{/hhvm}} |
|
||||
{{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} |
|
||||
{{#wp}}include common/wpcommon.conf;{{/wp}} |
|
||||
{{^proxy}}include common/locations.conf;{{/proxy}} |
|
||||
{{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} |
|
||||
{{/proxy}} |
|
||||
} |
|
@ -1,31 +0,0 @@ |
|||||
|
|
||||
# W3TC NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $cache_uri $request_uri; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { |
|
||||
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass hhvm; |
|
||||
} |
|
@ -1,31 +0,0 @@ |
|||||
|
|
||||
# W3TC NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $cache_uri $request_uri; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { |
|
||||
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
} |
|
@ -1,35 +0,0 @@ |
|||||
# WordPress COMMON SETTINGS |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
# Limit access to avoid brute force attack |
|
||||
location = /wp-login.php { |
|
||||
limit_req zone=one burst=1 nodelay; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
} |
|
||||
# Disable wp-config.txt |
|
||||
location = /wp-config.txt { |
|
||||
deny all; |
|
||||
access_log off; |
|
||||
log_not_found off; |
|
||||
} |
|
||||
# Disallow php in upload folder |
|
||||
location /wp-content/uploads/ { |
|
||||
location ~ \.php$ { |
|
||||
#Prevent Direct Access Of PHP Files From Web Browsers |
|
||||
deny all; |
|
||||
} |
|
||||
} |
|
||||
# Yoast sitemap |
|
||||
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ { |
|
||||
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent; |
|
||||
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last; |
|
||||
# Rules for yoast sitemap with wp|wpsubdir|wpsubdomain |
|
||||
rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last; |
|
||||
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; |
|
||||
# Following lines are options. Needed for WordPress seo addons |
|
||||
rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last; |
|
||||
rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last; |
|
||||
rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last; |
|
||||
rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last; |
|
||||
access_log off; |
|
||||
} |
|
@ -1,37 +0,0 @@ |
|||||
# WPFC NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $skip_cache 0; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { |
|
||||
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass hhvm; |
|
||||
fastcgi_cache_bypass $skip_cache; |
|
||||
fastcgi_no_cache $skip_cache; |
|
||||
fastcgi_cache WORDPRESS; |
|
||||
} |
|
||||
location ~ /purge(/.*) { |
|
||||
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; |
|
||||
access_log off; |
|
||||
} |
|
@ -1,37 +0,0 @@ |
|||||
# WPFC NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $skip_cache 0; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { |
|
||||
set $skip_cache 1; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
try_files $uri $uri/ /index.php?$args; |
|
||||
} |
|
||||
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { |
|
||||
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
fastcgi_cache_bypass $skip_cache; |
|
||||
fastcgi_no_cache $skip_cache; |
|
||||
fastcgi_cache WORDPRESS; |
|
||||
} |
|
||||
location ~ /purge(/.*) { |
|
||||
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; |
|
||||
access_log off; |
|
||||
} |
|
@ -1,31 +0,0 @@ |
|||||
# WPSC NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $cache_uri $request_uri; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
# If we add index.php?$args its break WooCommerce like plugins |
|
||||
# Ref: #330 |
|
||||
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass hhvm; |
|
||||
# Following line is needed by WP Super Cache plugin |
|
||||
fastcgi_param SERVER_NAME $http_host; |
|
||||
} |
|
@ -1,31 +0,0 @@ |
|||||
# WPSC NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
set $cache_uri $request_uri; |
|
||||
# POST requests and URL with a query string should always go to php |
|
||||
if ($request_method = POST) { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
if ($query_string != "") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't cache URL containing the following segments |
|
||||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Don't use the cache for logged in users or recent commenter |
|
||||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { |
|
||||
set $cache_uri 'null cache'; |
|
||||
} |
|
||||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|
||||
location / { |
|
||||
# If we add index.php?$args its break WooCommerce like plugins |
|
||||
# Ref: #330 |
|
||||
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php; |
|
||||
} |
|
||||
location ~ \.php$ { |
|
||||
try_files $uri =404; |
|
||||
include fastcgi_params; |
|
||||
fastcgi_pass php; |
|
||||
# Following line is needed by WP Super Cache plugin |
|
||||
fastcgi_param SERVER_NAME $http_host; |
|
||||
} |
|
@ -1,10 +0,0 @@ |
|||||
# WPSUBDIRECTORY NGINX CONFIGURATION |
|
||||
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee) |
|
||||
if (!-e $request_filename) { |
|
||||
# Redirect wp-admin to wp-admin/ |
|
||||
rewrite /wp-admin$ $scheme://$host$uri/ permanent; |
|
||||
# Redirect wp-* files/folders |
|
||||
rewrite ^(/[^/]+)?(/wp-.*) $2 last; |
|
||||
# Redirect other php files |
|
||||
rewrite ^(/[^/]+)?(/.*\.php) $2 last; |
|
||||
} |
|
@ -1,48 +0,0 @@ |
|||||
"""EasyEngine SWAP creation""" |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.fileutils import EEFileUtils |
|
||||
from ee.core.aptget import EEAptGet |
|
||||
from ee.core.logging import Log |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
class EESwap(): |
|
||||
"""Manage Swap""" |
|
||||
|
|
||||
def __init__(): |
|
||||
"""Initialize """ |
|
||||
pass |
|
||||
|
|
||||
def add(self): |
|
||||
"""Swap addition with EasyEngine""" |
|
||||
if EEVariables.ee_ram < 512: |
|
||||
if EEVariables.ee_swap < 1000: |
|
||||
Log.info(self, "Adding SWAP file, please wait...") |
|
||||
|
|
||||
# Install dphys-swapfile |
|
||||
EEAptGet.update(self) |
|
||||
EEAptGet.install(self, ["dphys-swapfile"]) |
|
||||
# Stop service |
|
||||
EEShellExec.cmd_exec(self, "service dphys-swapfile stop") |
|
||||
# Remove Default swap created |
|
||||
EEShellExec.cmd_exec(self, "/sbin/dphys-swapfile uninstall") |
|
||||
|
|
||||
# Modify Swap configuration |
|
||||
if os.path.isfile("/etc/dphys-swapfile"): |
|
||||
EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", |
|
||||
"#CONF_SWAPFILE=/var/swap", |
|
||||
"CONF_SWAPFILE=/ee-swapfile") |
|
||||
EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", |
|
||||
"#CONF_MAXSWAP=2048", |
|
||||
"CONF_MAXSWAP=1024") |
|
||||
EEFileUtils.searchreplace(self, "/etc/dphys-swapfile", |
|
||||
"#CONF_SWAPSIZE=", |
|
||||
"CONF_SWAPSIZE=1024") |
|
||||
else: |
|
||||
with open("/etc/dphys-swapfile", 'w') as conffile: |
|
||||
conffile.write("CONF_SWAPFILE=/ee-swapfile\n" |
|
||||
"CONF_SWAPSIZE=1024\n" |
|
||||
"CONF_MAXSWAP=1024\n") |
|
||||
# Create swap file |
|
||||
EEShellExec.cmd_exec(self, "service dphys-swapfile start") |
|
@ -1,91 +0,0 @@ |
|||||
"""EasyEngine packages repository operations""" |
|
||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.variables import EEVariables |
|
||||
from ee.core.logging import Log |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
class EERepo(): |
|
||||
"""Manage Repositories""" |
|
||||
|
|
||||
def __init__(self): |
|
||||
"""Initialize """ |
|
||||
pass |
|
||||
|
|
||||
def add(self, repo_url=None, ppa=None): |
|
||||
""" |
|
||||
This function used to add apt repositories and or ppa's |
|
||||
If repo_url is provided adds repo file to |
|
||||
/etc/apt/sources.list.d/ |
|
||||
If ppa is provided add apt-repository using |
|
||||
add-apt-repository |
|
||||
command. |
|
||||
""" |
|
||||
|
|
||||
if repo_url is not None: |
|
||||
repo_file_path = ("/etc/apt/sources.list.d/" |
|
||||
+ EEVariables().ee_repo_file) |
|
||||
try: |
|
||||
if not os.path.isfile(repo_file_path): |
|
||||
with open(repo_file_path, |
|
||||
encoding='utf-8', mode='a') as repofile: |
|
||||
repofile.write(repo_url) |
|
||||
repofile.write('\n') |
|
||||
repofile.close() |
|
||||
elif repo_url not in open(repo_file_path, |
|
||||
encoding='utf-8').read(): |
|
||||
with open(repo_file_path, |
|
||||
encoding='utf-8', mode='a') as repofile: |
|
||||
repofile.write(repo_url) |
|
||||
repofile.write('\n') |
|
||||
repofile.close() |
|
||||
return True |
|
||||
except IOError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "File I/O error.") |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to add repo") |
|
||||
if ppa is not None: |
|
||||
EEShellExec.cmd_exec(self, "add-apt-repository -y '{ppa_name}'" |
|
||||
.format(ppa_name=ppa)) |
|
||||
|
|
||||
def remove(self, ppa=None, repo_url=None): |
|
||||
""" |
|
||||
This function used to remove ppa's |
|
||||
If ppa is provided adds repo file to |
|
||||
/etc/apt/sources.list.d/ |
|
||||
command. |
|
||||
""" |
|
||||
if ppa: |
|
||||
EEShellExec.cmd_exec(self, "add-apt-repository -y " |
|
||||
"--remove '{ppa_name}'" |
|
||||
.format(ppa_name=ppa)) |
|
||||
elif repo_url: |
|
||||
repo_file_path = ("/etc/apt/sources.list.d/" |
|
||||
+ EEVariables().ee_repo_file) |
|
||||
|
|
||||
try: |
|
||||
repofile = open(repo_file_path, "w+") |
|
||||
repofile.write(repofile.read().replace(repo_url, "")) |
|
||||
repofile.close() |
|
||||
except IOError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "File I/O error.") |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to remove repo") |
|
||||
|
|
||||
def add_key(self, keyids, keyserver=None): |
|
||||
""" |
|
||||
This function adds imports repository keys from keyserver. |
|
||||
default keyserver is hkp://keys.gnupg.net |
|
||||
user can provide other keyserver with keyserver="hkp://xyz" |
|
||||
""" |
|
||||
EEShellExec.cmd_exec(self, "gpg --keyserver {serv}" |
|
||||
.format(serv=(keyserver or |
|
||||
"hkp://keys.gnupg.net")) |
|
||||
+ " --recv-keys {key}".format(key=keyids)) |
|
||||
EEShellExec.cmd_exec(self, "gpg -a --export --armor {0}" |
|
||||
.format(keyids) |
|
||||
+ " | apt-key add - ") |
|
@ -1,197 +0,0 @@ |
|||||
"""EasyEngine package installation using apt-get module.""" |
|
||||
import apt |
|
||||
import apt_pkg |
|
||||
import sys |
|
||||
import subprocess |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.apt_repo import EERepo |
|
||||
from sh import apt_get |
|
||||
from sh import ErrorReturnCode |
|
||||
|
|
||||
|
|
||||
class EEAptGet(): |
|
||||
"""Generic apt-get intialisation""" |
|
||||
|
|
||||
def update(self): |
|
||||
""" |
|
||||
Similar to `apt-get update` |
|
||||
""" |
|
||||
try: |
|
||||
with open('/var/log/ee/ee.log', 'a') as f: |
|
||||
proc = subprocess.Popen('apt-get update', |
|
||||
shell=True, |
|
||||
stdin=None, stdout=f, |
|
||||
stderr=subprocess.PIPE, |
|
||||
executable="/bin/bash") |
|
||||
proc.wait() |
|
||||
output, error_output = proc.communicate() |
|
||||
|
|
||||
# Check what is error in error_output |
|
||||
if "NO_PUBKEY" in str(error_output): |
|
||||
# Split the output |
|
||||
Log.info(self, "Fixing missing GPG keys, please wait...") |
|
||||
error_list = str(error_output).split("\\n") |
|
||||
|
|
||||
# Use a loop to add misising keys |
|
||||
for single_error in error_list: |
|
||||
if "NO_PUBKEY" in single_error: |
|
||||
key = single_error.rsplit(None, 1)[-1] |
|
||||
EERepo.add_key(self, key, keyserver="hkp://pgp.mit.edu") |
|
||||
|
|
||||
proc = subprocess.Popen('apt-get update', |
|
||||
shell=True, |
|
||||
stdin=None, stdout=f, stderr=f, |
|
||||
executable="/bin/bash") |
|
||||
proc.wait() |
|
||||
|
|
||||
if proc.returncode == 0: |
|
||||
return True |
|
||||
else: |
|
||||
Log.info(self, Log.FAIL + "Oops Something went wrong!!") |
|
||||
Log.error(self, "Check logs for reason " |
|
||||
"`tail /var/log/ee/ee.log` & Try Again!!!") |
|
||||
|
|
||||
except Exception as e: |
|
||||
Log.error(self, "apt-get update exited with error") |
|
||||
|
|
||||
def check_upgrade(self): |
|
||||
""" |
|
||||
Similar to `apt-get upgrade` |
|
||||
""" |
|
||||
try: |
|
||||
check_update = subprocess.Popen(['apt-get upgrade -s | grep ' |
|
||||
'\"^Inst\" | wc -l'], |
|
||||
stdout=subprocess.PIPE, |
|
||||
shell=True).communicate()[0] |
|
||||
if check_update == b'0\n': |
|
||||
Log.error(self, "No package updates available") |
|
||||
Log.info(self, "Following package updates are available:") |
|
||||
subprocess.Popen("apt-get -s dist-upgrade | grep \"^Inst\"", |
|
||||
shell=True, executable="/bin/bash", |
|
||||
stdout=sys.stdout).communicate() |
|
||||
|
|
||||
except Exception as e: |
|
||||
Log.error(self, "Unable to check for packages upgrades") |
|
||||
|
|
||||
def dist_upgrade(self): |
|
||||
""" |
|
||||
Similar to `apt-get upgrade` |
|
||||
""" |
|
||||
try: |
|
||||
with open('/var/log/ee/ee.log', 'a') as f: |
|
||||
proc = subprocess.Popen("DEBIAN_FRONTEND=noninteractive " |
|
||||
"apt-get dist-upgrade -o " |
|
||||
"Dpkg::Options::=\"--force-confdef\"" |
|
||||
" -o " |
|
||||
"Dpkg::Options::=\"--force-confold\"" |
|
||||
" -y ", |
|
||||
shell=True, stdin=None, |
|
||||
stdout=f, stderr=f, |
|
||||
executable="/bin/bash") |
|
||||
proc.wait() |
|
||||
|
|
||||
if proc.returncode == 0: |
|
||||
return True |
|
||||
else: |
|
||||
Log.info(self, Log.FAIL + "Oops Something went " |
|
||||
"wrong!!") |
|
||||
Log.error(self, "Check logs for reason " |
|
||||
"`tail /var/log/ee/ee.log` & Try Again!!!") |
|
||||
except Exception as e: |
|
||||
Log.error(self, "Error while installing packages, " |
|
||||
"apt-get exited with error") |
|
||||
|
|
||||
def install(self, packages): |
|
||||
all_packages = ' '.join(packages) |
|
||||
try: |
|
||||
with open('/var/log/ee/ee.log', 'a') as f: |
|
||||
proc = subprocess.Popen("DEBIAN_FRONTEND=noninteractive " |
|
||||
"apt-get install -o " |
|
||||
"Dpkg::Options::=\"--force-confdef\"" |
|
||||
" -o " |
|
||||
"Dpkg::Options::=\"--force-confold\"" |
|
||||
" -y {0}" |
|
||||
.format(all_packages), shell=True, |
|
||||
stdin=None, stdout=f, stderr=f, |
|
||||
executable="/bin/bash") |
|
||||
proc.wait() |
|
||||
|
|
||||
if proc.returncode == 0: |
|
||||
return True |
|
||||
else: |
|
||||
Log.info(self, Log.FAIL + "Oops Something went " |
|
||||
"wrong!!") |
|
||||
Log.error(self, "Check logs for reason " |
|
||||
"`tail /var/log/ee/ee.log` & Try Again!!!") |
|
||||
|
|
||||
except Exception as e: |
|
||||
Log.info(self, Log.FAIL + "Oops Something went " |
|
||||
"wrong!!") |
|
||||
Log.error(self, "Check logs for reason " |
|
||||
"`tail /var/log/ee/ee.log` & Try Again!!!") |
|
||||
|
|
||||
def remove(self, packages, auto=False, purge=False): |
|
||||
all_packages = ' '.join(packages) |
|
||||
try: |
|
||||
with open('/var/log/ee/ee.log', 'a') as f: |
|
||||
if purge: |
|
||||
proc = subprocess.Popen('apt-get purge -y {0}' |
|
||||
.format(all_packages), shell=True, |
|
||||
stdin=None, stdout=f, stderr=f, |
|
||||
executable="/bin/bash") |
|
||||
else: |
|
||||
proc = subprocess.Popen('apt-get remove -y {0}' |
|
||||
.format(all_packages), shell=True, |
|
||||
stdin=None, stdout=f, stderr=f, |
|
||||
executable="/bin/bash") |
|
||||
proc.wait() |
|
||||
if proc.returncode == 0: |
|
||||
return True |
|
||||
else: |
|
||||
Log.info(self, Log.FAIL + "Oops Something went " |
|
||||
"wrong!!") |
|
||||
Log.error(self, "Check logs for reason " |
|
||||
"`tail /var/log/ee/ee.log` & Try Again!!!") |
|
||||
|
|
||||
except Exception as e: |
|
||||
Log.error(self, "Error while installing packages, " |
|
||||
"apt-get exited with error") |
|
||||
|
|
||||
def auto_clean(self): |
|
||||
""" |
|
||||
Similar to `apt-get autoclean` |
|
||||
""" |
|
||||
try: |
|
||||
orig_out = sys.stdout |
|
||||
sys.stdout = open(self.app.config.get('log.logging', 'file'), |
|
||||
encoding='utf-8', mode='a') |
|
||||
apt_get.autoclean("-y") |
|
||||
sys.stdout = orig_out |
|
||||
except ErrorReturnCode as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to apt-get autoclean") |
|
||||
|
|
||||
def auto_remove(self): |
|
||||
""" |
|
||||
Similar to `apt-get autoremove` |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Running apt-get autoremove") |
|
||||
apt_get.autoremove("-y") |
|
||||
except ErrorReturnCode as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to apt-get autoremove") |
|
||||
|
|
||||
def is_installed(self, package_name): |
|
||||
""" |
|
||||
Checks if package is available in cache and is installed or not |
|
||||
returns True if installed otherwise returns False |
|
||||
""" |
|
||||
apt_cache = apt.cache.Cache() |
|
||||
apt_cache.open() |
|
||||
if (package_name.strip() in apt_cache and |
|
||||
apt_cache[package_name.strip()].is_installed): |
|
||||
# apt_cache.close() |
|
||||
return True |
|
||||
# apt_cache.close() |
|
||||
return False |
|
@ -1,23 +0,0 @@ |
|||||
from ee.core.shellexec import EEShellExec |
|
||||
from ee.core.variables import EEVariables |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
def check_fqdn(self, ee_host): |
|
||||
"""FQDN check with EasyEngine, for mail server hostname must be FQDN""" |
|
||||
# ee_host=os.popen("hostname -f | tr -d '\n'").read() |
|
||||
if '.' in ee_host: |
|
||||
EEVariables.ee_fqdn = ee_host |
|
||||
with open('/etc/hostname', encoding='utf-8', mode='w') as hostfile: |
|
||||
hostfile.write(ee_host) |
|
||||
|
|
||||
EEShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts" |
|
||||
.format(ee_host)) |
|
||||
if EEVariables.ee_platform_distro == 'debian': |
|
||||
EEShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start") |
|
||||
else: |
|
||||
EEShellExec.cmd_exec(self, "service hostname restart") |
|
||||
|
|
||||
else: |
|
||||
ee_host = input("Enter hostname [fqdn]:") |
|
||||
check_fqdn(self, ee_host) |
|
@ -1,28 +0,0 @@ |
|||||
"""EasyEngine generic database creation module""" |
|
||||
from sqlalchemy import create_engine |
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker |
|
||||
from sqlalchemy.ext.declarative import declarative_base |
|
||||
from ee.core.variables import EEVariables |
|
||||
|
|
||||
# db_path = self.app.config.get('site', 'db_path') |
|
||||
engine = create_engine(EEVariables.ee_db_uri, convert_unicode=True) |
|
||||
db_session = scoped_session(sessionmaker(autocommit=False, |
|
||||
autoflush=False, |
|
||||
bind=engine)) |
|
||||
Base = declarative_base() |
|
||||
Base.query = db_session.query_property() |
|
||||
|
|
||||
|
|
||||
def init_db(app): |
|
||||
""" |
|
||||
Initializes and creates all tables from models into the database |
|
||||
""" |
|
||||
# import all modules here that might define models so that |
|
||||
# they will be registered properly on the metadata. Otherwise |
|
||||
# # you will have to import them first before calling init_db() |
|
||||
# import ee.core.models |
|
||||
try: |
|
||||
app.log.info("Initializing EasyEngine Database") |
|
||||
Base.metadata.create_all(bind=engine) |
|
||||
except Exception as e: |
|
||||
app.log.debug("{0}".format(e)) |
|
@ -1,24 +0,0 @@ |
|||||
"""EasyEngine domain validation module.""" |
|
||||
from urllib.parse import urlparse |
|
||||
|
|
||||
|
|
||||
def ValidateDomain(url): |
|
||||
""" |
|
||||
This function returns domain name removing http:// and https:// |
|
||||
returns domain name only with or without www as user provided. |
|
||||
""" |
|
||||
|
|
||||
# Check if http:// or https:// present remove it if present |
|
||||
domain_name = url.split('/') |
|
||||
if 'http:' in domain_name or 'https:' in domain_name: |
|
||||
domain_name = domain_name[2] |
|
||||
else: |
|
||||
domain_name = domain_name[0] |
|
||||
www_domain_name = domain_name.split('.') |
|
||||
final_domain = '' |
|
||||
if www_domain_name[0] == 'www': |
|
||||
final_domain = '.'.join(www_domain_name[1:]) |
|
||||
else: |
|
||||
final_domain = domain_name |
|
||||
|
|
||||
return (final_domain, domain_name) |
|
@ -1,43 +0,0 @@ |
|||||
"""EasyEngine download core classes.""" |
|
||||
import urllib.request |
|
||||
import urllib.error |
|
||||
import os |
|
||||
from ee.core.logging import Log |
|
||||
|
|
||||
|
|
||||
class EEDownload(): |
|
||||
"""Method to download using urllib""" |
|
||||
def __init__(): |
|
||||
pass |
|
||||
|
|
||||
def download(self, packages): |
|
||||
"""Download packages, packges must be list in format of |
|
||||
[url, path, package name]""" |
|
||||
for package in packages: |
|
||||
url = package[0] |
|
||||
filename = package[1] |
|
||||
pkg_name = package[2] |
|
||||
try: |
|
||||
directory = os.path.dirname(filename) |
|
||||
if not os.path.exists(directory): |
|
||||
os.makedirs(directory) |
|
||||
Log.info(self, "Downloading {0:20}".format(pkg_name), end=' ') |
|
||||
urllib.request.urlretrieve(url, filename) |
|
||||
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" |
|
||||
+ Log.OKBLUE + "]")) |
|
||||
except urllib.error.URLError as e: |
|
||||
Log.debug(self, "[{err}]".format(err=str(e.reason))) |
|
||||
Log.error(self, "Unable to download file, {0}" |
|
||||
.format(filename)) |
|
||||
return False |
|
||||
except urllib.error.HTTPError as e: |
|
||||
Log.error(self, "Package download failed. {0}" |
|
||||
.format(pkg_name)) |
|
||||
Log.debug(self, "[{err}]".format(err=str(e.reason))) |
|
||||
return False |
|
||||
except urllib.error.ContentTooShortError as e: |
|
||||
Log.debug(self, "{0}{1}".format(e.errno, e.strerror)) |
|
||||
Log.error(self, "Package download failed. The amount of the" |
|
||||
" downloaded data is less than " |
|
||||
"the expected amount \{0} ".format(pkg_name)) |
|
||||
return False |
|
@ -1,26 +0,0 @@ |
|||||
"""EasyEngine exception classes.""" |
|
||||
|
|
||||
|
|
||||
class EEError(Exception): |
|
||||
"""Generic errors.""" |
|
||||
def __init__(self, msg): |
|
||||
Exception.__init__(self) |
|
||||
self.msg = msg |
|
||||
|
|
||||
def __str__(self): |
|
||||
return self.msg |
|
||||
|
|
||||
|
|
||||
class EEConfigError(EEError): |
|
||||
"""Config related errors.""" |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EERuntimeError(EEError): |
|
||||
"""Generic runtime errors.""" |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEArgumentError(EEError): |
|
||||
"""Argument related errors.""" |
|
||||
pass |
|
@ -1,21 +0,0 @@ |
|||||
"""EasyEngine extarct core classes.""" |
|
||||
import tarfile |
|
||||
import os |
|
||||
from ee.core.logging import Log |
|
||||
|
|
||||
|
|
||||
class EEExtract(): |
|
||||
"""Method to extract from tar.gz file""" |
|
||||
|
|
||||
def extract(self, file, path): |
|
||||
"""Function to extract tar.gz file""" |
|
||||
try: |
|
||||
tar = tarfile.open(file) |
|
||||
tar.extractall(path=path) |
|
||||
tar.close() |
|
||||
os.remove(file) |
|
||||
return True |
|
||||
except tarfile.TarError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, 'Unable to extract file \{0}'.format(file)) |
|
||||
return False |
|
@ -1,245 +0,0 @@ |
|||||
"""EasyEngine file utils core classes.""" |
|
||||
import shutil |
|
||||
import os |
|
||||
import sys |
|
||||
import glob |
|
||||
import shutil |
|
||||
import pwd |
|
||||
import fileinput |
|
||||
from ee.core.logging import Log |
|
||||
|
|
||||
|
|
||||
class EEFileUtils(): |
|
||||
"""Utilities to operate on files""" |
|
||||
def __init__(): |
|
||||
pass |
|
||||
|
|
||||
def remove(self, filelist): |
|
||||
"""remove files from given path""" |
|
||||
for file in filelist: |
|
||||
if os.path.isfile(file): |
|
||||
Log.info(self, "Removing {0:65}".format(file), end=' ') |
|
||||
os.remove(file) |
|
||||
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" + |
|
||||
Log.OKBLUE + "]")) |
|
||||
Log.debug(self, 'file Removed') |
|
||||
if os.path.isdir(file): |
|
||||
try: |
|
||||
Log.info(self, "Removing {0:65}".format(file), end=' ') |
|
||||
shutil.rmtree(file) |
|
||||
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" + |
|
||||
Log.OKBLUE + "]")) |
|
||||
except shutil.Error as e: |
|
||||
Log.debug(self, "{err}".format(err=str(e.reason))) |
|
||||
Log.error(self, 'Unable to Remove file ') |
|
||||
|
|
||||
def create_symlink(self, paths, errormsg=''): |
|
||||
""" |
|
||||
Create symbolic links provided in list with first as source |
|
||||
and second as destination |
|
||||
""" |
|
||||
src = paths[0] |
|
||||
dst = paths[1] |
|
||||
if not os.path.islink(dst): |
|
||||
try: |
|
||||
Log.debug(self, "Creating Symbolic link, Source:{0}, Dest:{1}" |
|
||||
.format(src, dst)) |
|
||||
os.symlink(src, dst) |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}{1}".format(e.errno, e.strerror)) |
|
||||
Log.error(self, "Unable to create symbolic link ...\n ") |
|
||||
else: |
|
||||
Log.debug(self, "Destination: {0} exists".format(dst)) |
|
||||
|
|
||||
def remove_symlink(self, filepath): |
|
||||
""" |
|
||||
Removes symbolic link for the path provided with filepath |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Removing symbolic link: {0}".format(filepath)) |
|
||||
os.unlink(filepath) |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to reomove symbolic link ...\n") |
|
||||
|
|
||||
def copyfile(self, src, dest): |
|
||||
""" |
|
||||
Copies files: |
|
||||
src : source path |
|
||||
dest : destination path |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Copying file, Source:{0}, Dest:{1}" |
|
||||
.format(src, dest)) |
|
||||
shutil.copy2(src, dest) |
|
||||
except shutil.Error as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, 'Unable to copy file from {0} to {1}' |
|
||||
.format(src, dest)) |
|
||||
except IOError as e: |
|
||||
Log.debug(self, "{e}".format(e.strerror)) |
|
||||
Log.error(self, "Unable to copy file from {0} to {1}" |
|
||||
.format(src, dest)) |
|
||||
|
|
||||
def searchreplace(self, fnm, sstr, rstr): |
|
||||
""" |
|
||||
Search replace strings in file |
|
||||
fnm : filename |
|
||||
sstr: search string |
|
||||
rstr: replace string |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Doning search and replace, File:{0}," |
|
||||
"Source string:{1}, Dest String:{2}" |
|
||||
.format(fnm, sstr, rstr)) |
|
||||
for line in fileinput.input(fnm, inplace=True): |
|
||||
print(line.replace(sstr, rstr), end='') |
|
||||
fileinput.close() |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to search {0} and replace {1} {2}" |
|
||||
.format(fnm, sstr, rstr)) |
|
||||
|
|
||||
def mvfile(self, src, dst): |
|
||||
""" |
|
||||
Moves file from source path to destination path |
|
||||
src : source path |
|
||||
dst : Destination path |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Moving file from {0} to {1}".format(src, dst)) |
|
||||
shutil.move(src, dst) |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{err}".format(err=e)) |
|
||||
Log.error(self, 'Unable to move file from {0} to {1}' |
|
||||
.format(src, dst)) |
|
||||
|
|
||||
def chdir(self, path): |
|
||||
""" |
|
||||
Change Directory to path specified |
|
||||
Path : path for destination directory |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Changing directory to {0}" |
|
||||
.format(path)) |
|
||||
os.chdir(path) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{err}".format(err=e.strerror)) |
|
||||
Log.error(self, 'Unable to Change Directory {0}'.format(path)) |
|
||||
|
|
||||
def chown(self, path, user, group, recursive=False): |
|
||||
""" |
|
||||
Change Owner for files |
|
||||
change owner for file with path specified |
|
||||
user: username of owner |
|
||||
group: group of owner |
|
||||
recursive: if recursive is True change owner for all |
|
||||
files in directory |
|
||||
""" |
|
||||
userid = pwd.getpwnam(user)[2] |
|
||||
groupid = pwd.getpwnam(user)[3] |
|
||||
try: |
|
||||
Log.debug(self, "Changing ownership of {0}, Userid:{1},Groupid:{2}" |
|
||||
.format(path, userid, groupid)) |
|
||||
# Change inside files/directory permissions only if recursive flag |
|
||||
# is set |
|
||||
if recursive: |
|
||||
for root, dirs, files in os.walk(path): |
|
||||
for d in dirs: |
|
||||
os.chown(os.path.join(root, d), userid, |
|
||||
groupid) |
|
||||
for f in files: |
|
||||
os.chown(os.path.join(root, f), userid, |
|
||||
groupid) |
|
||||
os.chown(path, userid, groupid) |
|
||||
except shutil.Error as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to change owner : {0}".format(path)) |
|
||||
except Exception as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to change owner : {0} ".format(path)) |
|
||||
|
|
||||
def chmod(self, path, perm, recursive=False): |
|
||||
""" |
|
||||
Changes Permission for files |
|
||||
path : file path permission to be changed |
|
||||
perm : permissions to be given |
|
||||
recursive: change permission recursively for all files |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Changing permission of {0}, Perm:{1}" |
|
||||
.format(path, perm)) |
|
||||
if recursive: |
|
||||
for root, dirs, files in os.walk(path): |
|
||||
for d in dirs: |
|
||||
os.chmod(os.path.join(root, d), perm) |
|
||||
for f in files: |
|
||||
os.chmod(os.path.join(root, f), perm) |
|
||||
else: |
|
||||
os.chmod(path, perm) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e.strerror)) |
|
||||
Log.error(self, "Unable to change owner : {0}".format(path)) |
|
||||
|
|
||||
def mkdir(self, path): |
|
||||
""" |
|
||||
create directories. |
|
||||
path : path for directory to be created |
|
||||
Similar to `mkdir -p` |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Creating directories: {0}" |
|
||||
.format(path)) |
|
||||
os.makedirs(path) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e.strerror)) |
|
||||
Log.error(self, "Unable to create directory {0} ".format(path)) |
|
||||
|
|
||||
def isexist(self, path): |
|
||||
""" |
|
||||
Check if file exist on given path |
|
||||
""" |
|
||||
try: |
|
||||
if os.path.exists(path): |
|
||||
return (True) |
|
||||
else: |
|
||||
return (False) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e.strerror)) |
|
||||
Log.error(self, "Unable to check path {0}".format(path)) |
|
||||
|
|
||||
def grep(self, fnm, sstr): |
|
||||
""" |
|
||||
Searches for string in file and returns the matched line. |
|
||||
""" |
|
||||
try: |
|
||||
Log.debug(self, "Finding string {0} to file {1}" |
|
||||
.format(sstr, fnm)) |
|
||||
for line in open(fnm, encoding='utf-8'): |
|
||||
if sstr in line: |
|
||||
return line |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e.strerror)) |
|
||||
Log.error(self, "Unable to Search string {0} in {1}" |
|
||||
.format(sstr, fnm)) |
|
||||
|
|
||||
def rm(self, path): |
|
||||
""" |
|
||||
Remove files |
|
||||
""" |
|
||||
Log.debug(self, "Removing {0}".format(path)) |
|
||||
if EEFileUtils.isexist(self, path): |
|
||||
try: |
|
||||
if os.path.isdir(path): |
|
||||
shutil.rmtree(path) |
|
||||
else: |
|
||||
os.remove(path) |
|
||||
except shutil.Error as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to remove directory : {0} " |
|
||||
.format(path)) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to remove file : {0} " |
|
||||
.format(path)) |
|
@ -1,57 +0,0 @@ |
|||||
"""EasyEngine GIT module""" |
|
||||
from sh import git, ErrorReturnCode |
|
||||
from ee.core.logging import Log |
|
||||
import os |
|
||||
|
|
||||
|
|
||||
class EEGit: |
|
||||
"""Intialization of core variables""" |
|
||||
def ___init__(): |
|
||||
# TODO method for core variables |
|
||||
pass |
|
||||
|
|
||||
def add(self, paths, msg="Intializating"): |
|
||||
""" |
|
||||
Initializes Directory as repository if not already git repo. |
|
||||
and adds uncommited changes automatically |
|
||||
""" |
|
||||
for path in paths: |
|
||||
global git |
|
||||
git = git.bake("--git-dir={0}/.git".format(path), |
|
||||
"--work-tree={0}".format(path)) |
|
||||
if os.path.isdir(path): |
|
||||
if not os.path.isdir(path+"/.git"): |
|
||||
try: |
|
||||
Log.debug(self, "EEGit: git init at {0}" |
|
||||
.format(path)) |
|
||||
git.init(path) |
|
||||
except ErrorReturnCode as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to git init at {0}" |
|
||||
.format(path)) |
|
||||
status = git.status("-s") |
|
||||
if len(status.splitlines()) > 0: |
|
||||
try: |
|
||||
Log.debug(self, "EEGit: git commit at {0}" |
|
||||
.format(path)) |
|
||||
git.add("--all") |
|
||||
git.commit("-am {0}".format(msg)) |
|
||||
except ErrorReturnCode as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "Unable to git commit at {0} " |
|
||||
.format(path)) |
|
||||
else: |
|
||||
Log.debug(self, "EEGit: Path {0} not present".format(path)) |
|
||||
|
|
||||
def checkfilestatus(self, repo, filepath): |
|
||||
""" |
|
||||
Checks status of file, If its tracked or untracked. |
|
||||
""" |
|
||||
global git |
|
||||
git = git.bake("--git-dir={0}/.git".format(repo), |
|
||||
"--work-tree={0}".format(repo)) |
|
||||
status = git.status("-s", "{0}".format(filepath)) |
|
||||
if len(status.splitlines()) > 0: |
|
||||
return True |
|
||||
else: |
|
||||
return False |
|
@ -1,47 +0,0 @@ |
|||||
"""EasyEngine log module""" |
|
||||
|
|
||||
|
|
||||
class Log: |
|
||||
""" |
|
||||
Logs messages with colors for different messages |
|
||||
according to functions |
|
||||
""" |
|
||||
HEADER = '\033[95m' |
|
||||
OKBLUE = '\033[94m' |
|
||||
OKGREEN = '\033[92m' |
|
||||
WARNING = '\033[93m' |
|
||||
FAIL = '\033[91m' |
|
||||
ENDC = '\033[0m' |
|
||||
BOLD = '\033[1m' |
|
||||
UNDERLINE = '\033[4m' |
|
||||
|
|
||||
def error(self, msg, exit=True): |
|
||||
""" |
|
||||
Logs error into log file |
|
||||
""" |
|
||||
print(Log.FAIL + msg + Log.ENDC) |
|
||||
self.app.log.error(Log.FAIL + msg + Log.ENDC) |
|
||||
if exit: |
|
||||
self.app.close(1) |
|
||||
|
|
||||
def info(self, msg, end='\n', log=True): |
|
||||
""" |
|
||||
Logs info messages into log file |
|
||||
""" |
|
||||
|
|
||||
print(Log.OKBLUE + msg + Log.ENDC, end=end) |
|
||||
if log: |
|
||||
self.app.log.info(Log.OKBLUE + msg + Log.ENDC) |
|
||||
|
|
||||
def warn(self, msg): |
|
||||
""" |
|
||||
Logs warning into log file |
|
||||
""" |
|
||||
print(Log.WARNING + msg + Log.ENDC) |
|
||||
self.app.log.warn(Log.BOLD + msg + Log.ENDC) |
|
||||
|
|
||||
def debug(self, msg): |
|
||||
""" |
|
||||
Logs debug messages into log file |
|
||||
""" |
|
||||
self.app.log.debug(Log.HEADER + msg + Log.ENDC) |
|
@ -1,195 +0,0 @@ |
|||||
|
|
||||
""" |
|
||||
Real time log files watcher supporting log rotation. |
|
||||
""" |
|
||||
|
|
||||
import os |
|
||||
import time |
|
||||
import errno |
|
||||
import stat |
|
||||
from ee.core.logging import Log |
|
||||
|
|
||||
|
|
||||
class LogWatcher(object): |
|
||||
"""Looks for changes in all files of a directory. |
|
||||
This is useful for watching log file changes in real-time. |
|
||||
It also supports files rotation. |
|
||||
|
|
||||
Example: |
|
||||
|
|
||||
>>> def callback(filename, lines): |
|
||||
... print filename, lines |
|
||||
... |
|
||||
>>> l = LogWatcher("/var/www/example.com/logs", callback) |
|
||||
>>> l.loop() |
|
||||
""" |
|
||||
|
|
||||
def __init__(self, filelist, callback, extensions=["log"], tail_lines=0): |
|
||||
"""Arguments: |
|
||||
|
|
||||
(str) @folder: |
|
||||
the folder to watch |
|
||||
|
|
||||
(callable) @callback: |
|
||||
a function which is called every time a new line in a |
|
||||
file being watched is found; |
|
||||
this is called with "filename" and "lines" arguments. |
|
||||
|
|
||||
(list) @extensions: |
|
||||
only watch files with these extensions |
|
||||
|
|
||||
(int) @tail_lines: |
|
||||
read last N lines from files being watched before starting |
|
||||
""" |
|
||||
self.files_map = {} |
|
||||
self.filelist = filelist |
|
||||
self.callback = callback |
|
||||
# self.folder = os.path.realpath(folder) |
|
||||
self.extensions = extensions |
|
||||
# assert (os.path.isdir(self.folder), "%s does not exists" |
|
||||
# % self.folder) |
|
||||
for file in self.filelist: |
|
||||
assert (os.path.isfile(file)) |
|
||||
assert callable(callback) |
|
||||
self.update_files() |
|
||||
# The first time we run the script we move all file markers at EOF. |
|
||||
# In case of files created afterwards we don't do this. |
|
||||
for id, file in list(iter(self.files_map.items())): |
|
||||
file.seek(os.path.getsize(file.name)) # EOF |
|
||||
if tail_lines: |
|
||||
lines = self.tail(file.name, tail_lines) |
|
||||
if lines: |
|
||||
self.callback(file.name, lines) |
|
||||
|
|
||||
def __del__(self): |
|
||||
self.close() |
|
||||
|
|
||||
def loop(self, interval=0.1, async=False): |
|
||||
"""Start the loop. |
|
||||
If async is True make one loop then return. |
|
||||
""" |
|
||||
while 1: |
|
||||
self.update_files() |
|
||||
for fid, file in list(iter(self.files_map.items())): |
|
||||
self.readfile(file) |
|
||||
if async: |
|
||||
return |
|
||||
time.sleep(interval) |
|
||||
|
|
||||
def log(self, line): |
|
||||
"""Log when a file is un/watched""" |
|
||||
print(line) |
|
||||
|
|
||||
# def listdir(self): |
|
||||
# """List directory and filter files by extension. |
|
||||
# You may want to override this to add extra logic or |
|
||||
# globbling support. |
|
||||
# """ |
|
||||
# ls = os.listdir(self.folder) |
|
||||
# if self.extensions: |
|
||||
# return ([x for x in ls if os.path.splitext(x)[1][1:] |
|
||||
# in self.extensions]) |
|
||||
# else: |
|
||||
# return ls |
|
||||
|
|
||||
@staticmethod |
|
||||
def tail(fname, window): |
|
||||
"""Read last N lines from file fname.""" |
|
||||
try: |
|
||||
f = open(fname, encoding='utf-8', mode='r') |
|
||||
except IOError as err: |
|
||||
if err.errno == errno.ENOENT: |
|
||||
return [] |
|
||||
else: |
|
||||
raise |
|
||||
else: |
|
||||
BUFSIZ = 1024 |
|
||||
f.seek(0, os.SEEK_END) |
|
||||
fsize = f.tell() |
|
||||
block = -1 |
|
||||
data = "" |
|
||||
exit = False |
|
||||
while not exit: |
|
||||
step = (block * BUFSIZ) |
|
||||
if abs(step) >= fsize: |
|
||||
f.seek(0) |
|
||||
exit = True |
|
||||
else: |
|
||||
f.seek(step, os.SEEK_END) |
|
||||
data = f.read().strip() |
|
||||
if data.count('\n') >= window: |
|
||||
break |
|
||||
else: |
|
||||
block -= 1 |
|
||||
return data.splitlines()[-window:] |
|
||||
|
|
||||
def update_files(self): |
|
||||
ls = [] |
|
||||
for name in self.filelist: |
|
||||
absname = os.path.realpath(os.path.join(name)) |
|
||||
try: |
|
||||
st = os.stat(absname) |
|
||||
except EnvironmentError as err: |
|
||||
if err.errno != errno.ENOENT: |
|
||||
raise |
|
||||
else: |
|
||||
if not stat.S_ISREG(st.st_mode): |
|
||||
continue |
|
||||
fid = self.get_file_id(st) |
|
||||
ls.append((fid, absname)) |
|
||||
|
|
||||
# check existent files |
|
||||
for fid, file in list(iter(self.files_map.items())): |
|
||||
# next(iter(graph.items())) |
|
||||
try: |
|
||||
st = os.stat(file.name) |
|
||||
except EnvironmentError as err: |
|
||||
if err.errno == errno.ENOENT: |
|
||||
self.unwatch(file, fid) |
|
||||
else: |
|
||||
raise |
|
||||
else: |
|
||||
if fid != self.get_file_id(st): |
|
||||
# same name but different file (rotation); reload it. |
|
||||
self.unwatch(file, fid) |
|
||||
self.watch(file.name) |
|
||||
|
|
||||
# add new ones |
|
||||
for fid, fname in ls: |
|
||||
if fid not in self.files_map: |
|
||||
self.watch(fname) |
|
||||
|
|
||||
def readfile(self, file): |
|
||||
lines = file.readlines() |
|
||||
if lines: |
|
||||
self.callback(file.name, lines) |
|
||||
|
|
||||
def watch(self, fname): |
|
||||
try: |
|
||||
file = open(fname, encoding='utf-8', mode='r') |
|
||||
fid = self.get_file_id(os.stat(fname)) |
|
||||
except EnvironmentError as err: |
|
||||
if err.errno != errno.ENOENT: |
|
||||
raise |
|
||||
else: |
|
||||
self.log("watching logfile %s" % fname) |
|
||||
self.files_map[fid] = file |
|
||||
|
|
||||
def unwatch(self, file, fid): |
|
||||
# file no longer exists; if it has been renamed |
|
||||
# try to read it for the last time in case the |
|
||||
# log rotator has written something in it. |
|
||||
lines = self.readfile(file) |
|
||||
self.log("un-watching logfile %s" % file.name) |
|
||||
del self.files_map[fid] |
|
||||
if lines: |
|
||||
self.callback(file.name, lines) |
|
||||
|
|
||||
@staticmethod |
|
||||
def get_file_id(st): |
|
||||
return "%xg%x" % (st.st_dev, st.st_ino) |
|
||||
|
|
||||
def close(self): |
|
||||
for id, file in list(iter(self.files_map.items())): |
|
||||
file.close() |
|
||||
self.files_map.clear() |
|
@ -1,137 +0,0 @@ |
|||||
"""EasyEngine MySQL core classes.""" |
|
||||
import pymysql |
|
||||
from pymysql import connections, DatabaseError, Error |
|
||||
import configparser |
|
||||
from os.path import expanduser |
|
||||
import sys |
|
||||
import os |
|
||||
from ee.core.logging import Log |
|
||||
from ee.core.variables import EEVariables |
|
||||
|
|
||||
|
|
||||
class MySQLConnectionError(Exception): |
|
||||
"""Custom Exception when MySQL server Not Connected""" |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class StatementExcecutionError(Exception): |
|
||||
"""Custom Exception when any Query Fails to execute""" |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class DatabaseNotExistsError(Exception): |
|
||||
"""Custom Exception when Database not Exist""" |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEMysql(): |
|
||||
"""Method for MySQL connection""" |
|
||||
|
|
||||
def connect(self): |
|
||||
"""Makes connection with MySQL server""" |
|
||||
try: |
|
||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'): |
|
||||
connection = pymysql.connect(read_default_file='/etc/mysql/conf.d/my.cnf') |
|
||||
else: |
|
||||
connection = pymysql.connect(read_default_file='~/.my.cnf') |
|
||||
return connection |
|
||||
except ValueError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise MySQLConnectionError |
|
||||
except pymysql.err.InternalError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise MySQLConnectionError |
|
||||
|
|
||||
def dbConnection(self, db_name): |
|
||||
try: |
|
||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'): |
|
||||
connection = pymysql.connect(db=db_name,read_default_file='/etc/mysql/conf.d/my.cnf') |
|
||||
else: |
|
||||
connection = pymysql.connect(db=db_name,read_default_file='~/.my.cnf') |
|
||||
|
|
||||
return connection |
|
||||
except DatabaseError as e: |
|
||||
if e.args[1] == '#42000Unknown database \'{0}\''.format(db_name): |
|
||||
raise DatabaseNotExistsError |
|
||||
else: |
|
||||
raise MySQLConnectionError |
|
||||
except pymysql.err.InternalError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise MySQLConnectionError |
|
||||
except Exception as e : |
|
||||
Log.debug(self, "[Error]Setting up database: \'" + str(e) + "\'") |
|
||||
raise MySQLConnectionError |
|
||||
|
|
||||
def execute(self, statement, errormsg='', log=True): |
|
||||
"""Get login details from /etc/mysql/conf.d/my.cnf & Execute MySQL query""" |
|
||||
connection = EEMysql.connect(self) |
|
||||
log and Log.debug(self, "Exceuting MySQL Statement : {0}" |
|
||||
.format(statement)) |
|
||||
try: |
|
||||
cursor = connection.cursor() |
|
||||
sql = statement |
|
||||
cursor.execute(sql) |
|
||||
|
|
||||
# connection is not autocommit by default. |
|
||||
# So you must commit to save your changes. |
|
||||
connection.commit() |
|
||||
except AttributeError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise StatementExcecutionError |
|
||||
except Error as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise StatementExcecutionError |
|
||||
finally: |
|
||||
connection.close() |
|
||||
|
|
||||
def backupAll(self): |
|
||||
import subprocess |
|
||||
try: |
|
||||
Log.info(self, "Backing up database at location: " |
|
||||
"/var/ee-mysqlbackup") |
|
||||
# Setup Nginx common directory |
|
||||
if not os.path.exists('/var/ee-mysqlbackup'): |
|
||||
Log.debug(self, 'Creating directory' |
|
||||
'/var/ee-mysqlbackup') |
|
||||
os.makedirs('/var/ee-mysqlbackup') |
|
||||
|
|
||||
db = subprocess.check_output(["mysql -Bse \'show databases\'"], |
|
||||
universal_newlines=True, |
|
||||
shell=True).split('\n') |
|
||||
for dbs in db: |
|
||||
if dbs == "": |
|
||||
continue |
|
||||
Log.info(self, "Backing up {0} database".format(dbs)) |
|
||||
p1 = subprocess.Popen("mysqldump {0}" |
|
||||
" --max_allowed_packet=1024M" |
|
||||
" --single-transaction".format(dbs), |
|
||||
stdout=subprocess.PIPE, |
|
||||
stderr=subprocess.PIPE, shell=True) |
|
||||
p2 = subprocess.Popen("gzip -c > /var/ee-mysqlbackup/{0}{1}.s" |
|
||||
"ql.gz".format(dbs, EEVariables.ee_date), |
|
||||
stdin=p1.stdout, |
|
||||
shell=True) |
|
||||
|
|
||||
# Allow p1 to receive a SIGPIPE if p2 exits |
|
||||
p1.stdout.close() |
|
||||
output = p1.stderr.read() |
|
||||
p1.wait() |
|
||||
if p1.returncode == 0: |
|
||||
Log.debug(self, "done") |
|
||||
else: |
|
||||
Log.error(self, output.decode("utf-8")) |
|
||||
except Exception as e: |
|
||||
Log.error(self, "Error: process exited with status %s" |
|
||||
% e) |
|
||||
|
|
||||
def check_db_exists(self, db_name): |
|
||||
try: |
|
||||
if EEMysql.dbConnection(self, db_name): |
|
||||
return True |
|
||||
except DatabaseNotExistsError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
return False |
|
||||
except MySQLConnectionError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise MySQLConnectionError |
|
||||
#return False |
|
@ -1,44 +0,0 @@ |
|||||
"""EasyEngine Hash bucket calculate function for Nginx""" |
|
||||
from ee.core.fileutils import EEFileUtils |
|
||||
import math |
|
||||
import os |
|
||||
import fileinput |
|
||||
import re |
|
||||
import subprocess |
|
||||
|
|
||||
|
|
||||
def hashbucket(self): |
|
||||
# Check Nginx Hashbucket error |
|
||||
sub = subprocess.Popen('nginx -t', stdout=subprocess.PIPE, |
|
||||
stderr=subprocess.PIPE, shell=True) |
|
||||
output, error_output = sub.communicate() |
|
||||
if 'server_names_hash_bucket_size' not in str(error_output): |
|
||||
return True |
|
||||
|
|
||||
count = 0 |
|
||||
# Get the list of sites-availble |
|
||||
sites_list = os.listdir("/etc/nginx/sites-enabled/") |
|
||||
|
|
||||
# Count the number of characters in site names |
|
||||
for site in sites_list: |
|
||||
count = sum([count, len(site)]) |
|
||||
|
|
||||
# Calculate Nginx hash bucket size |
|
||||
ngx_calc = math.trunc(sum([math.log(count, 2), 2])) |
|
||||
ngx_hash = math.trunc(math.pow(2, ngx_calc)) |
|
||||
|
|
||||
# Replace hashbucket in Nginx.conf file |
|
||||
if EEFileUtils.grep(self, "/etc/nginx/nginx.conf", |
|
||||
"server_names_hash_bucket_size"): |
|
||||
for line in fileinput.FileInput("/etc/nginx/nginx.conf", inplace=1): |
|
||||
if "server_names_hash_bucket_size" in line: |
|
||||
print("\tserver_names_hash_bucket_size {0};".format(ngx_hash)) |
|
||||
else: |
|
||||
print(line, end='') |
|
||||
|
|
||||
else: |
|
||||
EEFileUtils.searchreplace(self, '/etc/nginx/nginx.conf', |
|
||||
"gzip_disable \"msie6\";", |
|
||||
"gzip_disable \"msie6\";\n" |
|
||||
"\tserver_names_hash_bucket_size {0};\n" |
|
||||
.format(ngx_hash)) |
|
@ -1,33 +0,0 @@ |
|||||
import smtplib |
|
||||
import os |
|
||||
from email.mime.multipart import MIMEMultipart |
|
||||
from email.mime.base import MIMEBase |
|
||||
from email.mime.text import MIMEText |
|
||||
from email.utils import COMMASPACE, formatdate |
|
||||
from email import encoders |
|
||||
|
|
||||
|
|
||||
def EESendMail(send_from, send_to, subject, text, files, server="localhost", |
|
||||
port=587, username='', password='', isTls=True): |
|
||||
msg = MIMEMultipart() |
|
||||
msg['From'] = send_from |
|
||||
msg['To'] = send_to |
|
||||
msg['Date'] = formatdate(localtime=True) |
|
||||
msg['Subject'] = subject |
|
||||
|
|
||||
msg.attach(MIMEText(text)) |
|
||||
|
|
||||
for f in files: |
|
||||
part = MIMEBase('application', "octet-stream") |
|
||||
part.set_payload(open(f, "rb").read()) |
|
||||
encoders.encode_base64(part) |
|
||||
part.add_header('Content-Disposition', 'attachment; filename="{0}"' |
|
||||
.format(os.path.basename(f))) |
|
||||
msg.attach(part) |
|
||||
|
|
||||
smtp = smtplib.SMTP(server, port) |
|
||||
if isTls: |
|
||||
smtp.starttls() |
|
||||
|
|
||||
smtp.sendmail(send_from, send_to, msg.as_string()) |
|
||||
smtp.quit() |
|
@ -1,132 +0,0 @@ |
|||||
"""EasyEngine service start/stop/restart module.""" |
|
||||
import os |
|
||||
import sys |
|
||||
import subprocess |
|
||||
from subprocess import Popen |
|
||||
from ee.core.logging import Log |
|
||||
import pystache |
|
||||
|
|
||||
|
|
||||
class EEService(): |
|
||||
"""Intialization for service""" |
|
||||
def ___init__(): |
|
||||
pass |
|
||||
|
|
||||
def start_service(self, service_name): |
|
||||
""" |
|
||||
start service |
|
||||
Similar to `service xyz start` |
|
||||
""" |
|
||||
try: |
|
||||
if service_name in ['nginx', 'php5-fpm']: |
|
||||
service_cmd = ('{0} -t && service {0} start' |
|
||||
.format(service_name)) |
|
||||
else: |
|
||||
service_cmd = ('service {0} start'.format(service_name)) |
|
||||
|
|
||||
Log.info(self, "Start : {0:10}" .format(service_name), end='') |
|
||||
retcode = subprocess.getstatusoutput(service_cmd) |
|
||||
if retcode[0] == 0: |
|
||||
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") |
|
||||
return True |
|
||||
else: |
|
||||
Log.debug(self, "{0}".format(retcode[1])) |
|
||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "\nFailed to start service {0}" |
|
||||
.format(service_name)) |
|
||||
|
|
||||
def stop_service(self, service_name): |
|
||||
""" |
|
||||
Stop service |
|
||||
Similar to `service xyz stop` |
|
||||
""" |
|
||||
try: |
|
||||
Log.info(self, "Stop : {0:10}" .format(service_name), end='') |
|
||||
retcode = subprocess.getstatusoutput('service {0} stop' |
|
||||
.format(service_name)) |
|
||||
if retcode[0] == 0: |
|
||||
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") |
|
||||
return True |
|
||||
else: |
|
||||
Log.debug(self, "{0}".format(retcode[1])) |
|
||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "\nFailed to stop service : {0}" |
|
||||
.format(service_name)) |
|
||||
|
|
||||
def restart_service(self, service_name): |
|
||||
""" |
|
||||
Restart service |
|
||||
Similar to `service xyz restart` |
|
||||
""" |
|
||||
try: |
|
||||
if service_name in ['nginx', 'php5-fpm']: |
|
||||
service_cmd = ('{0} -t && service {0} restart' |
|
||||
.format(service_name)) |
|
||||
else: |
|
||||
service_cmd = ('service {0} restart'.format(service_name)) |
|
||||
|
|
||||
Log.info(self, "Restart : {0:10}".format(service_name), end='') |
|
||||
retcode = subprocess.getstatusoutput(service_cmd) |
|
||||
if retcode[0] == 0: |
|
||||
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") |
|
||||
return True |
|
||||
else: |
|
||||
Log.debug(self, "{0}".format(retcode[1])) |
|
||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0} {1}".format(e.errno, e.strerror)) |
|
||||
Log.error(self, "\nFailed to restart service : {0}" |
|
||||
.format(service_name)) |
|
||||
|
|
||||
def reload_service(self, service_name): |
|
||||
""" |
|
||||
Stop service |
|
||||
Similar to `service xyz stop` |
|
||||
""" |
|
||||
try: |
|
||||
if service_name in ['nginx', 'php5-fpm']: |
|
||||
service_cmd = ('{0} -t && service {0} reload' |
|
||||
.format(service_name)) |
|
||||
else: |
|
||||
service_cmd = ('service {0} reload'.format(service_name)) |
|
||||
|
|
||||
Log.info(self, "Reload : {0:10}".format(service_name), end='') |
|
||||
retcode = subprocess.getstatusoutput(service_cmd) |
|
||||
if retcode[0] == 0: |
|
||||
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") |
|
||||
return True |
|
||||
else: |
|
||||
Log.debug(self, "{0}".format(retcode[1])) |
|
||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]") |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}".format(e)) |
|
||||
Log.error(self, "\nFailed to reload service {0}" |
|
||||
.format(service_name)) |
|
||||
|
|
||||
def get_service_status(self, service_name): |
|
||||
try: |
|
||||
is_exist = subprocess.getstatusoutput('which {0}' |
|
||||
.format(service_name)) |
|
||||
if is_exist[0] == 0: |
|
||||
retcode = subprocess.getstatusoutput('service {0} status' |
|
||||
.format(service_name)) |
|
||||
if retcode[0] == 0: |
|
||||
return True |
|
||||
else: |
|
||||
Log.debug(self, "{0}".format(retcode[1])) |
|
||||
return False |
|
||||
else: |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}{1}".format(e.errno, e.strerror)) |
|
||||
Log.error(self, "Unable to get services status of {0}" |
|
||||
.format(service_name)) |
|
||||
return False |
|
@ -1,52 +0,0 @@ |
|||||
"""EasyEngine shell executaion functions.""" |
|
||||
from ee.core.logging import Log |
|
||||
import os |
|
||||
import sys |
|
||||
import subprocess |
|
||||
|
|
||||
|
|
||||
class CommandExecutionError(Exception): |
|
||||
"""custom Exception for command execution""" |
|
||||
pass |
|
||||
|
|
||||
|
|
||||
class EEShellExec(): |
|
||||
"""Method to run shell commands""" |
|
||||
def __init__(): |
|
||||
pass |
|
||||
|
|
||||
def cmd_exec(self, command, errormsg='', log=True): |
|
||||
"""Run shell command from Python""" |
|
||||
try: |
|
||||
log and Log.debug(self, "Running command: {0}".format(command)) |
|
||||
|
|
||||
with subprocess.Popen([command], stdout=subprocess.PIPE, |
|
||||
stderr=subprocess.PIPE, shell=True) as proc: |
|
||||
(cmd_stdout_bytes, cmd_stderr_bytes) = proc.communicate() |
|
||||
(cmd_stdout, cmd_stderr) = (cmd_stdout_bytes.decode('utf-8', |
|
||||
"replace"), |
|
||||
cmd_stderr_bytes.decode('utf-8', |
|
||||
"replace")) |
|
||||
|
|
||||
if proc.returncode == 0: |
|
||||
return True |
|
||||
else: |
|
||||
Log.debug(self, "Command Output: {0}, \nCommand Error: {1}" |
|
||||
.format(cmd_stdout, cmd_stderr)) |
|
||||
return False |
|
||||
except OSError as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise CommandExecutionError |
|
||||
except Exception as e: |
|
||||
Log.debug(self, str(e)) |
|
||||
raise CommandExecutionError |
|
||||
|
|
||||
def invoke_editor(self, filepath, errormsg=''): |
|
||||
""" |
|
||||
Open files using sensible editor |
|
||||
""" |
|
||||
try: |
|
||||
subprocess.call(['sensible-editor', filepath]) |
|
||||
except OSError as e: |
|
||||
Log.debug(self, "{0}{1}".format(e.errno, e.strerror)) |
|
||||
raise CommandExecutionError |
|
@ -1,185 +0,0 @@ |
|||||
"""EasyEngine core variable module""" |
|
||||
import platform |
|
||||
import socket |
|
||||
import configparser |
|
||||
import os |
|
||||
import sys |
|
||||
import psutil |
|
||||
import datetime |
|
||||
|
|
||||
|
|
||||
class EEVariables(): |
|
||||
"""Intialization of core variables""" |
|
||||
|
|
||||
# EasyEngine version |
|
||||
ee_version = "3.3.9" |
|
||||
|
|
||||
|
|
||||
# EasyEngine packages versions |
|
||||
ee_wp_cli = "0.20.1" |
|
||||
ee_adminer = "4.2.1" |
|
||||
ee_roundcube = "1.1.3" |
|
||||
ee_vimbadmin = "3.0.12" |
|
||||
|
|
||||
# Get WPCLI path |
|
||||
ee_wpcli_path = os.popen('which wp | tr "\n" " "').read() |
|
||||
if ee_wpcli_path == '': |
|
||||
ee_wpcli_path = '/usr/bin/wp ' |
|
||||
|
|
||||
# Current date and time of System |
|
||||
ee_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S') |
|
||||
|
|
||||
# EasyEngine core variables |
|
||||
ee_platform_distro = platform.linux_distribution()[0].lower() |
|
||||
ee_platform_version = platform.linux_distribution()[1] |
|
||||
ee_platform_codename = os.popen("lsb_release -sc | tr -d \'\\n\'").read() |
|
||||
|
|
||||
# Get timezone of system |
|
||||
if os.path.isfile('/etc/timezone'): |
|
||||
with open("/etc/timezone", "r") as tzfile: |
|
||||
ee_timezone = tzfile.read().replace('\n', '') |
|
||||
if ee_timezone == "Etc/UTC": |
|
||||
ee_timezone = "UTC" |
|
||||
else: |
|
||||
ee_timezone = "UTC" |
|
||||
|
|
||||
# Get FQDN of system |
|
||||
ee_fqdn = socket.getfqdn() |
|
||||
|
|
||||
# EasyEngien default webroot path |
|
||||
ee_webroot = '/var/www/' |
|
||||
|
|
||||
# PHP5 user |
|
||||
ee_php_user = 'www-data' |
|
||||
|
|
||||
# Get git user name and EMail |
|
||||
config = configparser.ConfigParser() |
|
||||
config.read(os.path.expanduser("~")+'/.gitconfig') |
|
||||
try: |
|
||||
ee_user = config['user']['name'] |
|
||||
ee_email = config['user']['email'] |
|
||||
except Exception as e: |
|
||||
ee_user = input("Enter your name: ") |
|
||||
ee_email = input("Enter your email: ") |
|
||||
os.system("git config --global user.name {0}".format(ee_user)) |
|
||||
os.system("git config --global user.email {0}".format(ee_email)) |
|
||||
|
|
||||
# Get System RAM and SWAP details |
|
||||
ee_ram = psutil.virtual_memory().total / (1024 * 1024) |
|
||||
ee_swap = psutil.swap_memory().total / (1024 * 1024) |
|
||||
|
|
||||
# MySQL hostname |
|
||||
ee_mysql_host = "" |
|
||||
config = configparser.RawConfigParser() |
|
||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'): |
|
||||
cnfpath = "/etc/mysql/conf.d/my.cnf" |
|
||||
else: |
|
||||
cnfpath = os.path.expanduser("~")+"/.my.cnf" |
|
||||
if [cnfpath] == config.read(cnfpath): |
|
||||
try: |
|
||||
ee_mysql_host = config.get('client', 'host') |
|
||||
except configparser.NoOptionError as e: |
|
||||
ee_mysql_host = "localhost" |
|
||||
else: |
|
||||
ee_mysql_host = "localhost" |
|
||||
|
|
||||
# EasyEngine stack installation varibales |
|
||||
# Nginx repo and packages |
|
||||
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': |
|
||||
ee_php_repo = "ppa:ondrej/php5-5.6" |
|
||||
elif ee_platform_codename == 'wheezy': |
|
||||
ee_php_repo = ("deb http://packages.dotdeb.org {codename}-php56 all" |
|
||||
.format(codename=ee_platform_codename)) |
|
||||
ee_php = ["php5-fpm", "php5-curl", "php5-gd", "php5-imap", |
|
||||
"php5-mcrypt", "php5-common", "php5-readline", |
|
||||
"php5-mysql", "php5-cli", "php5-memcache", "php5-imagick", |
|
||||
"memcached", "graphviz", "php-pear"] |
|
||||
|
|
||||
if ee_platform_codename == 'wheezy': |
|
||||
ee_php = ee_php + ["php5-dev"] |
|
||||
|
|
||||
if ee_platform_distro == 'ubuntu' or ee_platform_codename == 'jessie': |
|
||||
ee_php = ee_php + ["php5-xdebug"] |
|
||||
|
|
||||
# MySQL repo and packages |
|
||||
if ee_platform_distro == 'ubuntu': |
|
||||
ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/" |
|
||||
"10.0/ubuntu {codename} main" |
|
||||
.format(codename=ee_platform_codename)) |
|
||||
elif ee_platform_distro == 'debian': |
|
||||
ee_mysql_repo = ("deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/" |
|
||||
"10.0/debian {codename} main" |
|
||||
.format(codename=ee_platform_codename)) |
|
||||
|
|
||||
ee_mysql = ["mariadb-server", "percona-toolkit"] |
|
||||
|
|
||||
# Postfix repo and packages |
|
||||
ee_postfix_repo = "" |
|
||||
ee_postfix = ["postfix"] |
|
||||
|
|
||||
# Mail repo and packages |
|
||||
ee_mail_repo = ("deb http://http.debian.net/debian-backports {codename}" |
|
||||
"-backports main".format(codename=ee_platform_codename)) |
|
||||
|
|
||||
ee_mail = ["dovecot-core", "dovecot-imapd", "dovecot-pop3d", |
|
||||
"dovecot-lmtpd", "dovecot-mysql", "dovecot-sieve", |
|
||||
"dovecot-managesieved", "postfix-mysql", "php5-cgi", |
|
||||
"php-gettext", "php-pear"] |
|
||||
|
|
||||
# Mailscanner repo and packages |
|
||||
ee_mailscanner_repo = () |
|
||||
ee_mailscanner = ["amavisd-new", "spamassassin", "clamav", "clamav-daemon", |
|
||||
"arj", "zoo", "nomarch", "lzop", "cabextract", "p7zip", |
|
||||
"rpm", "unrar-free"] |
|
||||
|
|
||||
# HHVM repo details |
|
||||
# 12.04 requires boot repository |
|
||||
if ee_platform_distro == 'ubuntu': |
|
||||
if ee_platform_codename == "precise": |
|
||||
ee_boost_repo = ("ppa:mapnik/boost") |
|
||||
|
|
||||
ee_hhvm_repo = ("deb http://dl.hhvm.com/ubuntu {codename} main" |
|
||||
.format(codename=ee_platform_codename)) |
|
||||
else: |
|
||||
ee_hhvm_repo = ("deb http://dl.hhvm.com/debian {codename} main" |
|
||||
.format(codename=ee_platform_codename)) |
|
||||
|
|
||||
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) |
|
||||
|
|
||||
# Application dabase file path |
|
||||
basedir = os.path.abspath(os.path.dirname('/var/lib/ee/')) |
|
||||
ee_db_uri = 'sqlite:///' + os.path.join(basedir, 'ee.db') |
|
||||
|
|
||||
def __init__(self): |
|
||||
pass |
|
@ -1,15 +0,0 @@ |
|||||
"""Testing utilities for EasyEngine.""" |
|
||||
from ee.cli.main import EETestApp |
|
||||
from cement.utils.test import * |
|
||||
|
|
||||
|
|
||||
class EETestCase(CementTestCase): |
|
||||
app_class = EETestApp |
|
||||
|
|
||||
def setUp(self): |
|
||||
"""Override setup actions (for every test).""" |
|
||||
super(EETestCase, self).setUp() |
|
||||
|
|
||||
def tearDown(self): |
|
||||
"""Override teardown actions (for every test).""" |
|
||||
super(EETestCase, self).tearDown() |
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue