Browse Source

internal ip

master
M.Goldshteyn 1 year ago
parent
commit
c8dc3c1209
  1. 4
      config.txt
  2. 36
      migration.sh

4
config.txt

@ -60,6 +60,10 @@ DESTINATION_PORT=22 @@ -60,6 +60,10 @@ DESTINATION_PORT=22
#IP локалки с базой
DESTINATION_DATABASE_IP=217.107.34.92
#Локальный ip машины с базой. Если платформа и бд на одной вм, то 127.0.0.1
INTERNAL_DATABASE_IP=192.168.10.98
#Пользователь локалки с базой
DESTINATION_DATABASE_USER=root

36
migration.sh

@ -29,9 +29,8 @@ download_platform(){ @@ -29,9 +29,8 @@ download_platform(){
sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "systemctl is-active --quiet platform5.service && systemctl stop platform5 "
sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "mv /home/platform5-server /home/platform5-server-${DATE} && \
mkdir -p /home/platform5-server && \
mkdir -p /home/platform5-server/bin/storage/1"
PLATFORM_DIRS="conf,lib,opencv,webapp,scripts,SERVER_config.txt"
PLATFORM_DIRS="conf,lib,opencv,webapp,scripts,monitoring,SERVER_config.txt"
IFS=',' read -r -a array <<< "$PLATFORM_DIRS"
for folder in "${array[@]}"; do
@ -80,8 +79,9 @@ create_and_restore_db() { @@ -80,8 +79,9 @@ create_and_restore_db() {
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 wo host sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "sed -i \"s|\(jdbc:postgresql://[^:/]*:[0-9]*/\)[^?]*|\1${DESTINATION_DB_NAME}|g\" $DESTINATION_PLATFORM_PATH/conf/db.conf"
sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "sed -i \"s|\(jdbc:postgresql://[^:/]*:[0-9]*/\)[^?]*|\1${DESTINATION_DB_NAME}|g\" $DESTINATION_PLATFORM_PATH/conf/db.conf"
sshpass -p "$DESTINATION_PASSWORD" ssh $DESTINATION_USER@$DESTINATION_IP -p $DESTINATION_PORT "sed -i \"s|\(jdbc:postgresql://[^:/]*:[0-9]*/\)[^?]*|\1${INTERNAL_DATABASE_IP}:5432/${DESTINATION_DB_NAME}|g\" $DESTINATION_PLATFORM_PATH/conf/db.conf"
}
@ -116,19 +116,23 @@ fonts_rsync(){ @@ -116,19 +116,23 @@ fonts_rsync(){
}
fonts_rsync
if [[ "$EVT_COMMON" == 0 ]]; then
echo "Download only files from evt/common"
evt_common_files_rsync
elif [[ "$EVT_COMMON" == 1 ]]; then
echo "Download full evt"
evt_full_rsync
elif [[ "$EVT_COMMON" == 2 ]]; then
echo "Nothing to download from storage"
elif [[ "$EVT_COMMON" == 3 ]]; then
echo "Download specified folders"
evt_specific_dirs_rsync
else echo "EVENT_COMMON value must be 0 or 1 or 2" && exit
fi
if [[ "$EVT_COMMON" == 0 ]]; then
echo "Download only files from evt/common"
evt_common_files_rsync
elif [[ "$EVT_COMMON" == 1 ]]; then
echo "Download full evt"
evt_full_rsync
elif [[ "$EVT_COMMON" == 2 ]]; then
echo "Nothing to download from storage"
elif [[ "$EVT_COMMON" == 3 ]]; then
echo "Download specified folders"
evt_specific_dirs_rsync
else echo "EVENT_COMMON value must be 0 or 1 or 2" && exit
fi
mv config.txt config.txt.$DATE
mv config.txt.template config.txt

Loading…
Cancel
Save