Merge pull request #87 from WordOps/updating-configuration

Updating configuration
This commit is contained in:
VirtuBox
2019-06-17 12:50:32 +02:00
committed by GitHub
3 changed files with 44 additions and 26 deletions

View File

@@ -55,5 +55,5 @@ script:
- sudo wo info || sudo tail -n50 /var/log/wo/wordops.log - sudo wo info || sudo tail -n50 /var/log/wo/wordops.log
- sudo tree -L 2 /etc/nginx - sudo tree -L 2 /etc/nginx
- sudo cat /var/www/wpredis.net/wp-config.php - sudo cat /var/www/wpredis.net/wp-config.php
- echo "127.0.0.1 wpredis.net" | sudo tee -a /etc/hosts - sudo wo update --travis || sudo tail -n50 /var/log/wo/wordops.log
- curl -sL http://wpredis.net/robots.txt - sudo wo stack status

26
install
View File

@@ -254,7 +254,7 @@ wo_sync_db() {
wo_site_current_type=$(grep "common/" /etc/nginx/sites-available/$site | awk -F "/" '{print $2}') wo_site_current_type=$(grep "common/" /etc/nginx/sites-available/$site | awk -F "/" '{print $2}')
if [ "$(echo $wo_site_current_type | grep php)" ]; then if [ -n "$(echo $wo_site_current_type | grep php)" ]; then
if [ "$(echo $wo_site_current_type | grep php7)" ]; then if [ "$(echo $wo_site_current_type | grep php7)" ]; then
wo_php_version="7.0" wo_php_version="7.0"
else else
@@ -488,17 +488,19 @@ wo_upgrade_nginx() {
if [ -d /etc/nginx ]; then if [ -d /etc/nginx ]; then
rm -rf /etc/nginx rm -rf /etc/nginx
fi fi
# remove previous php-fpm pool configuration if [ -z "$(/usr/local/bin/wo -v | grep 3.9.5)" ]; then
if [ -n "$CHECK_PHP72" ]; then # remove previous php-fpm pool configuration
apt-get remove php7.2-fpm -y -qq --purge if [ -n "$CHECK_PHP72" ]; then
rm -f /etc/php/7.2/fpm/pool.d/{www.conf,www-two.conf,debug.conf} apt-get remove php7.2-fpm -y -qq --purge
fi rm -f /etc/php/7.2/fpm/pool.d/{www.conf,www-two.conf,debug.conf}
if [ -n "$CHECK_PHP73" ]; then fi
WO_STACK_INSTALL_ARGS="--php73" if [ -n "$CHECK_PHP73" ]; then
apt-get remove php7.3-fpm -y -qq --purge WO_STACK_INSTALL_ARGS="--php73"
rm -f /etc/php/7.3/fpm/pool.d/{www.conf,www-two.conf,debug.conf} apt-get remove php7.3-fpm -y -qq --purge
else rm -f /etc/php/7.3/fpm/pool.d/{www.conf,www-two.conf,debug.conf}
WO WO_STACK_INSTALL_ARGS="" else
WO_STACK_INSTALL_ARGS=""
fi
fi fi
/usr/local/bin/wo stack install --nginx --php "$WO_STACK_INSTALL_ARGS" /usr/local/bin/wo stack install --nginx --php "$WO_STACK_INSTALL_ARGS"
echo "$wo_version_new" > /etc/nginx/common/release echo "$wo_version_new" > /etc/nginx/common/release

View File

@@ -21,30 +21,46 @@ class WOUpdateController(CementBaseController):
arguments = [ arguments = [
(['--force'], (['--force'],
dict(help='Force WordOps update', action='store_true')), dict(help='Force WordOps update', action='store_true')),
(['--travis'],
dict(help='Argument used only for WordOps development',
action='store_true')),
] ]
usage = "wo update [options]" usage = "wo update [options]"
@expose(hide=True) @expose(hide=True)
def default(self): def default(self):
filename = "woupdate" + time.strftime("%Y%m%d-%H%M%S") filename = "woupdate" + time.strftime("%Y%m%d-%H%M%S")
WODownload.download(self, [["https://raw.githubusercontent.com/"
"WordOps/WordOps/master/install", if self.app.pargs.travis:
"/tmp/{0}".format(filename), WODownload.download(self, [["https://raw.githubusercontent.com/"
"update script"]]) "WordOps/WordOps/updating-configuration/install",
if self.app.pargs.force: "/tmp/{0}".format(filename),
"update script"]])
try: try:
Log.info(self, "updating WordOps, please wait...") Log.info(self, "updating WordOps, please wait...")
os.system("bash /tmp/{0} --force".format(filename)) os.system("bash /tmp/{0} --travis --force".format(filename))
except OSError as e: except OSError as e:
Log.debug(self, str(e)) Log.debug(self, str(e))
Log.error(self, "WordOps update failed !") Log.error(self, "WordOps update failed !")
else: else:
try: WODownload.download(self, [["https://raw.githubusercontent.com/"
Log.info(self, "updating WordOps, please wait...") "WordOps/WordOps/master/install",
os.system("bash /tmp/{0}".format(filename)) "/tmp/{0}".format(filename),
except OSError as e: "update script"]])
Log.debug(self, str(e)) if self.app.pargs.force:
Log.error(self, "WordOps update failed !") try:
Log.info(self, "updating WordOps, please wait...")
os.system("bash /tmp/{0} --force".format(filename))
except OSError as e:
Log.debug(self, str(e))
Log.error(self, "WordOps update failed !")
else:
try:
Log.info(self, "updating WordOps, please wait...")
os.system("bash /tmp/{0}".format(filename))
except OSError as e:
Log.debug(self, str(e))
Log.error(self, "WordOps update failed !")
def load(app): def load(app):