Hey, when updating barracuda i run into this issue which I pretty sure created myself. When installing the BOA stack for the first time i ignored the DNS lookup check because the DNS records had a long expiration time and i didn't want to wait. Than i "fixed" the IP adress in the important config files which works fine until i update BOA than this drushrc.php files get generated:

drushrc.php: '@server_master' => 'WRONG.IP.ADDRESS',

Where do i need to reset the IP?

Comments

omega8cc’s picture

Status: Closed (fixed) » Fixed

First, you have to replace IPs in all server config files where they are used:

sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /var/aegir/.drush/*.php
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /var/aegir/config/server_master/nginx.conf
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /var/aegir/config/server_master/nginx/pre.d/*
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /var/aegir/config/server_master/nginx/vhost.d/*
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /var/aegir/clients/*/*/*.php
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /var/aegir/host_master/*/sites/*/*.php
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/.drush/*.php
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/config/server_master/nginx/vhost.d/*
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/clients/*/*/*.php
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/aegir/distro/*/sites/*/*.php
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/.drush/provision/http/nginx/*.conf
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/config/server_master/nginx.conf
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/config/server_master/nginx/vhost.d/*
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /opt/etc/php-fpm.conf
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /opt/local/etc/php53-fpm.conf
sed -i "s/WRONG.IP.ADDRESS/CORRECT.IP.ADDRESS/g" /data/disk/*/config/includes/*

Now type "mysql" as root and do the same for db server grants:

UPDATE `mysql`.`user` SET Host = REPLACE(Host, 'WRONG.IP.ADDRESS', 'CORRECT.IP.ADDRESS');
UPDATE `mysql`.`db` SET Host = REPLACE(Host, 'WRONG.IP.ADDRESS', 'CORRECT.IP.ADDRESS');

Now you will need two scripts we have used to fix the problem. Note that octopusXdbname is a placeholder for your real dbnames of satellite hostmasters to fix. You could avoid adding more elif if all hostmasters share some specific string in the dbname.

$ nano fix-hosting_ip_addresses

#!/bin/bash
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
mysql -e "show databases" -s > .databasesToFix;
cat .databasesToFix | while read line; do
  if [[ "$line" =~ "octopus1dbname" ]] ; then
    mysql -e "UPDATE $line.hosting_ip_addresses SET ip_address = REPLACE(ip_address, 'WRONG.IP.ADDRESS', 'CORRECT.IP.ADDRESS');"
    echo fix completed for $line database
    sleep 1
  elif [[ "$line" =~ "octopus2dbname" ]] ; then
    mysql -e "UPDATE $line.hosting_ip_addresses SET ip_address = REPLACE(ip_address, 'WRONG.IP.ADDRESS', 'CORRECT.IP.ADDRESS');"
    echo fix completed for $line database
    sleep 1
  elif [[ "$line" =~ "octopus3dbname" ]] ; then
    mysql -e "UPDATE $line.hosting_ip_addresses SET ip_address = REPLACE(ip_address, 'WRONG.IP.ADDRESS', 'CORRECT.IP.ADDRESS');"
    echo fix completed for $line database
    sleep 1
  fi
done
rm .databasesToFix
echo COMPLETED ALL

$ bash fix-hosting_ip_addresses

Then:

$ nano fix-server_master

#!/bin/bash
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
action()
{
for User in `find /data/disk/ -maxdepth 1 -mindepth 1 | sort`
do
  NOW_LOAD=`awk '{print $1*100}' /proc/loadavg`
  CTL_LOAD=8888
  if [ -e "$User/config/server_master/nginx/vhost.d" ] ; then
    if [ $NOW_LOAD -lt $CTL_LOAD ] ; then
      _THIS_HM_USER=`echo $User | cut -d'/' -f4 | awk '{ print $1}'`
      _THIS_HM_SITE=`cat $User/.drush/hostmaster.alias.drushrc.php | grep "site_path'" | cut -d: -f2 | awk '{ print $3}' | sed "s/[\,']//g"`
      echo Fixing User $User
      if [ -e "$_THIS_HM_SITE" ] ; then
        su -s /bin/bash - $_THIS_HM_USER -c "drush @hostmaster hosting-task @server_master verify --force"
      fi
      echo Done for $User
    else
      echo load is $NOW_LOAD while maxload is $CTL_LOAD
      echo ...we have to wait...
    fi
    echo
  fi
done
}
action

$ bash fix-server_master

Status: Active » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

AntiNSA’s picture

Status: Fixed » Active

sed -i "s/106.187.42.64/106.187.37.184/g" /data/disk/*/clients/*/*/*.php

no such file or directory on latest head////

AntiNSA’s picture

sed -i "s/106.187.42.64/106.187.37.184/g" /data/disk/*/.drush/provision/http/nginx/*.conf

no such file or directory on latest head////

AntiNSA’s picture

UPDATE `mysql`.`db` SET Host = REPLACE(Host, '106.187.42.64', '106.187.37.184');

changed: 0

omega8cc’s picture

Status: Active » Closed (fixed)