-
Notifications
You must be signed in to change notification settings - Fork 11
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 followers to AWS Cluster demo #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash -eux | ||
|
||
: ${SSH_KEY_FILE?"Need to set SSH_KEY_FILE"} | ||
|
||
source bin/lib/aws_context | ||
source bin/lib/conjur_context | ||
|
||
SEED_DIR="./tmp/conjur/seeds" | ||
|
||
function create_follower_seed() { | ||
local filename=$1 | ||
|
||
mkdir -p $SEED_DIR | ||
|
||
# Create Follower Seed | ||
ssh -i "$SSH_KEY_FILE" \ | ||
-o "StrictHostKeyChecking no" \ | ||
core@$MASTER_1_PUBLIC /bin/bash << EOF | ||
docker exec conjur-appliance bash -c " \ | ||
evoke seed follower "$LB_FOLLOWER_DNS" "$LB_DNS" > "/opt/conjur/backup/$filename" | ||
" | ||
EOF | ||
|
||
# Copy seed to host | ||
scp -i "$SSH_KEY_FILE" \ | ||
-o "StrictHostKeyChecking no" \ | ||
"core@$MASTER_1_PUBLIC:/opt/conjur/backup/$filename" \ | ||
"$SEED_DIR/$filename" | ||
} | ||
|
||
function configure_follower() { | ||
local follower_public=$1 | ||
local filename=$2 | ||
|
||
# Copy seed | ||
scp -i "$SSH_KEY_FILE" \ | ||
-o "StrictHostKeyChecking no" \ | ||
"$SEED_DIR/$filename" \ | ||
"core@$follower_public:~/$filename" | ||
|
||
# Configure node | ||
ssh -i "$SSH_KEY_FILE" \ | ||
-o "StrictHostKeyChecking no" \ | ||
core@$follower_public /bin/bash << EOF | ||
sudo mv "\$HOME/$filename" "/opt/conjur/backup/$filename" | ||
|
||
docker exec conjur-appliance \ | ||
evoke unpack seed "/opt/conjur/backup/$filename" | ||
|
||
docker exec conjur-appliance \ | ||
evoke configure follower | ||
EOF | ||
} | ||
|
||
function configure_followers() { | ||
for follower in $FOLLOWERS_PUBLIC; do | ||
echo "Configuring follower on '$follower'..." | ||
configure_follower "$follower" "follower-seed.tar" | ||
done | ||
} | ||
|
||
create_follower_seed "follower-seed.tar" | ||
|
||
configure_followers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In some other projects, we adhere to Google shell guidelines that state to create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool, I did not know about this! I'm not going to change it now because I would need to run through it all again to make sure I didn't break anything. I will create an issue to refactor this according to these guidelines next time I'm in here. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you include
$LB_DNS
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last I checked on it, it was still not crystal clear what is the correct way to setup certificates and domain names for an autofailover cluster to work with load balancers. So I was explicit about what the master address should be for the follower to avoid any issues while preparing the PCF demo video.
It's possible that it's not necessary. I can create an issue to investigate removing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#35