diff --git a/.travis.yml b/.travis.yml index fcb405b..1d69e3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,65 +1,66 @@ -sudo: required -dist: xenial - -language: bash - -notifications: - slack: wordops:MyZBNbI7JfhbAi3YyFckMdaa - -addons: - apt: - update: true - -git: - quiet: true - -before_install: - - rm -rf ~/.gnupg - -before_script: - - sudo rm -rf /etc/mysql - - sudo bash -c 'echo example.com > /etc/hostname' - - sudo apt-get -qq purge mysql* graphviz* redis* - - sudo apt-get -qq autoremove --purge - - unset LANG - - sudo apt-get install --assume-yes --quiet git python3-setuptools python3-dev python3-apt ccze tree - -script: - - lsb_release -a - - sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig' - - sudo echo "Travis Banch = $TRAVIS_BRANCH" - - sed -i 's/# "nose"/"nose"/g' setup.py - - sed -i 's/# "coverage"/"coverage"/g' setup.py - - sed -i 's/# "Sphinx >= 1.0"/"Sphinx >= 1.0"/g' setup.py - - sudo bash install --travis - - sudo wo --help && sudo wo stack install && sudo wo stack install --proftpd - - sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql && sudo wo site create proxy.com --proxy=127.0.0.1:3000 - - sudo wo site create wp1.com --wp && sudo wo site create wpsc1.net --wpsc && sudo wo site create wpfc1.com --wpfc - - sudo wo site create wpsc-php73.net --wpsc --php73 && sudo wo site create wpfc-php73.net --wpfc --php73 - - sudo wo site create wprocket.net --wprocket && sudo wo site create wprocket-php73.net --wprocket --php73 - - sudo wo site create wpce.net --wpce && sudo wo site create wpce-php73.net --wpce --php73 - - sudo wo site create wpredis.net --wpredis && sudo wo site create wpredis-php73.net --wpredis --php73 - - sudo wo site create wpsubdir1.com --wpsubdir && sudo wo site create wpsubdir-php73.com --wpsubdir --php73 - - - sudo wo site create wpsubdirwpsc1.com --wpsubdir --wpsc && sudo wo site create wpsubdirwpsc2.com --wpsubdir --wpfc && sudo wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 && sudo wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73 - - sudo wo site create wpsubdomain1.com --wpsubdomain && sudo wo site create wpsubdomain1-php73.com --wpsubdomain --php73 && sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain - - - sudo wo site create 1.com --html && sudo wo site create 2.com --php && sudo wo site create 3.com --mysql - - sudo wo site update 1.com --wp && sudo wo site update 2.com --php73 && sudo wo site update 3.com --php73 && sudo wo site update 1.com --wpfc && sudo wo site update 1.com --wpsc && sudo wo site update 1.com --wpredis - - sudo wp --allow-root --info - - sudo wo info - - sudo cat /etc/nginx/nginx.conf - - sudo tree -L 2 /etc/nginx - - sudo cat /etc/mysql/my.cnf - - sudo wo stack upgrade --nginx --force - - sudo wo stack upgrade --php --force - - sudo wo stack upgrade --netdata --force - - sudo wo stack upgrade --phpmyadmin --force - - sudo wo stack upgrade --composer --force - - sudo wo stack upgrade --dashboard --force - - sudo wo update --travis - - sudo wo stack status - - sudo tar -I pigz -cf wordops.tar.gz /var/log/wo - - curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo "" - - echo "yes" | sudo wo stack purge --all --force - - sudo bash install --purge +sudo: required +dist: xenial + +language: bash + +notifications: + slack: wordops:MyZBNbI7JfhbAi3YyFckMdaa + +addons: + apt: + update: true + +git: + quiet: true + +before_install: + - rm -rf ~/.gnupg + +before_script: + - sudo rm -rf /etc/mysql + - sudo bash -c 'echo example.com > /etc/hostname' + - sudo apt-get -qq purge mysql* graphviz* redis* + - sudo apt-get -qq autoremove --purge + - unset LANG + - sudo apt-get install --assume-yes --quiet git python3-setuptools python3-dev python3-apt ccze tree + +script: + - lsb_release -a + - sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig' + - sudo echo "Travis Banch = $TRAVIS_BRANCH" + - sed -i 's/# "nose"/"nose"/g' setup.py + - sed -i 's/# "coverage"/"coverage"/g' setup.py + - sed -i 's/# "Sphinx >= 1.0"/"Sphinx >= 1.0"/g' setup.py + - sudo bash install --travis + - sudo wo --help && sudo wo stack install && sudo wo stack install --proftpd + - sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql && sudo wo site create proxy.com --proxy=127.0.0.1:3000 + - sudo wo site create wp1.com --wp && sudo wo site create wpsc1.net --wpsc && sudo wo site create wpfc1.com --wpfc + - sudo wo site create wpsc-php73.net --wpsc --php73 && sudo wo site create wpfc-php73.net --wpfc --php73 + - sudo wo site create wprocket.net --wprocket && sudo wo site create wprocket-php73.net --wprocket --php73 + - sudo wo site create wpce.net --wpce && sudo wo site create wpce-php73.net --wpce --php73 + - sudo wo site create wpredis.net --wpredis && sudo wo site create wpredis-php73.net --wpredis --php73 + - sudo wo site create wpsubdir1.com --wpsubdir && sudo wo site create wpsubdir-php73.com --wpsubdir --php73 + + - sudo wo site create wpsubdirwpsc1.com --wpsubdir --wpsc && sudo wo site create wpsubdirwpsc2.com --wpsubdir --wpfc && sudo wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 && sudo wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73 + - sudo wo site create wpsubdomain1.com --wpsubdomain && sudo wo site create wpsubdomain1-php73.com --wpsubdomain --php73 && sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain + + - sudo wo site create 1.com --html && sudo wo site create 2.com --php && sudo wo site create 3.com --mysql + - sudo wo site update 1.com --wp && sudo wo site update 2.com --php73 && sudo wo site update 3.com --php73 && sudo wo site update 1.com --wpfc && sudo wo site update 1.com --wpsc && sudo wo site update 1.com --wpredis + - sudo wp --allow-root --info + - sudo wo info + - sudo cat /etc/nginx/nginx.conf + - sudo tree -L 2 /etc/nginx + - sudo tree -L 2 /var/www + - sudo cat /etc/mysql/my.cnf + - sudo wo stack upgrade --nginx --force + - sudo wo stack upgrade --php --force + - sudo wo stack upgrade --netdata --force + - sudo wo stack upgrade --phpmyadmin --force + - sudo wo stack upgrade --composer --force + - sudo wo stack upgrade --dashboard --force + - sudo wo update --travis + - sudo wo stack status + - sudo tar -I pigz -cf wordops.tar.gz /var/log/wo + - curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo "" + - echo "yes" | sudo wo stack purge --all --force + - sudo bash install --purge diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index b8290b9..7f5af9f 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -253,81 +253,53 @@ def post_pref(self, apt_packages, packages): .format(ngxcom), 'wpsc.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wprocket-php72.conf') - wo_nginx = open('/etc/nginx/common/wprocket-php72.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wprocket.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/wprocket-php72.conf' + .format(ngxcom), + 'wprocket.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpce-php72.conf') - wo_nginx = open('/etc/nginx/common/wpce-php72.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpce.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/wpce-php72.conf' + .format(ngxcom), + 'wpce.mustache', data) # PHP 7.3 conf if os.path.isdir("/etc/nginx/common"): data = dict(upstream="php73") - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/php73.conf') - wo_nginx = open('/etc/nginx/common/php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'php.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/php73.conf' + .format(ngxcom), + 'php.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpcommon-php73.conf') - wo_nginx = open('/etc/nginx/common/wpcommon-php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpcommon.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/redis-php73.conf' + .format(ngxcom), + 'redis.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpfc-php73.conf') - wo_nginx = open('/etc/nginx/common/wpfc-php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpfc.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/wpcommon-php73.conf' + .format(ngxcom), + 'wpcommon.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpsc-php73.conf') - wo_nginx = open('/etc/nginx/common/wpsc-php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpsc.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/wpfc-php73.conf' + .format(ngxcom), + 'wpfc.mustache', data) + WOTemplate.tmpl_render(self, + '{0}/wpsc-php73.conf' + .format(ngxcom), + 'wpsc.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wprocket-php73.conf') - wo_nginx = open('/etc/nginx/common/wprocket-php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wprocket.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/wprocket-php73.conf' + .format(ngxcom), + 'wprocket.mustache', data) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/wpce-php73.conf') - wo_nginx = open('/etc/nginx/common/wpce-php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'wpce.mustache', - out=wo_nginx) - wo_nginx.close() - - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/redis-php73.conf') - wo_nginx = open('/etc/nginx/common/redis-php73.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'redis.mustache', - out=wo_nginx) - wo_nginx.close() + WOTemplate.tmpl_render(self, + '{0}/wpce-php73.conf' + .format(ngxcom), + 'wpce.mustache', data) with open("/etc/nginx/common/release", "w") as release_file: @@ -337,32 +309,19 @@ def post_pref(self, apt_packages, packages): # Following files should not be overwrited - if not os.path.isfile('/etc/nginx/common/acl.conf'): - data = dict(webroot=ngxroot) - Log.debug(self, 'Writting the nginx configuration to ' - 'file /etc/nginx/common/acl.conf') - wo_nginx = open('/etc/nginx/common/acl.conf', - encoding='utf-8', mode='w') - self.app.render((data), 'acl.mustache', - out=wo_nginx) - wo_nginx.close() - if not os.path.isfile('{0}/blockips.conf'.format(ngxcnf)): - Log.debug(self, 'Writting the nginx configuration to ' - 'file {0}/blockips.conf'.format(ngxcnf)) - wo_nginx = open('{0}/blockips.conf'.format(ngxcnf), - encoding='utf-8', mode='w') - self.app.render( - (data), 'blockips.mustache', out=wo_nginx) - wo_nginx.close() - - if not os.path.isfile('{0}/fastcgi.conf'.format(ngxcnf)): - Log.debug(self, 'Writting the nginx configuration to ' - 'file {0}/fastcgi.conf'.format(ngxcnf)) - wo_nginx = open('{0}/fastcgi.conf'.format(ngxcnf), - encoding='utf-8', mode='w') - self.app.render( - (data), 'fastcgi.mustache', out=wo_nginx) - wo_nginx.close() + data = dict(webroot=ngxroot) + WOTemplate.tmpl_render(self, + '{0}/acl.conf' + .format(ngxcom), + 'acl.mustache', data, overwrite=False) + WOTemplate.tmpl_render(self, + '{0}/blockips.conf' + .format(ngxcnf), + 'blockips.mustache', data, overwrite=False) + WOTemplate.tmpl_render(self, + '{0}/fastcgi.conf' + .format(ngxcnf), + 'fastcgi.mustache', data, overwrite=False) # add redis cache format if not already done if (os.path.isfile("/etc/nginx/nginx.conf") and