forked from Katello/katello
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Katello#6 from weissjeffm/master
New restore.sh script to restore a backup of katello's data
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash -e | ||
BDIR=$(readlink -f "$1") | ||
cd $BDIR | ||
|
||
#shut everything down | ||
service katello stop | ||
service katello-jobs stop | ||
service pulp-server stop | ||
service tomcat6 stop | ||
service postgresql stop | ||
service elasticsearch stop | ||
|
||
#extract files | ||
tar --selinux -xzvf config_files.tar.gz -C / | ||
tar --selinux -xzvf elastic_data.tar.gz -C / | ||
tar --selinux -xvf pulp_data.tar -C / | ||
|
||
#restore dbs | ||
service postgresql start | ||
sleep 5 | ||
dropdb -U postgres katelloschema | ||
dropdb -U postgres candlepin | ||
|
||
pg_restore -U postgres -C -d postgres $BDIR/katello.dump | ||
pg_restore -U postgres -C -d postgres $BDIR/candlepin.dump | ||
|
||
service mongod start | ||
sleep 5 | ||
echo 'db.dropDatabase();' | mongo pulp_database | ||
|
||
mongorestore --host localhost mongo_dump/pulp_database/ | ||
|
||
service postgresql start | ||
service tomcat6 start | ||
service pulp-server start | ||
service elasticsearch start | ||
service katello-jobs start | ||
service katello start |