Skip to content

Commit

Permalink
Ensure jq is installed on all production servers (#759)
Browse files Browse the repository at this point in the history
* ensure jq is installed on all production servers

* fix file path used when rsyncing minio and metabase data to backup server
  • Loading branch information
rikukissa authored Oct 17, 2023
1 parent 66e595f commit d48b30f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
15 changes: 10 additions & 5 deletions infrastructure/emergency-backup-metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,19 @@ else
fi

echo "Creating a backup for Minio"
cd $ROOT_PATH/minio && tar -zcvf $ROOT_PATH/backups/minio/ocrvs-${LABEL:-$BACKUP_DATE}.tar.gz . && cd /

LOCAL_MINIO_BACKUP=$ROOT_PATH/backups/minio/ocrvs-${LABEL:-$BACKUP_DATE}.tar.gz
cd $ROOT_PATH/minio && tar -zcvf $LOCAL_MINIO_BACKUP . && cd /

echo "Creating a backup for Metabase"

cd $ROOT_PATH/metabase && tar -zcvf $ROOT_PATH/backups/metabase/ocrvs-${LABEL:-$BACKUP_DATE}.tar.gz . && cd /
LOCAL_METABASE_BACKUP=$ROOT_PATH/backups/metabase/ocrvs-${LABEL:-$BACKUP_DATE}.tar.gz
cd $ROOT_PATH/metabase && tar -zcvf $LOCAL_METABASE_BACKUP . && cd /

echo "Creating a backup for VSExport"
cd $ROOT_PATH/vsexport && tar -zcvf $ROOT_PATH/backups/vsexport/ocrvs-${LABEL:-$BACKUP_DATE}.tar.gz . && cd /

LOCAL_VSEXPORT_BACKUP=$ROOT_PATH/backups/vsexport/ocrvs-${LABEL:-$BACKUP_DATE}.tar.gz
cd $ROOT_PATH/vsexport && tar -zcvf $LOCAL_VSEXPORT_BACKUP . && cd /

if [[ "$IS_LOCAL" = true ]]; then
echo $WORKING_DIR
Expand All @@ -305,8 +310,8 @@ fi
#----------------------------------------------------
if [[ "$OWN_IP" = "$PRODUCTION_IP" || "$OWN_IP" = "$(dig $PRODUCTION_IP +short)" ]]; then
script -q -c "rsync -a -r --progress --rsh='ssh -p$SSH_PORT' $ROOT_PATH/backups/elasticsearch/ $SSH_USER@$SSH_HOST:$REMOTE_DIR/elasticsearch" && echo "Copied elasticsearch backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $ROOT_PATH/backups/minio/${LABEL:-$BACKUP_DATE} $SSH_USER@$SSH_HOST:$REMOTE_DIR/minio" && echo "Copied minio backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $ROOT_PATH/backups/metabase/${LABEL:-$BACKUP_DATE} $SSH_USER@$SSH_HOST:$REMOTE_DIR/metabase" && echo "Copied Metabase backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $LOCAL_MINIO_BACKUP $SSH_USER@$SSH_HOST:$REMOTE_DIR/minio" && echo "Copied minio backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $LOCAL_METABASE_BACKUP $SSH_USER@$SSH_HOST:$REMOTE_DIR/metabase" && echo "Copied Metabase backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $ROOT_PATH/backups/influxdb/${LABEL:-$BACKUP_DATE} $SSH_USER@$SSH_HOST:$REMOTE_DIR/influxdb" && echo "Copied influx backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $ROOT_PATH/backups/mongo/hearth-dev-${LABEL:-$BACKUP_DATE}.gz $SSH_USER@$SSH_HOST:$REMOTE_DIR/mongo" && echo "Copied hearth backup files to remote server."
script -q -c "rsync -a -r --ignore-existing --progress --rsh='ssh -p$SSH_PORT' $ROOT_PATH/backups/mongo/user-mgnt-${LABEL:-$BACKUP_DATE}.gz $SSH_USER@$SSH_HOST:$REMOTE_DIR/mongo" && echo "Copied user backup files to remote server."
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/server-setup/playbook-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
name: python3-pip
state: present

- name: 'Install jq'
apt:
name: jq
state: present

- name: 'Install pexpect python module for ansible expect commands'
pip:
name: pexpect
Expand Down
7 changes: 6 additions & 1 deletion infrastructure/server-setup/playbook-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
name: python3-pip
state: present

- name: 'Install jq'
apt:
name: jq
state: present

- name: 'Install pexpect python module for ansible expect commands'
pip:
name: pexpect
Expand Down Expand Up @@ -366,7 +371,7 @@
apt:
name: fail2ban
state: present

- name: 'Copy fail2ban jail.local'
copy:
src: ../jail.local
Expand Down
9 changes: 7 additions & 2 deletions infrastructure/server-setup/playbook-5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
name: python3-pip
state: present

- name: 'Install jq'
apt:
name: jq
state: present

- name: 'Install pexpect python module for ansible expect commands'
pip:
name: pexpect
Expand Down Expand Up @@ -350,12 +355,12 @@
ufw:
rule: allow
name: OpenSSH

- name: 'Install Fail2Ban'
apt:
name: fail2ban
state: present

- name: 'Copy fail2ban jail.local'
copy:
src: ../jail.local
Expand Down

0 comments on commit d48b30f

Please sign in to comment.