2023-02-01 19:44:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
2023-03-02 14:46:17 +00:00
|
|
|
if ! lxc remote get-default | grep -q "local"; then
|
|
|
|
lxc remote switch "local"
|
2023-02-01 19:44:05 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# if the mgmt machine doesn't exist, then warn the user to perform ./install.sh
|
|
|
|
if ! lxc list --format csv | grep -q "ss-mgmt"; then
|
|
|
|
echo "ERROR: the management machine VM does not exist. You probably need to run './install.sh'."
|
|
|
|
echo "INFO: check out https://www.sovereign-stack.org/tag/code-lifecycle-management/ for more information."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# if the machine does exist, let's make sure it's RUNNING.
|
|
|
|
if lxc list --format csv | grep -q "ss-mgmt,STOPPED"; then
|
|
|
|
echo "INFO: The management machine was in a STOPPED state. Starting the environment. Please wait."
|
|
|
|
lxc start ss-mgmt
|
|
|
|
sleep 30
|
|
|
|
fi
|
|
|
|
|
|
|
|
. ./management/wait_for_lxc_ip.sh
|
|
|
|
|
|
|
|
wait-for-it -t 300 "$IP_V4_ADDRESS:22" > /dev/null 2>&1
|
|
|
|
|
2023-03-02 14:46:17 +00:00
|
|
|
# let's ensure ~/.ssh/ssh_config is using the correct IP address for ss-mgmt.
|
2023-02-01 19:44:05 +00:00
|
|
|
ssh ubuntu@"$IP_V4_ADDRESS"
|