Sfoglia il codice sorgente

Update remote development instructions

Change-Id: Ie11b3d6dde0618607dbd399d89847178001179ac
Leo 4 anni fa
parent
commit
d6b6e0bb41
2 ha cambiato i file con 37 aggiunte e 11 eliminazioni
  1. 19 5
      DEVELOP.md
  2. 18 6
      scripts/dev-setup.sh

+ 19 - 5
DEVELOP.md

@@ -74,12 +74,12 @@ Install Git first:
 
     sudo apt-get install -y git
 
-First, create an SSH key in your shell:
+First, create an SSH key on the VM:
 
     ssh-keygen -t ed25519
     cat .ssh/id_ed25519.pub
 
-You can then [add your public key on Gerrit](https://forge.certus.one/settings/#SSHKeys) and [clone the repository](https://forge.certus.one/admin/repos/wormhole) in your shell. The clone command should look like this:
+You can then [add your public key on Gerrit](https://forge.certus.one/settings/#SSHKeys) and [clone the repository](https://forge.certus.one/admin/repos/wormhole). The clone command should look like this:
 
 ```shell
 # don't copy this - copy it from Gerrit instead
@@ -94,13 +94,14 @@ Configure your Git identity to match your Gerrit name and email:
 *If you are a Jump Crypto employee, make sure to log into Gerrit using Azure SSO using your
 jumptrading.com email address and request Gerrit review permissions in #wormhole-dev on Slack.*
 
-You can then use our regular Git and Gerrit workflow as detailed in [Submit change for review](./CONTRIBUTING.md#Submit change for review).
+You can then use our regular Git and Gerrit workflow as detailed in [Submit change for review](CONTRIBUTING.md#submit-change-for-review).
 
 ### Set up devnet on the VM
 
-After cloning the repo, run the setup script:
+After cloning the repo, run the setup script. It expects to run as a regular user account with sudo permissions.
+It installs Go, Minikube, Tilt and any other dependencies required for Wormhole development:
 
-    scripts/devnet-setup.sh
+    scripts/dev-setup.sh
 
 You then need to close and re-open your session to apply the new environment.
 If you use persistent SSH sessions, make sure to kill the session before reconnecting.
@@ -116,6 +117,19 @@ of your choice to control access:
 
     tilt up --host=0.0.0.0 --port=8080
 
+If something breaks, just run `minikube delete` and start from scratch by running `start-recommended-minikube`.
+
+### VSCode remote development
+
+VSCode's SSH remote development plugin is known to work well with the workflow described above.
+
+### IntelliJ remote development
+
+IntelliJ's [remote development backend](https://www.jetbrains.com/remote-development/gateway/) is reported to work as well. Just install Jetbrains Gateway on your local machine, connect it to your remote VM via SSH, and pick the latest IntelliJ release. Your local license, keymap and theme - if any - will be used automatically.
+
+[Projector](https://lp.jetbrains.com/projector/) should also work for clients that can't run the native UI locally
+(if you want to code on your VR headset, smart toaster or Chromebook - this is the way!).
+
 ## Tips and tricks
 
 ### Post messages

+ 18 - 6
scripts/dev-setup.sh

@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+set -euo pipefail
 #
 # This script provisions a working Wormhole dev environment on a blank Debian VM.
 # It expects to run as a user without root permissions.
@@ -32,10 +33,10 @@ fi
 
 # Upgrade everything
 # (this ensures that an existing Docker CE installation is up to date before continuing)
-sudo apt-get upgrade -y
+sudo apt-get update && sudo apt-get upgrade -y
 
 # Install dependencies
-sudo apt-get update && sudo apt-get -y install bash-completion git git-review vim
+sudo apt-get -y install bash-completion git git-review vim
 
 # Install Go
 ARCH=amd64
@@ -63,16 +64,26 @@ GO=1.17.3
 
 # Install Docker and add ourselves to Docker group
 if [[ ! -d /var/lib/docker ]]; then
-  curl -fsSL https://get.docker.com -o get-docker.sh
-  sudo sh get-docker.sh
+  TMP=$(mktemp -d)
+  (
+    cd "$TMP"
+    curl -fsSL https://get.docker.com -o get-docker.sh
+    sudo sh get-docker.sh
+  )
+  rm -rf "$TMP"
   sudo gpasswd -a $USER docker
 fi
 
 sudo systemctl enable --now docker
 
 # Install Minikube
-curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
-sudo dpkg -i minikube_latest_amd64.deb
+TMP=$(mktemp -d)
+(
+  cd "$TMP"
+  curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
+  sudo dpkg -i minikube_latest_amd64.deb
+)
+rm -rf "$TMP"
 
 # Install tilt
 curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | sudo bash
@@ -97,6 +108,7 @@ alias start-recommended-minikube="minikube start --driver=docker --kubernetes-ve
 EOF
 
 cat <<EOF
+
 โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”‘
 โ”‚                                                                 โ”‚
 โ”‚                            SUCCESS                              โ”‚