Browse Source

backup name

master
M.Goldshteyn 1 year ago
parent
commit
540734953b
  1. 19
      migration.sh
  2. 2
      task.txt

19
migration.sh

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
#!/bin/bash
#install sshpass if not installed
if [ $(dpkg-query -W -f='${Status}' sshpass 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
apt update && apt-get install sshpass;
@ -41,7 +41,7 @@ send_backup() { @@ -41,7 +41,7 @@ send_backup() {
else echo "no backup, nothing to send" && exit
fi
}
create_db() {
create_and_restore_db() {
sed -e "s/DESTINATION_DB_NAME/${DESTINATION_DB_NAME}/" \
-e "s/DESTINATION_POSTGRES_PASSWORD/${DESTINATION_POSTGRES_PASSWORD}/"\
-e "s/DB_BACKUP/${DB_BACKUP}/"\
@ -49,14 +49,17 @@ create_db() { @@ -49,14 +49,17 @@ create_db() {
sshpass -p "$DESTINATION_DATABASE_PASSWORD" ssh -p $DESTINATION_DATABASE_PORT $DESTINATION_DATABASE_USER@$DESTINATION_DATABASE_IP 'bash -s' < create_db.sh
}
#restore_db(){
# if [[ "$EVENT_STORE" == 0 ]] or [[ "$EVENT_STORE" == 1 ]]; then
# fi
#}
change_config(){
sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "sed -i \"s|\(jdbc:postgresql://localhost:5432/\)[^?]*|\1${DESTINATION_DB_NAME}|g\" $DESTINATION_PLATFORM_PATH/conf/db.conf"
}
db_backup
send_backup
create_db
#restore_db
create_and_restore_db
change_config
evt_full_rsync(){
echo "send $SOURCE_EVT to the destination"

2
task.txt

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
+5. Отправка его на удаленный сервер
+6. Создание базы
7. Вотсановление дампа
+7. Вотсановление дампа
8. скачиванние платформы, ветку берем из конфига. фронт и бэк.

Loading…
Cancel
Save