Skip to content

Commit

Permalink
synchro with bitbucket 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
frsauvage committed Sep 16, 2020
1 parent 4770ef6 commit 924d324
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
16 changes: 7 additions & 9 deletions backup_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VERBOSE=""
CONTAINER="pgadmin"
BASEDIR=$(dirname $0)
USER="mism"
DB="mism"
DB=""

usage()
{
Expand Down Expand Up @@ -33,10 +33,6 @@ while getopts "vu:t:f:" option; do
esac
done

echo "TARGET=$TARGET"
echo "FILENAME=$FILENAME"
echo "USER=$USER"

if [ -z ${FILENAME} ]
then
usage
Expand All @@ -61,16 +57,17 @@ fi
if [ ${TARGET} = "awx" ]
then
HOST="awx_postgres"
DB="mism"

fi

if [ ${TARGET} = "zabbix" ]
then
HOST="zabbix-postgres"
DB="zabbix"
fi

echo "HOST=$HOST"
export DEST_DIR="storage/pgadmin_bullsequana.com"
echo "DEST_DIR=$DEST_DIR"

if [ ! -d $DEST_DIR ]
then
Expand All @@ -87,9 +84,10 @@ fi

if [ ! -f $DEST_DIR/$FILENAME ]
then
echo ">> Database dump not generated in $DEST_DIR/$FILENAME !!!"

echo -e "\e[101m>> Database dump not generated in $DEST_DIR/$FILENAME !!!\e[0m"
exit -1
fi

echo ">> The Database dump is saved under $BASEDIR/$DEST_DIR/${FILENAME}"
echo -e "\e[42m>> The Database dump is saved under $BASEDIR/$DEST_DIR/${FILENAME}\e[0m"

2 changes: 1 addition & 1 deletion install_awx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ echo "starting BullSequana Edge Ansible AWX containers ...."
docker-compose -f docker_compose_awx.yml up -d

echo "----------------------------------------------------------------------------------------------------"
echo "now wait 10 minutes for the migration to complete...."
echo -e "Now wait \e[101m10 minutes\e[0m for the migration to complete...."
echo "check the login page at https://localhost"
echo "and run ./add_awx_playbooks.sh"
echo "AWX is available on https://localhost"
Expand Down
17 changes: 8 additions & 9 deletions restore_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ while getopts "vu:t:f:" option; do
esac
done

echo "TARGET=$TARGET"
echo "FILENAME=$FILENAME"
echo "USER=$USER"

if [ -z ${FILENAME} ]
then
usage
Expand All @@ -46,19 +42,22 @@ fi
if [ ${TARGET} = "awx" ]
then
HOST="awx_postgres"
DB="mism"
fi

if [ ${TARGET} = "zabbix" ]
then
HOST="zabbix-postgres"
DB="zabbix"
fi

echo "HOST=$HOST"

docker exec -e PGPASSWORD=${PWD} ${CONTAINER} /usr/local/pgsql-12/pg_restore --host ${HOST} --port "5432" --username=${USER} --dbname $DB -c ${VERBOSE} "/var/lib/pgadmin/storage/pgadmin_bullsequana.com/${FILENAME}"

if [ $? -ne 0 ]; then
echo ">> Database restore failed !!!"
else
echo ">> The Database is restored !"
echo -e "\e[101m>> The database restore failed !!! \e[0m"
exit -1
fi

echo -e "\e[42m>> The database is restored ! \e[0m"


0 comments on commit 924d324

Please sign in to comment.