Skip to content

Commit

Permalink
Add debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Aug 11, 2023
1 parent 19b1293 commit 0d0a03b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 0 additions & 2 deletions build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ mkdir -p /root/.ssh
chmod 700 /root/.ssh
touch /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
#mkdir -p /run/sshd
#chmod 700 /run/sshd

# Remove less relevant parts of motd
rm /etc/update-motd.d/10-help-text
Expand Down
23 changes: 20 additions & 3 deletions build/COPY_ROOT/opt/ai-dock/bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function main() {
write_bashrc
get_provisioning_script
run_provisioning_script
debug_print

# Killing supervisord will stop/force restart the container
wait -n
Expand Down Expand Up @@ -59,19 +60,20 @@ function set_ssh_keys() {
fi

# Named to avoid conflict with the cloud providers below

if [[ -n $SSH_PUBKEY ]]; then
printf "%s\n" "$SSH_PUBKEY" >> /root/.ssh/authorized_keys
printf "\n%s\n" "$SSH_PUBKEY" >> /root/.ssh/authorized_keys
fi

# Alt names for $SSH_PUBKEY
# runpod.io
if [[ -n $PUBLIC_KEY ]]; then
printf "%s\n" "$PUBLIC_KEY" >> /root/.ssh/authorized_keys
printf "\n%s\n" "$PUBLIC_KEY" >> /root/.ssh/authorized_keys
fi

# vast.ai
if [[ -n $SSH_PUBLIC_KEY ]]; then
printf "%s\n" "$SSH_PUBLIC_KEY" >> /root/.ssh/authorized_keys
printf "\n%s\n" "$SSH_PUBLIC_KEY" >> /root/.ssh/authorized_keys
fi
}

Expand Down Expand Up @@ -212,4 +214,19 @@ function run_provisioning_script() {
fi
}

function debug_print() {
if [[ -n $DEBUG ]]; then
printf "\n\n\n---------- DEBUG INFO ----------\n\n"
printf "env output...\n\n"
env
printf "\n--------------------------------------------\n"
printf "authorized_keys...\n\n"
cat /root/.ssh/authorized_keys
printf "\n--------------------------------------------\n"
printf ".bashrc...\n\n"
cat /root/.bashrc
printf "\n---------- END DEBUG INFO---------- \n\n\n"
fi
}

main "$@"; exit

0 comments on commit 0d0a03b

Please sign in to comment.