Update Travis and tests
This commit is contained in:
129
.travis.yml
129
.travis.yml
@@ -1,64 +1,65 @@
|
|||||||
sudo: required
|
sudo: required
|
||||||
dist: xenial
|
dist: xenial
|
||||||
|
|
||||||
language: bash
|
language: bash
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
slack: wordops:MyZBNbI7JfhbAi3YyFckMdaa
|
slack: wordops:MyZBNbI7JfhbAi3YyFckMdaa
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
update: true
|
update: true
|
||||||
|
|
||||||
git:
|
git:
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- rm -rf ~/.gnupg
|
- rm -rf ~/.gnupg
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- sudo rm -rf /etc/mysql
|
- sudo rm -rf /etc/mysql
|
||||||
- sudo bash -c 'echo example.com > /etc/hostname'
|
- sudo bash -c 'echo example.com > /etc/hostname'
|
||||||
- sudo apt-get -qq purge mysql* graphviz* redis*
|
- sudo apt-get -qq purge mysql* graphviz* redis*
|
||||||
- sudo apt-get -qq autoremove --purge
|
- sudo apt-get -qq autoremove --purge
|
||||||
- unset LANG
|
- unset LANG
|
||||||
- sudo apt-get install --assume-yes --quiet git python3-setuptools python3-dev python3-apt ccze tree
|
- sudo apt-get install --assume-yes --quiet git python3-setuptools python3-dev python3-apt ccze tree
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- lsb_release -a
|
- lsb_release -a
|
||||||
- sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
|
- sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
|
||||||
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
|
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
|
||||||
- sed -i 's/# "nose"/"nose"/g' setup.py
|
- sed -i 's/# "nose"/"nose"/g' setup.py
|
||||||
- sed -i 's/# "coverage"/"coverage"/g' setup.py
|
- sed -i 's/# "coverage"/"coverage"/g' setup.py
|
||||||
- sed -i 's/# "Sphinx >= 1.0"/"Sphinx >= 1.0"/g' setup.py
|
- sed -i 's/# "Sphinx >= 1.0"/"Sphinx >= 1.0"/g' setup.py
|
||||||
- sudo bash install --travis
|
- sudo bash install --travis
|
||||||
- sudo wo --help && sudo wo stack install && sudo wo stack install --proftpd
|
- 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 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 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 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 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 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 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 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 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 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 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 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 wp --allow-root --info
|
||||||
- sudo wo info
|
- sudo wo info
|
||||||
- sudo cat /etc/nginx/nginx.conf
|
- sudo cat /etc/nginx/nginx.conf
|
||||||
- sudo tree -L 2 /etc/nginx
|
- sudo tree -L 2 /etc/nginx
|
||||||
- sudo cat /etc/mysql/my.cnf
|
- sudo cat /etc/mysql/my.cnf
|
||||||
- sudo wo stack upgrade --nginx --no-prompt
|
- sudo wo stack upgrade --nginx --force
|
||||||
- sudo wo stack upgrade --php --no-prompt
|
- sudo wo stack upgrade --php --force
|
||||||
- sudo wo stack upgrade --netdata --no-prompt
|
- sudo wo stack upgrade --netdata --force
|
||||||
- sudo wo stack upgrade --phpmyadmin --no-prompt
|
- sudo wo stack upgrade --phpmyadmin --force
|
||||||
- sudo wo stack upgrade --composer --no-prompt
|
- sudo wo stack upgrade --composer --force
|
||||||
- sudo wo update --travis
|
- sudo wo stack upgrade --dashboard --force
|
||||||
- sudo wo stack status
|
- sudo wo update --travis
|
||||||
- sudo tar -I pigz -cf wordops.tar.gz /var/log/wo
|
- sudo wo stack status
|
||||||
- curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo ""
|
- sudo tar -I pigz -cf wordops.tar.gz /var/log/wo
|
||||||
- echo "yes" | sudo wo stack purge --all
|
- curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo ""
|
||||||
- sudo bash install --purge
|
- echo "yes" | sudo wo stack purge --all --force
|
||||||
|
- sudo bash install --purge
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ class CliTestCaseSecure(test.WOTestCase):
|
|||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_secure_auth(self):
|
def test_wo_cli_secure_auth(self):
|
||||||
self.app = get_test_app(argv=['secure', '--auth'])
|
self.app = get_test_app(argv=['secure', '--auth', 'abc', 'superpass'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_secure_port(self):
|
def test_wo_cli_secure_port(self):
|
||||||
self.app = get_test_app(argv=['secure', '--port'])
|
self.app = get_test_app(argv=['secure', '--port', '22222'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_secure_ip(self):
|
def test_wo_cli_secure_ip(self):
|
||||||
self.app = get_test_app(argv=['secure', '--ip'])
|
self.app = get_test_app(argv=['secure', '--ip', '172.16.0.1'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|||||||
@@ -10,55 +10,64 @@ class CliTestCaseStack(test.WOTestCase):
|
|||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_web(self):
|
def test_wo_cli_stack_purge_web(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--web'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--web', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_admin(self):
|
def test_wo_cli_stack_purge_admin(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--admin'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--admin', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_nginx(self):
|
def test_wo_cli_stack_purge_nginx(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--nginx'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--nginx', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_php(self):
|
def test_wo_cli_stack_purge_php(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--php'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--php', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_mysql(self):
|
def test_wo_cli_stack_purge_mysql(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--mysql'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--mysql', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_wpcli(self):
|
def test_wo_cli_stack_purge_wpcli(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--wpcli'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--wpcli', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_phpmyadmin(self):
|
def test_wo_cli_stack_purge_phpmyadmin(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--phpmyadmin'])
|
self.app = get_test_app(
|
||||||
|
argv=['stack', 'purge', '--phpmyadmin', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_adminer(self):
|
def test_wo_cli_stack_purge_adminer(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--adminer'])
|
self.app = get_test_app(
|
||||||
|
argv=['stack', 'purge', '--adminer', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_purge_utils(self):
|
def test_wo_cli_stack_purge_utils(self):
|
||||||
self.app = get_test_app(argv=['stack', 'purge', '--utils'])
|
self.app = get_test_app(argv=['stack', 'purge',
|
||||||
|
'--utils', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|||||||
@@ -10,55 +10,57 @@ class CliTestCaseStack(test.WOTestCase):
|
|||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_remove_web(self):
|
def test_wo_cli_stack_remove_web(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--web'])
|
self.app = get_test_app(argv=['stack', 'remove', '--web', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_admin(self):
|
def test_wo_cli_stack_install_admin(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--admin'])
|
self.app = get_test_app(argv=['stack', 'remove', '--admin', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_nginx(self):
|
def test_wo_cli_stack_install_nginx(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--nginx'])
|
self.app = get_test_app(argv=['stack', 'remove', '--nginx', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_php(self):
|
def test_wo_cli_stack_install_php(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--php'])
|
self.app = get_test_app(argv=['stack', 'remove', '--php', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_mysql(self):
|
def test_wo_cli_stack_install_mysql(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--mysql'])
|
self.app = get_test_app(argv=['stack', 'remove', '--mysql', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_wpcli(self):
|
def test_wo_cli_stack_install_wpcli(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--wpcli'])
|
self.app = get_test_app(argv=['stack', 'remove', '--wpcli', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_phpmyadmin(self):
|
def test_wo_cli_stack_install_phpmyadmin(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--phpmyadmin'])
|
self.app = get_test_app(argv=['stack', 'remove',
|
||||||
|
'--phpmyadmin', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_adminer(self):
|
def test_wo_cli_stack_install_adminer(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--adminer'])
|
self.app = get_test_app(
|
||||||
|
argv=['stack', 'remove', '--adminer', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|
||||||
def test_wo_cli_stack_install_utils(self):
|
def test_wo_cli_stack_install_utils(self):
|
||||||
self.app = get_test_app(argv=['stack', 'remove', '--utils'])
|
self.app = get_test_app(argv=['stack', 'remove', '--utils', '--force'])
|
||||||
self.app.setup()
|
self.app.setup()
|
||||||
self.app.run()
|
self.app.run()
|
||||||
self.app.close()
|
self.app.close()
|
||||||
|
|||||||
@@ -762,14 +762,15 @@ class WOStackController(CementBaseController):
|
|||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVariables.wo_webroot)]
|
||||||
|
|
||||||
if (packages) or (apt_packages):
|
if (packages) or (apt_packages):
|
||||||
wo_prompt = input('Are you sure you to want to purge '
|
if not pargs.force:
|
||||||
'from server '
|
wo_prompt = input('Are you sure you to want to purge '
|
||||||
'along with their configuration'
|
'from server '
|
||||||
' packages,\nAny answer other than '
|
'along with their configuration'
|
||||||
'"yes" will be stop this '
|
' packages,\nAny answer other than '
|
||||||
'operation :')
|
'"yes" will be stop this '
|
||||||
|
'operation :')
|
||||||
|
|
||||||
if wo_prompt == 'YES' or wo_prompt == 'yes' or pargs.force:
|
if (wo_prompt == 'YES' or wo_prompt == 'yes' or pargs.force):
|
||||||
|
|
||||||
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
||||||
WOService.stop_service(self, 'nginx')
|
WOService.stop_service(self, 'nginx')
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class WOStackMigrateController(CementBaseController):
|
|||||||
if ((not self.app.pargs.mariadb)):
|
if ((not self.app.pargs.mariadb)):
|
||||||
self.app.args.print_help()
|
self.app.args.print_help()
|
||||||
if self.app.pargs.mariadb:
|
if self.app.pargs.mariadb:
|
||||||
if WOVariables.wo_mysql_host is not "localhost":
|
if WOVariables.wo_mysql_host != "localhost":
|
||||||
Log.error(
|
Log.error(
|
||||||
self, "Remote MySQL server in use, skipping local install")
|
self, "Remote MySQL server in use, skipping local install")
|
||||||
|
|
||||||
|
|||||||
@@ -1,170 +1,170 @@
|
|||||||
"""WordOps core variable module"""
|
"""WordOps core variable module"""
|
||||||
import platform
|
import platform
|
||||||
import socket
|
import socket
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
class WOVariables():
|
class WOVariables():
|
||||||
"""Intialization of core variables"""
|
"""Intialization of core variables"""
|
||||||
|
|
||||||
# WordOps version
|
# WordOps version
|
||||||
wo_version = "3.9.8"
|
wo_version = "3.9.8"
|
||||||
# WordOps packages versions
|
# WordOps packages versions
|
||||||
wo_wp_cli = "2.2.0"
|
wo_wp_cli = "2.2.0"
|
||||||
wo_adminer = "4.7.2"
|
wo_adminer = "4.7.2"
|
||||||
wo_phpmyadmin = "4.9.0.1"
|
wo_phpmyadmin = "4.9.0.1"
|
||||||
wo_extplorer = "2.1.13"
|
wo_extplorer = "2.1.13"
|
||||||
wo_dashboard = "1.1"
|
wo_dashboard = "1.1"
|
||||||
|
|
||||||
# Get WPCLI path
|
# Get WPCLI path
|
||||||
wo_wpcli_path = '/usr/local/bin/wp'
|
wo_wpcli_path = '/usr/local/bin/wp'
|
||||||
|
|
||||||
# Current date and time of System
|
# Current date and time of System
|
||||||
wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')
|
wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')
|
||||||
|
|
||||||
# WordOps core variables
|
# WordOps core variables
|
||||||
wo_distro = os.popen("/usr/bin/lsb_release -si "
|
wo_distro = os.popen("/usr/bin/lsb_release -si "
|
||||||
"| tr -d \'\\n\'").read().lower()
|
"| tr -d \'\\n\'").read().lower()
|
||||||
wo_platform_version = platform.linux_distribution()[1]
|
wo_platform_version = platform.linux_distribution()[1]
|
||||||
wo_platform_codename = os.popen(
|
wo_platform_codename = os.popen(
|
||||||
"/usr/bin/lsb_release -sc | tr -d \'\\n\'").read()
|
"/usr/bin/lsb_release -sc | tr -d \'\\n\'").read()
|
||||||
|
|
||||||
# Get timezone of system
|
# Get timezone of system
|
||||||
if os.path.isfile('/etc/timezone'):
|
if os.path.isfile('/etc/timezone'):
|
||||||
with open("/etc/timezone", "r") as tzfile:
|
with open("/etc/timezone", "r") as tzfile:
|
||||||
wo_timezone = tzfile.read().replace('\n', '')
|
wo_timezone = tzfile.read().replace('\n', '')
|
||||||
if wo_timezone == "Etc/UTC":
|
if wo_timezone == "Etc/UTC":
|
||||||
wo_timezone = "UTC"
|
wo_timezone = "UTC"
|
||||||
else:
|
else:
|
||||||
wo_timezone = "Europe/Amsterdam"
|
wo_timezone = "Europe/Amsterdam"
|
||||||
|
|
||||||
# Get FQDN of system
|
# Get FQDN of system
|
||||||
wo_fqdn = socket.getfqdn()
|
wo_fqdn = socket.getfqdn()
|
||||||
|
|
||||||
# WordOps default webroot path
|
# WordOps default webroot path
|
||||||
wo_webroot = '/var/www/'
|
wo_webroot = '/var/www/'
|
||||||
|
|
||||||
# WordOps default renewal SSL certificates path
|
# WordOps default renewal SSL certificates path
|
||||||
wo_ssl_archive = '/etc/letsencrypt/renewal'
|
wo_ssl_archive = '/etc/letsencrypt/renewal'
|
||||||
|
|
||||||
# WordOps default live SSL certificates path
|
# WordOps default live SSL certificates path
|
||||||
wo_ssl_live = '/etc/letsencrypt/live'
|
wo_ssl_live = '/etc/letsencrypt/live'
|
||||||
|
|
||||||
# PHP user
|
# PHP user
|
||||||
wo_php_user = 'www-data'
|
wo_php_user = 'www-data'
|
||||||
|
|
||||||
# Get git user name and EMail
|
# Get git user name and EMail
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(os.path.expanduser("~")+'/.gitconfig')
|
config.read(os.path.expanduser("~")+'/.gitconfig')
|
||||||
try:
|
try:
|
||||||
wo_user = config['user']['name']
|
wo_user = config['user']['name']
|
||||||
wo_email = config['user']['email']
|
wo_email = config['user']['email']
|
||||||
except Exception:
|
except Exception:
|
||||||
wo_user = input("Enter your name: ")
|
wo_user = input("Enter your name: ")
|
||||||
wo_email = input("Enter your email: ")
|
wo_email = input("Enter your email: ")
|
||||||
os.system("/usr/bin/git config --global user.name {0}".format(wo_user))
|
os.system("/usr/bin/git config --global user.name {0}".format(wo_user))
|
||||||
os.system(
|
os.system(
|
||||||
"/usr/bin/git config --global user.email {0}".format(wo_email))
|
"/usr/bin/git config --global user.email {0}".format(wo_email))
|
||||||
|
|
||||||
# MySQL hostname
|
# MySQL hostname
|
||||||
wo_mysql_host = ""
|
wo_mysql_host = ""
|
||||||
config = configparser.RawConfigParser()
|
config = configparser.RawConfigParser()
|
||||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
||||||
cnfpath = "/etc/mysql/conf.d/my.cnf"
|
cnfpath = "/etc/mysql/conf.d/my.cnf"
|
||||||
else:
|
else:
|
||||||
cnfpath = os.path.expanduser("~")+"/.my.cnf"
|
cnfpath = os.path.expanduser("~")+"/.my.cnf"
|
||||||
if [cnfpath] == config.read(cnfpath):
|
if [cnfpath] == config.read(cnfpath):
|
||||||
try:
|
try:
|
||||||
wo_mysql_host = config.get('client', 'host')
|
wo_mysql_host = config.get('client', 'host')
|
||||||
except configparser.NoOptionError:
|
except configparser.NoOptionError:
|
||||||
wo_mysql_host = "localhost"
|
wo_mysql_host = "localhost"
|
||||||
else:
|
else:
|
||||||
wo_mysql_host = "localhost"
|
wo_mysql_host = "localhost"
|
||||||
|
|
||||||
# WordOps stack installation variables
|
# WordOps stack installation variables
|
||||||
# Nginx repo and packages
|
# Nginx repo and packages
|
||||||
if wo_distro == 'ubuntu':
|
if wo_distro == 'ubuntu':
|
||||||
wo_nginx_repo = "ppa:wordops/nginx-wo"
|
wo_nginx_repo = "ppa:wordops/nginx-wo"
|
||||||
elif wo_distro == 'debian':
|
elif wo_distro == 'debian':
|
||||||
if wo_platform_codename == 'jessie':
|
if wo_platform_codename == 'jessie':
|
||||||
wo_nginx_repo = ("deb http://download.opensuse.org"
|
wo_nginx_repo = ("deb http://download.opensuse.org"
|
||||||
"/repositories/home:"
|
"/repositories/home:"
|
||||||
"/virtubox:/WordOps/Debian_8.0/ /")
|
"/virtubox:/WordOps/Debian_8.0/ /")
|
||||||
elif wo_platform_codename == 'stretch':
|
elif wo_platform_codename == 'stretch':
|
||||||
wo_nginx_repo = ("deb http://download.opensuse.org"
|
wo_nginx_repo = ("deb http://download.opensuse.org"
|
||||||
"/repositories/home:"
|
"/repositories/home:"
|
||||||
"/virtubox:/WordOps/Debian_9.0/ /")
|
"/virtubox:/WordOps/Debian_9.0/ /")
|
||||||
elif wo_platform_codename == 'buster':
|
elif wo_platform_codename == 'buster':
|
||||||
wo_nginx_repo = ("deb http://download.opensuse.org"
|
wo_nginx_repo = ("deb http://download.opensuse.org"
|
||||||
"/repositories/home:"
|
"/repositories/home:"
|
||||||
"/virtubox:/WordOps/Debian_10/ /")
|
"/virtubox:/WordOps/Debian_10/ /")
|
||||||
else:
|
else:
|
||||||
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
wo_nginx_repo = ("deb http://download.opensuse.org/repositories/home:"
|
||||||
"/virtubox:/WordOps/Raspbian_9.0/ /")
|
"/virtubox:/WordOps/Raspbian_9.0/ /")
|
||||||
|
|
||||||
wo_nginx = ["nginx-custom", "nginx-wo"]
|
wo_nginx = ["nginx-custom", "nginx-wo"]
|
||||||
wo_nginx_key = '188C9FB063F0247A'
|
wo_nginx_key = '188C9FB063F0247A'
|
||||||
|
|
||||||
# PHP repo and packages
|
# PHP repo and packages
|
||||||
if wo_distro == 'ubuntu':
|
if wo_distro == 'ubuntu':
|
||||||
wo_php_repo = "ppa:ondrej/php"
|
wo_php_repo = "ppa:ondrej/php"
|
||||||
wo_php_key = ''
|
wo_php_key = ''
|
||||||
else:
|
else:
|
||||||
wo_php_repo = (
|
wo_php_repo = (
|
||||||
"deb https://packages.sury.org/php/ {codename} main"
|
"deb https://packages.sury.org/php/ {codename} main"
|
||||||
.format(codename=wo_platform_codename))
|
.format(codename=wo_platform_codename))
|
||||||
wo_php_key = 'AC0E47584A7A714D'
|
wo_php_key = 'AC0E47584A7A714D'
|
||||||
|
|
||||||
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
||||||
"php7.2-readline", "php7.2-common", "php7.2-recode",
|
"php7.2-readline", "php7.2-common", "php7.2-recode",
|
||||||
"php7.2-cli", "php7.2-mbstring",
|
"php7.2-cli", "php7.2-mbstring",
|
||||||
"php7.2-bcmath", "php7.2-mysql", "php7.2-opcache",
|
"php7.2-bcmath", "php7.2-mysql", "php7.2-opcache",
|
||||||
"php7.2-zip", "php7.2-xml", "php7.2-soap"]
|
"php7.2-zip", "php7.2-xml", "php7.2-soap"]
|
||||||
wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap",
|
wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap",
|
||||||
"php7.3-readline", "php7.3-common", "php7.3-recode",
|
"php7.3-readline", "php7.3-common", "php7.3-recode",
|
||||||
"php7.3-cli", "php7.3-mbstring",
|
"php7.3-cli", "php7.3-mbstring",
|
||||||
"php7.3-bcmath", "php7.3-mysql", "php7.3-opcache",
|
"php7.3-bcmath", "php7.3-mysql", "php7.3-opcache",
|
||||||
"php7.3-zip", "php7.3-xml", "php7.3-soap"]
|
"php7.3-zip", "php7.3-xml", "php7.3-soap"]
|
||||||
wo_php_extra = ["php-memcached", "php-imagick",
|
wo_php_extra = ["php-memcached", "php-imagick",
|
||||||
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
||||||
|
|
||||||
# MySQL repo and packages
|
# MySQL repo and packages
|
||||||
if wo_distro == 'ubuntu':
|
if wo_distro == 'ubuntu':
|
||||||
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
||||||
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
||||||
"10.3/ubuntu {codename} main"
|
"10.3/ubuntu {codename} main"
|
||||||
.format(codename=wo_platform_codename))
|
.format(codename=wo_platform_codename))
|
||||||
else:
|
else:
|
||||||
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
wo_mysql_repo = ("deb [arch=amd64,ppc64el] "
|
||||||
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
"http://sfo1.mirrors.digitalocean.com/mariadb/repo/"
|
||||||
"10.3/debian {codename} main"
|
"10.3/debian {codename} main"
|
||||||
.format(codename=wo_platform_codename))
|
.format(codename=wo_platform_codename))
|
||||||
|
|
||||||
wo_mysql = ["mariadb-server", "percona-toolkit", "python3-mysqldb"]
|
wo_mysql = ["mariadb-server", "percona-toolkit", "python3-mysqldb"]
|
||||||
|
|
||||||
wo_mysql_client = ["mariadb-client", "python3-mysqldb"]
|
wo_mysql_client = ["mariadb-client", "python3-mysqldb"]
|
||||||
|
|
||||||
wo_fail2ban = ["fail2ban"]
|
wo_fail2ban = ["fail2ban"]
|
||||||
|
|
||||||
# Redis repo details
|
# Redis repo details
|
||||||
if wo_distro == 'ubuntu':
|
if wo_distro == 'ubuntu':
|
||||||
wo_redis_repo = ("ppa:chris-lea/redis-server")
|
wo_redis_repo = ("ppa:chris-lea/redis-server")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all"
|
wo_redis_repo = ("deb https://packages.sury.org/php/ {codename} all"
|
||||||
.format(codename=wo_platform_codename))
|
.format(codename=wo_platform_codename))
|
||||||
|
|
||||||
wo_redis = ['redis-server', 'php-redis']
|
wo_redis = ['redis-server', 'php-redis']
|
||||||
|
|
||||||
# Repo path
|
# Repo path
|
||||||
wo_repo_file = "wo-repo.list"
|
wo_repo_file = "wo-repo.list"
|
||||||
wo_repo_file_path = ("/etc/apt/sources.list.d/" + wo_repo_file)
|
wo_repo_file_path = ("/etc/apt/sources.list.d/" + wo_repo_file)
|
||||||
|
|
||||||
# Application dabase file path
|
# Application dabase file path
|
||||||
basedir = os.path.abspath(os.path.dirname('/var/lib/wo/'))
|
basedir = os.path.abspath(os.path.dirname('/var/lib/wo/'))
|
||||||
wo_db_uri = 'sqlite:///' + os.path.join(basedir, 'dbase.db')
|
wo_db_uri = 'sqlite:///' + os.path.join(basedir, 'dbase.db')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user