Merge pull request #338 from WordOps/updating-configuration

Fix install
This commit is contained in:
VirtuBox
2020-10-29 15:25:42 +01:00
committed by GitHub
9 changed files with 76 additions and 35 deletions

View File

@@ -1,6 +1,17 @@
name: CI name: CI
on: [push, pull_request] on:
push:
branches:
- updating-configuration
- master
pull_request:
branches:
- master
release:
types: [published]
schedule:
- cron: '0 0 * * 0'
jobs: jobs:
build: build:
@@ -15,13 +26,14 @@ jobs:
- name: Prepare VM - name: Prepare VM
run: | run: |
unset LANG unset LANG
sudo apt update -qq echo "$HOME" && sudo echo "$HOME"
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y echo "$PWD"
sudo apt update -qq > /dev/null 2>&1
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php -y > /dev/null 2>&1
sudo rm -rf /etc/mysql /var/lib/mysql sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get purge --option=Dpkg::options::=--force-all --assume-yes graphviz* redis* php* mysql* sudo apt-get purge --option=Dpkg::options::=--force-all --assume-yes graphviz* redis* php* mysql* > /dev/null 2>&1
sudo apt-get install -qq git python3-setuptools python3-dev python3-apt python3-wheel python3-pip ccze tree sudo apt-get install -qq git ccze tree > /dev/null 2>&1
sudo apt-get -qq autoremove --purge sudo apt-get -qq autoremove --purge > /dev/null 2>&1
sudo python3 setup.py sdist bdist_wheel
sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > $HOME/.gitconfig' sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > $HOME/.gitconfig'
- name: Install WordOps - name: Install WordOps
run: sudo timeout 1800 bash install --travis run: sudo timeout 1800 bash install --travis

View File

@@ -11,6 +11,7 @@
<p align="center"> <p align="center">
<a href="https://travis-ci.org/WordOps/WordOps" target="_blank"><img src="https://travis-ci.org/WordOps/WordOps.svg?branch=master" alt="build"></a> <a href="https://travis-ci.org/WordOps/WordOps" target="_blank"><img src="https://travis-ci.org/WordOps/WordOps.svg?branch=master" alt="build"></a>
<a href="https://github.com/WordOps/WordOps/actions" target="_blank"><img src="https://github.com/WordOps/WordOps/workflows/CI/badge.svg?branch=master" alt="CI"></a>
<img src="https://img.shields.io/github/license/wordops/wordops.svg?cacheSeconds=86400" alt="MIT"> <img src="https://img.shields.io/github/license/wordops/wordops.svg?cacheSeconds=86400" alt="MIT">
<img src="https://img.shields.io/github/last-commit/wordops/wordops.svg?cacheSeconds=86400" alt="Commits"> <img src="https://img.shields.io/github/last-commit/wordops/wordops.svg?cacheSeconds=86400" alt="Commits">
<img alt="GitHub release" src="https://img.shields.io/github/release/WordOps/WordOps.svg"> <img alt="GitHub release" src="https://img.shields.io/github/release/WordOps/WordOps.svg">
@@ -158,7 +159,7 @@ For any other questions about WordOps or if you need support, please use the [Co
# Contributing # Contributing
If you'd like to contribute, please fork the reposi7tory and make changes as you'd like. Pull requests are warmly welcome. If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
There is no need to be a developer or a system administrator to contribute to WordOps project. You can still contribute by helping us to improve [WordOps documentation](https://github.com/WordOps/docs.wordops.net). There is no need to be a developer or a system administrator to contribute to WordOps project. You can still contribute by helping us to improve [WordOps documentation](https://github.com/WordOps/docs.wordops.net).
## Credits ## Credits

13
install
View File

@@ -468,16 +468,17 @@ wo_install() {
else else
python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"
fi fi
cp -rf /opt/wo/lib/python3."$python_ver"/site-packages/usr/* /usr/ local python_venv
cp -rn /opt/wo/lib/python3."$python_ver"/site-packages/etc/* /etc/ python_venv=$(python3 -c "import sys; print(sys.version_info[1])")
cp -f /opt/wo/lib/python3."$python_ver"/site-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc cp -rf /opt/wo/lib/python3."$python_venv"/site-packages/usr/* /usr/
rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_ver"/dist-packages/{etc,usr} cp -rn /opt/wo/lib/python3."$python_venv"/site-packages/etc/* /etc/
cp -f /opt/wo/lib/python3."$python_venv"/site-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_venv"/dist-packages/{etc,usr}
ln -s /opt/wo/bin/wo /usr/local/bin/ ln -s /opt/wo/bin/wo /usr/local/bin/
deactivate deactivate
if ! { /usr/local/bin/wo >/dev/null 2>&1; }; then if [ ! -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ];then
python3 -m venv --system-site-packages /opt/wo python3 -m venv --system-site-packages /opt/wo
fi fi
} }
# Clone Github repository if it doesn't exist # Clone Github repository if it doesn't exist

View File

@@ -237,7 +237,7 @@ echo -e "${CGREEN}#############################################${CEND}"
echo -ne " Upgrading mariadb [..]\r" echo -ne " Upgrading mariadb [..]\r"
if { if {
wo stack migrate --mariadb --force wo stack migrate --mariadb --force --ci
} >>/var/log/wo/test.log; then } >>/var/log/wo/test.log; then
echo -ne " Upgrading mariadb [${CGREEN}OK${CEND}]\\r" echo -ne " Upgrading mariadb [${CGREEN}OK${CEND}]\\r"
echo -ne '\n' echo -ne '\n'

View File

@@ -380,14 +380,15 @@ def setupwordpress(self, data, vhostonly=False):
# set all wp-config.php variables # set all wp-config.php variables
wp_conf_variables = [ wp_conf_variables = [
['WP_CACHE_KEY_SALT', '{0}:'.format(wo_domain_name)], ['WP_REDIS_PREFIX', '{0}:'.format(wo_domain_name)],
['WP_MEMORY_LIMIT', '128M'], ['WP_MEMORY_LIMIT', '128M'],
['WP_MAX_MEMORY_LIMIT', '256M'], ['WP_MAX_MEMORY_LIMIT', '256M'],
['CONCATENATE_SCRIPTS', 'false'], ['CONCATENATE_SCRIPTS', 'false'],
['WP_POST_REVISIONS', '10'], ['WP_POST_REVISIONS', '10'],
['MEDIA_TRASH', 'true'], ['MEDIA_TRASH', 'true'],
['EMPTY_TRASH_DAYS', '15'], ['EMPTY_TRASH_DAYS', '15'],
['WP_AUTO_UPDATE_CORE', 'minor']] ['WP_AUTO_UPDATE_CORE', 'minor'],
['WP_REDIS_DISABLE_BANNERS', 'true']]
Log.wait(self, "Configuring WordPress") Log.wait(self, "Configuring WordPress")
for wp_conf in wp_conf_variables: for wp_conf in wp_conf_variables:
wp_var = wp_conf[0] wp_var = wp_conf[0]

View File

@@ -49,6 +49,8 @@ class WOStackController(CementBaseController):
dict(help='Install PHP 7.4 stack', action='store_true')), dict(help='Install PHP 7.4 stack', action='store_true')),
(['--mysql'], (['--mysql'],
dict(help='Install MySQL stack', action='store_true')), dict(help='Install MySQL stack', action='store_true')),
(['--mariadb'],
dict(help='Install MySQL stack alias', action='store_true')),
(['--mysqlclient'], (['--mysqlclient'],
dict(help='Install MySQL client for remote MySQL server', dict(help='Install MySQL client for remote MySQL server',
action='store_true')), action='store_true')),
@@ -120,7 +122,7 @@ class WOStackController(CementBaseController):
pargs.dashboard or pargs.fail2ban or pargs.security or pargs.dashboard or pargs.fail2ban or pargs.security or
pargs.mysqlclient or pargs.mysqltuner or pargs.mysqlclient or pargs.mysqltuner or
pargs.admin or pargs.adminer or pargs.admin or pargs.adminer or
pargs.utils or pargs.redis or pargs.utils or pargs.redis or pargs.mariadb or
pargs.proftpd or pargs.extplorer or pargs.proftpd or pargs.extplorer or
pargs.clamav or pargs.cheat or pargs.nanorc or pargs.clamav or pargs.cheat or pargs.nanorc or
pargs.ufw or pargs.ngxblocker or pargs.ufw or pargs.ngxblocker or
@@ -132,6 +134,9 @@ class WOStackController(CementBaseController):
if pargs.php: if pargs.php:
pargs.php72 = True pargs.php72 = True
if pargs.mariadb:
pargs.mysql = True
if pargs.all: if pargs.all:
pargs.web = True pargs.web = True
pargs.admin = True pargs.admin = True
@@ -555,6 +560,7 @@ class WOStackController(CementBaseController):
if ((not pargs.web) and (not pargs.admin) and if ((not pargs.web) and (not pargs.admin) and
(not pargs.nginx) and (not pargs.php) and (not pargs.nginx) and (not pargs.php) and
(not pargs.mysql) and (not pargs.wpcli) and (not pargs.mysql) and (not pargs.wpcli) and
(not pargs.mariadb) and
(not pargs.phpmyadmin) and (not pargs.composer) and (not pargs.phpmyadmin) and (not pargs.composer) and
(not pargs.netdata) and (not pargs.dashboard) and (not pargs.netdata) and (not pargs.dashboard) and
(not pargs.fail2ban) and (not pargs.security) and (not pargs.fail2ban) and (not pargs.security) and
@@ -572,6 +578,9 @@ class WOStackController(CementBaseController):
if pargs.php: if pargs.php:
pargs.php72 = True pargs.php72 = True
if pargs.mariadb:
pargs.mysql = True
if pargs.all: if pargs.all:
pargs.web = True pargs.web = True
pargs.admin = True pargs.admin = True
@@ -868,6 +877,7 @@ class WOStackController(CementBaseController):
if ((not pargs.web) and (not pargs.admin) and if ((not pargs.web) and (not pargs.admin) and
(not pargs.nginx) and (not pargs.php) and (not pargs.nginx) and (not pargs.php) and
(not pargs.mysql) and (not pargs.wpcli) and (not pargs.mysql) and (not pargs.wpcli) and
(not pargs.mariadb) and
(not pargs.phpmyadmin) and (not pargs.composer) and (not pargs.phpmyadmin) and (not pargs.composer) and
(not pargs.netdata) and (not pargs.dashboard) and (not pargs.netdata) and (not pargs.dashboard) and
(not pargs.fail2ban) and (not pargs.security) and (not pargs.fail2ban) and (not pargs.security) and
@@ -885,6 +895,9 @@ class WOStackController(CementBaseController):
if pargs.php: if pargs.php:
pargs.php72 = True pargs.php72 = True
if pargs.mariadb:
pargs.mysql = True
if pargs.all: if pargs.all:
pargs.web = True pargs.web = True
pargs.admin = True pargs.admin = True

View File

@@ -23,10 +23,14 @@ class WOStackMigrateController(CementBaseController):
(['--force'], (['--force'],
dict(help="Force Packages upgrade without any prompt", dict(help="Force Packages upgrade without any prompt",
action='store_true')), action='store_true')),
(['--ci'],
dict(help="Argument used for testing, "
"do not use it on your server",
action='store_true')),
] ]
@expose(hide=True) @expose(hide=True)
def migrate_mariadb(self): def migrate_mariadb(self, ci=False):
# Backup all database # Backup all database
WOMysql.backupAll(self, fulldump=True) WOMysql.backupAll(self, fulldump=True)
@@ -53,6 +57,9 @@ class WOStackMigrateController(CementBaseController):
WOAptGet.remove(self, ["mariadb-server"]) WOAptGet.remove(self, ["mariadb-server"])
WOAptGet.auto_remove(self) WOAptGet.auto_remove(self)
WOAptGet.install(self, WOVar.wo_mysql) WOAptGet.install(self, WOVar.wo_mysql)
if not ci:
WOAptGet.dist_upgrade(self)
WOAptGet.auto_remove(self)
Log.valide(self, "Upgrading MariaDB ") Log.valide(self, "Upgrading MariaDB ")
WOFileUtils.mvfile( WOFileUtils.mvfile(
self, '/etc/mysql/my.cnf', '/etc/mysql/my.cnf.old') self, '/etc/mysql/my.cnf', '/etc/mysql/my.cnf.old')
@@ -68,6 +75,8 @@ class WOStackMigrateController(CementBaseController):
if ((not pargs.mariadb)): if ((not pargs.mariadb)):
self.app.args.print_help() self.app.args.print_help()
if pargs.mariadb: if pargs.mariadb:
if WOVar.wo_distro == 'raspbian':
Log.error(self, "MariaDB upgrade is not available on Raspbian")
if WOVar.wo_mysql_host != "localhost": if WOVar.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")
@@ -82,7 +91,10 @@ class WOStackMigrateController(CementBaseController):
start_upgrade = input("Do you want to continue:[y/N]") start_upgrade = input("Do you want to continue:[y/N]")
if start_upgrade != "Y" and start_upgrade != "y": if start_upgrade != "Y" and start_upgrade != "y":
Log.error(self, "Not starting package update") Log.error(self, "Not starting package update")
self.migrate_mariadb() if not pargs.ci:
self.migrate_mariadb()
else:
self.migrate_mariadb(ci=True)
else: else:
Log.error(self, "Your current MySQL is not alive or " Log.error(self, "Your current MySQL is not alive or "
"you allready installed MariaDB") "you allready installed MariaDB")

View File

@@ -41,6 +41,9 @@ class WOStackUpgradeController(CementBaseController):
dict(help='Upgrade PHP 7.4 stack', action='store_true')), dict(help='Upgrade PHP 7.4 stack', action='store_true')),
(['--mysql'], (['--mysql'],
dict(help='Upgrade MySQL stack', action='store_true')), dict(help='Upgrade MySQL stack', action='store_true')),
(['--mariadb'],
dict(help='Upgrade MySQL stack alias',
action='store_true')),
(['--wpcli'], (['--wpcli'],
dict(help='Upgrade WPCLI', action='store_true')), dict(help='Upgrade WPCLI', action='store_true')),
(['--redis'], (['--redis'],
@@ -79,14 +82,18 @@ class WOStackUpgradeController(CementBaseController):
wo_phpmyadmin = WODownload.pma_release(self) wo_phpmyadmin = WODownload.pma_release(self)
if not (pargs.web or pargs.nginx or pargs.php or if not (pargs.web or pargs.nginx or pargs.php or
pargs.php72 or pargs.php73 or pargs.php74 or pargs.mysql or pargs.php72 or pargs.php73 or pargs.php74 or pargs.mysql or
pargs.ngxblocker or pargs.all or pargs.netdata or pargs.mariadb or pargs.ngxblocker or pargs.all
pargs.wpcli or pargs.composer or pargs.phpmyadmin or or pargs.netdata or pargs.wpcli or pargs.composer or
pargs.adminer or pargs.dashboard or pargs.mysqltuner or pargs.phpmyadmin or pargs.adminer or pargs.dashboard or
pargs.redis or pargs.fail2ban or pargs.security): pargs.mysqltuner or pargs.redis or
pargs.fail2ban or pargs.security):
pargs.web = True pargs.web = True
pargs.admin = True pargs.admin = True
pargs.security = True pargs.security = True
if pargs.mariadb:
pargs.mysql = True
if pargs.php: if pargs.php:
pargs.php72 = True pargs.php72 = True

View File

@@ -158,25 +158,19 @@ class WOVar():
wo_php_extra = ["graphviz"] wo_php_extra = ["graphviz"]
wo_mysql = ["mariadb-server", "percona-toolkit"] wo_mysql = [
"mariadb-server", "percona-toolkit",
"mariadb-common", "python3-mysqldb"]
if wo_distro == 'raspbian': if wo_distro == 'raspbian':
wo_mysql = wo_mysql + ["python3-mysqldb"]
if wo_platform_codename == 'stretch': if wo_platform_codename == 'stretch':
mariadb_ver = '10.1' mariadb_ver = '10.1'
else: else:
mariadb_ver = '10.3' mariadb_ver = '10.3'
else: else:
mariadb_ver = '10.5' mariadb_ver = '10.5'
if wo_platform_codename == 'jessie': wo_mysql = wo_mysql + ["mariadb-backup"]
wo_mysql = wo_mysql + ["python3-mysql.connector"]
else:
wo_mysql = wo_mysql + ["python3-mysqldb", "mariadb-backup"]
wo_mysql_client = ["mariadb-client"] wo_mysql_client = ["mariadb-client", "python3-mysqldb"]
if wo_platform_codename == 'jessie':
wo_mysql_client = wo_mysql_client + ["python3-mysqldb"]
else:
wo_mysql_client = wo_mysql_client + ["python3-mysql.connector"]
wo_fail2ban = ["fail2ban"] wo_fail2ban = ["fail2ban"]
wo_clamav = ["clamav", "clamav-freshclam"] wo_clamav = ["clamav", "clamav-freshclam"]