Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API server SSH connection check #3441

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions infrastructure/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@ terraform apply -var-file="environments/$env.tfvars" -auto-approve
chmod 600 data-refinery-key.pem
API_IP_ADDRESS=$(terraform output -json api_server_1_ip | tr -d '"')

# Check SSH connection.
if ! ssh -o StrictHostKeyChecking=no \
-o ServerAliveInterval=15 \
-o ConnectTimeout=5 \
-i data-refinery-key.pem \
"ubuntu@$API_IP_ADDRESS" "exit"; then
exit_code=$?
echo "Could not SSH into the API server. Did you rotate the SSH keys recently?"
exit $exit_code;
fi

# To check to see if the docker container needs to be stopped before
# it can be started, grep for the name of the container. However if
# it's not found then grep will return a non-zero exit code so in that
Expand Down
Loading