Migrate Bastion to New Machine
Warning
Pre-requisite
- Have a working HA cluster with Bastion.
- New VM for a replacement Bastion with necessary hardware requirement for bastion (recommended to have same OS as the original bastion) - AWS Deployment Prerequisites
Note
Step-1: In Original/Old Bastion
Copy the artifacts directory to the user directory of the Replacement/New Bastion.
scp -i <ssh_key_file> -r /hab/cache/artifacts <USER>@<NEW_BASTION_PUBLIC/PRIVATE_IP>:/home/<USER>/
Copy the /hab/a2_deploy_workspace directory to the user directory of the Replacement/New Bastion.
scp -i <ssh_key_file> -r /hab/a2_deploy_workspace <USER>@<NEW_BASTION_PUBLIC/PRIVATE_IP>:/home/<USER>/
Copy SSH_KEY_FILE used to connect to all frontend and backend nodes to the user directory of the Replacement/New Bastion.
scp -i <ssh_key_file> <ssh_key_file> <USER>@<NEW_BASTION_PUBLIC/PRIVATE_IP>:/home/<USER>/
Step-2: In Replacement/New Bastion
Install hab
curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh \ | sudo bash
Updating Permissions for Files
Give root permissions to the file inside artifacts and a2_deploy_workspace directory in the home directory of the Replacement/New Bastion machine.
cd /home/<USER>/ chown -RL root:root artifacts/* chown -RL root:root a2_deploy_workspace/*
Move those files into their respective places.
mv -r artifacts/* /hab/cache/artifacts/ mv -r a2_deploy_workspace/* /hab/a2_deploy_workspace/
Place the ssh_user_key in the same directory as it was in the Original/Old Bastion machine.
Eg: If the key is
~/.ssh/id_rsa
, then in the Replacement/New Bastion also place it in~/.ssh/id_rsa
Give proper permission for the
ssh_key_file
.chmod 600 <ssh_key_file>
Install Packages
Identify the same CLI and Deployment package version used in the Original/Old Bastion machine.
- For CLI
ls -la /hab/cache/artifacts/*cli*
- For deployment package.
ls -la /hab/cache/artifacts/*automate-ha-deployment*
Note
- If there is more than one CLI package available, use the latest one.
- If more than one deployment package is available, identify the version used in the Original/Old Bastion machine and use the same version. Run ls -la /hab/ in the Original/Old Bastion machine to find the version.
Install CLI and add it to the
/bin
.hab pkg install -bf <path to .hart file for CLI>
Install the Automate Deployment Package.
hab pkg install -bf <path to .hart file for deployment>
Note
- Verify if chef-automate commands are working.
- Once the commands are verified, you can clean up the Old Bastion Original/Old Bastion.