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

Story/gra 1431 #2141

Merged
merged 3 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
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
28 changes: 6 additions & 22 deletions scripts/nm-quick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,29 +178,14 @@ install_yq() {
# setup_netclient - adds netclient to docker-compose
setup_netclient() {


# yq ".services.netclient += {\"container_name\": \"netclient\"}" -i /root/docker-compose.yml
# yq ".services.netclient += {\"image\": \"gravitl/netclient:$IMAGE_TAG\"}" -i /root/docker-compose.yml
# yq ".services.netclient += {\"hostname\": \"netmaker-1\"}" -i /root/docker-compose.yml
# yq ".services.netclient += {\"network_mode\": \"host\"}" -i /root/docker-compose.yml
# yq ".services.netclient.depends_on += [\"netmaker\"]" -i /root/docker-compose.yml
# yq ".services.netclient += {\"restart\": \"always\"}" -i /root/docker-compose.yml
# yq ".services.netclient.environment += {\"TOKEN\": \"$TOKEN\"}" -i /root/docker-compose.yml
# yq ".services.netclient.volumes += [\"/etc/netclient:/etc/netclient\"]" -i /root/docker-compose.yml
# yq ".services.netclient.cap_add += [\"NET_ADMIN\"]" -i /root/docker-compose.yml
# yq ".services.netclient.cap_add += [\"NET_RAW\"]" -i /root/docker-compose.yml
# yq ".services.netclient.cap_add += [\"SYS_MODULE\"]" -i /root/docker-compose.yml

# docker-compose up -d

set +e
netclient uninstall
set -e

wget -O netclient https://github.com/gravitl/netclient/releases/download/$LATEST/netclient_linux_amd64
chmod +x netclient
./netclient install
netclient join -t $TOKEN
netclient register -t $TOKEN

echo "waiting for client to become available"
wait_seconds 10
Expand All @@ -210,9 +195,9 @@ setup_netclient() {
configure_netclient() {

NODE_ID=$(sudo cat /etc/netclient/nodes.yml | yq -r .netmaker.commonnode.id)
echo "join complete. New node ID: $NODE_ID"
echo "register complete. New node ID: $NODE_ID"
HOST_ID=$(sudo cat /etc/netclient/netclient.yml | yq -r .host.id)
echo "For first join, making host a default"
echo "making host a default"
echo "Host ID: $HOST_ID"
# set as a default host
set +e
Expand Down Expand Up @@ -660,11 +645,10 @@ setup_mesh() {

wait_seconds 5

echo "Creating netmaker access key"
echo "Creating netmaker enrollment key"

nmctl keys create test1 99999 --name netmaker-key
tokenJson=$(nmctl keys create netmaker 2)
TOKEN=$(jq -r '.accessstring' <<< ${tokenJson})
tokenJson=$(nmctl enrollment_key create --unlimited --networks netmaker)
TOKEN=$(jq -r '.token' <<< ${tokenJson})

wait_seconds 3

Expand Down
25 changes: 6 additions & 19 deletions scripts/nm-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,20 +427,6 @@ test_caddy() {
# setup_netclient - adds netclient to docker-compose
setup_netclient() {

# yq ".services.netclient += {\"container_name\": \"netclient\"}" -i /root/docker-compose.yml
# yq ".services.netclient += {\"image\": \"gravitl/netclient:testing\"}" -i /root/docker-compose.yml
# yq ".services.netclient += {\"hostname\": \"netmaker-1\"}" -i /root/docker-compose.yml
# yq ".services.netclient += {\"network_mode\": \"host\"}" -i /root/docker-compose.yml
# yq ".services.netclient.depends_on += [\"netmaker\"]" -i /root/docker-compose.yml
# yq ".services.netclient += {\"restart\": \"always\"}" -i /root/docker-compose.yml
# yq ".services.netclient.environment += {\"TOKEN\": \"$KEY\"}" -i /root/docker-compose.yml
# yq ".services.netclient.volumes += [\"/etc/netclient:/etc/netclient\"]" -i /root/docker-compose.yml
# yq ".services.netclient.cap_add += [\"NET_ADMIN\"]" -i /root/docker-compose.yml
# yq ".services.netclient.cap_add += [\"NET_RAW\"]" -i /root/docker-compose.yml
# yq ".services.netclient.cap_add += [\"SYS_MODULE\"]" -i /root/docker-compose.yml

# docker-compose up -d

set +e
netclient uninstall
set -e
Expand All @@ -449,7 +435,8 @@ setup_netclient() {

chmod +x /tmp/netclient
/tmp/netclient install
netclient join -t $KEY

netclient register -t $KEY

echo "waiting for client to become available"
wait_seconds 10
Expand Down Expand Up @@ -520,11 +507,11 @@ join_networks() {
confirm

if [[ $NUM -eq 0 ]]; then
echo "running command: ./nmctl keys create $NETWORK 1"
KEY_JSON=$(./nmctl keys create $NETWORK 1)
KEY=$(echo $KEY_JSON | jq -r .accessstring)
echo "running command: ./nmctl enrollment_key create --uses 1 --networks $NETWORK"
KEY_JSON=$(./nmctl enrollment_key create --uses 1 --networks $NETWORK)
KEY=$(jq -r '.token' <<< ${KEY_JSON})

echo "join key created: $KEY"
echo "enrollment key created: $KEY"

setup_netclient
else
Expand Down