Clone Production to Development

From Zenoss Wiki
Revision as of 15:59, 18 November 2013 by Crouthamela (Talk | contribs)$7

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Of course you never do Dev work in Production right? Well, here's a script that will clone your production environment into development so that you can do dev work against something safer.

#stop Zenoss
zenoss stop
#create a fresh DB backup, and copy it over
ssh zenoss@$PRODHOST zenbackup --no-perfdata --no-eventsdb --file=/tmp/transitionbackup
scp zenoss@$PRODHOST:/tmp/transitionbackup /tmp
ssh zenoss@$PRODHOST rm /tmp/transitionbackup
#pull across the directories we want to keep in sync
for i in bin ZenPacks perf Products scripts; do
    rsync -a --delete zenoss@$PRODHOST:$ZENHOME/$i/* $ZENHOME/$i
# Start the restore into the test system
zenrestore --file=/tmp/transitionbackup
rm /tmp/transitionbackup
#Prevent the collectors from starting up on the testing system
echo "zeneventserver"  >> $ZENHOME/etc/daemons.txt
echo "zopectl"  >> $ZENHOME/etc/daemons.txt
echo "zenhub" >> $ZENHOME/etc/daemons.txt
#and now startup Zenoss
zenoss start