Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 1061a30

Browse files
dmiusDmitry
authored andcommitted
Fixes
1 parent f80a583 commit 1061a30

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

nancy_run.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ CURRENT_TS=$(date +%Y%m%d_%H%M%S%N_%Z)
55
DOCKER_MACHINE="${DOCKER_MACHINE:-nancy-$CURRENT_TS}"
66
DOCKER_MACHINE="${DOCKER_MACHINE//_/-}"
77
DEBUG_TIMEOUT=0
8-
EBS_SIZE=1 #GB
98
EBS_SIZE_MULTIPLIER=15
109

1110
## Get command line params
@@ -493,12 +492,11 @@ if [ ! -z ${DB_DUMP_PATH+x} ]; then
493492
ebsSize=$minSize # 300 GB
494493
if [ "$dumpFileSize" -gt "$minSize" ]; then
495494
let ebsSize=$dumpFileSize
495+
let ebsSize=$ebsSize*$EBS_SIZE_MULTIPLIER
496+
ebsSize=$(numfmt --to-unit=G $ebsSize)
497+
EBS_SIZE=$ebsSize
498+
[ $DEBUG -eq 1 ] && echo "EBS Size: $EBS_SIZE Gb"
496499
fi
497-
ebsSize=$(numfmt --to-unit=G $ebsSize)
498-
#[ $DEBUG -eq 1 ] && echo "EBS Size: $ebsSize Gb"
499-
let ebsSize=$ebsSize*$EBS_SIZE_MULTIPLIER
500-
EBS_SIZE=$ebsSize
501-
[ $DEBUG -eq 1 ] && echo "EBS Size: $EBS_SIZE Gb"
502500
fi
503501

504502
set -ueo pipefail
@@ -611,6 +609,7 @@ elif [[ "$RUN_ON" = "aws" ]]; then
611609
if [ ${AWS_EC2_TYPE:0:2} == 'i3' ]
612610
then
613611
# Init i3 storage, just mount existing volume
612+
echo "Attach i3 nvme volume"
614613
docker-machine ssh $DOCKER_MACHINE df -h
615614
docker-machine ssh $DOCKER_MACHINE sudo add-apt-repository -y ppa:sbates
616615
docker-machine ssh $DOCKER_MACHINE sudo apt-get update || :
@@ -631,17 +630,18 @@ elif [[ "$RUN_ON" = "aws" ]]; then
631630
docker-machine ssh $DOCKER_MACHINE df -h
632631
else
633632
# Create new volume and attach them for non i3 instances if need
634-
[ $DEBUG -eq 1 ] && echo "Create volume with size: $EBS_SIZE Gb"
635-
VOLUME_ID=$(aws ec2 create-volume --size 10 --region us-east-1 --availability-zone us-east-1a --volume-type gp2 | jq -r .VolumeId)
636-
INSTANCE_ID=$(docker-machine ssh $DOCKER_MACHINE curl -s http://169.254.169.254/latest/meta-data/instance-id)
637-
echo "Instance id: $INSTANCE_ID Volume with size: $EBS_SIZE created. Volume id: $VOLUME_ID"
638-
sleep 10 # wait to volume will ready
639-
attachResult=$(aws ec2 attach-volume --device /dev/xvdf --volume-id $VOLUME_ID --instance-id $INSTANCE_ID --region us-east-1)
640-
echo "ATTACH RESULT: $attachResult"
641-
docker-machine ssh $DOCKER_MACHINE sudo mkfs.ext4 /dev/xvdf
642-
docker-machine ssh $DOCKER_MACHINE "sudo sh -c \"mkdir /home/storage\""
643-
docker-machine ssh $DOCKER_MACHINE sudo mount /dev/xvdf /home/storage
644-
# docker-machine ssh $DOCKER_MACHINE "sudo sh -c \"echo 'Check mount storage TEST' > /home/storage/xvdf-test.txt\""
633+
if [ ! -z ${EBS_SIZE+x} ]; then
634+
echo "Create and attach EBS volume"
635+
[ $DEBUG -eq 1 ] && echo "Create volume with size: $EBS_SIZE Gb"
636+
VOLUME_ID=$(aws ec2 create-volume --size 10 --region us-east-1 --availability-zone us-east-1a --volume-type gp2 | jq -r .VolumeId)
637+
INSTANCE_ID=$(docker-machine ssh $DOCKER_MACHINE curl -s http://169.254.169.254/latest/meta-data/instance-id)
638+
sleep 10 # wait to volume will ready
639+
attachResult=$(aws ec2 attach-volume --device /dev/xvdf --volume-id $VOLUME_ID --instance-id $INSTANCE_ID --region us-east-1)
640+
docker-machine ssh $DOCKER_MACHINE sudo mkfs.ext4 /dev/xvdf
641+
docker-machine ssh $DOCKER_MACHINE "sudo sh -c \"mkdir /home/storage\""
642+
docker-machine ssh $DOCKER_MACHINE sudo mount /dev/xvdf /home/storage
643+
# docker-machine ssh $DOCKER_MACHINE "sudo sh -c \"echo 'Check mount storage TEST' > /home/storage/xvdf-test.txt\""
644+
fi
645645
fi
646646

647647
containerHash=$( \

0 commit comments

Comments
 (0)