Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit

Permalink
Create local ssh file the same as other platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddelkoop committed Dec 6, 2021
1 parent f374d17 commit 628fa4f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/gcp-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ echo "=== gcp-dev.sh $PROJECT $BRANCH"

echo "+++ creating VM"
gcloud compute instances create --zone=$ZONE $VM --machine-type=e2-highcpu-4 --preemptible
IP=$(gcloud compute instances describe essentials --format='value(networkInterfaces.accessConfigs[0].natIP)')

echo "+++ wait for boot"
echo "+++ wait for boot $IP"
while ! gcloud compute ssh --zone=$ZONE $NAME@$VM --command='hostname' ; do
sleep 1
done

echo "+++ configuring VM"

gcloud compute ssh --zone=$ZONE $NAME@$VM --ssh-flag='-A' <<EOF
sudo apt-get update
sudo apt-get install --yes git python3-pip python3-venv bash-completion
Expand All @@ -39,6 +39,13 @@ EOF

echo "+++ configure local ssh"
gcloud compute config-ssh
cat > ~/.ssh/$VM.config <<EOF
Host essentials
HostName $IP
CheckHostIP=no
ForwardAgent=yes
User=$NAME
EOF

echo "+++ starting Jypter"
gcloud compute ssh --zone=$ZONE $NAME@$VM --ssh-flag='-t -L 8080:localhost:8080 -L 8081:localhost:8081' --command="cd $PROJECT ; ./scripts/jupyter-lab.sh"

0 comments on commit 628fa4f

Please sign in to comment.