Skip to content

Deploying Code

Bennett Petzold edited this page Oct 26, 2022 · 9 revisions

Quick Reference

  • Static IP: 192.168.2.6
  • User: sw8
  • Target IP: 192.168.2.5

1: Setting Laptop Environment

Based on ROS connection method

  • Set a static Ethernet IP of 192.168.2.X
  • Set the netmask
    • Option 1: 255.255.255.0 subnet mask
    • Option 2: [ip address]/24 CIDR
  • Attach to target single board computer via Ethernet
    • We use a network switch for multiple connections
      • Creates a local network

2: Gradle Deploy

  • Prerequisite: Task 1
  • Get a copy of ".sw8_ssh_identity"
    • Put it in the "app" directory
    • Ask the software lead for the file
  • Use the deploy task
    • Go to the project root
    • Open in command processor (cmd/bash/zsh/etc)
    • Linux/MacOS: ./gradlew deploy
    • Windows: ./gradlew.bat deploy

3: Direct SSH Access

  • Prerequisite: Task 1
  • The target address is 192.168.2.5
  • Use SSH utility
    • Linux/MacOS: use ssh directly
      • ssh sw8@192.168.2.5
      • For graphics: ssh -x sw8@192.168.2.5
    • Windows: use terminal emulator
      • e.g. MobaXTerm
      • User: sw8
      • Host: 192.168.2.5
      • Port: 22
  • Ask for password
  • Optional: add "sw8_ssh_identity" to your ssh agent
    • Password not needed if an identity file is provided
    • Ask the software lead for the file

4: Running Code

  • Prerequisite: Task 3
  • Enter the ~/java directory
    • cd ~/java
  • Run app-all.jar
    • java -jar app-all.jar
    • Include flags after the java run
      • java -jar app-all.jar [flags]
      • e.g. java -jar app-all.jar --help

5: tmux

  • Online manual page
    • If tmux is installed, can access with "man tmux"
    • Our tmux sessions will be left on all defaults
      • GNU screen users: that means CTRL+b, not CTRL+a
  • Purpose of tmux
    • tmux = Terminal Multiplexer
    • Persistent terminal session when connection drops
    • Multiple windows on one connection
    • Generally great tool for terminal work
  • Starting tmux To start a new tmux session: "tmux"
    • To connect to a tmux session: "tmux a" or "tmux a [number]"
    • List tmux sessions: "tmux ls"
    • The tmux environment has a green bar at the bottom of the screen
    • Start tmux sessions on the target, not your machine
      • Don't nest tmux sessions
  • Basic tmux commands
    • All commands start by typing CTRL+b, then the specific command
    • Create new window: CTRL+b c
    • Close window: CTRL+b &
      • Close pane (works for one pane windows): CTRL-A x
    • Go to window N: CTRL+b N
      • e.g. for window 1, CTRL+b 1
    • Detach: CTRL+b d
      • Reattach with "tmux a"
      • When session is over, do not use detach
        • Use the "exit" command in bash
        • CTRL-d (no CTRL+b first) also exits
    • For more detail, see "DEFAULT KEY BINDINGS" in manual

6: Debugging

  • Can't connect to target device
    • Make sure user is sw8
      • sw8s is wrong
      • Check password
    • Confirm laptop settings
      • Check against [Task 1](# 1: Setting Laptop Environment)
    • Try ping 192.168.2.5
    • Try a network scan
      • sudo rfkill wlan (IMPORTANT)
        • Disconnects from local WiFi
      • sudo nmap -sn 192.168.2.0/24
        • Scan that doesn't test ports
      • sudo nmap 192.168.2.0/24
        • Scan that tests ports
        • Use if ping/fast scan succeeds but connection fails
    • Confirm next step with leadership
      • Likely power cycling the Pi
  • The test phase failed
    • You failed the tests
    • Fix your code or fix the tests
  • Can't run java/deployed app
    • Test if java is on the system
    • Check default java version
      • java --version
      • If not Java 11, replace with Java 11
Clone this wiki locally