Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

fixing docker compose mac #30

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions ros-tutorials/brew-ros-configuration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Set to exit if error occurs
set -e

echo "Beginning Duke Robotics Software Install..."

# if homebrew is not installed, install homebrew
if ! command -v brew &> /dev/null; then
echo "Homebrew is not installed, installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi

brew install docker
brew install docker-compose
brew install git
brew install --cask github
brew install --cask slack
brew install [email protected]
brew install --cask xquartz

# if user wants to install vscode, install vscode
read -p "Do you want to install vscode? (y/n): " install_vscode
if [ "$install_vscode" = "y" ]; then
brew install --cask visual-studio-code
fi
91 changes: 55 additions & 36 deletions ros-tutorials/lesson-0-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,60 @@ This introduction will set up your system for the rest of the tutorials. It will

## System Requirements

The primary requirement for installing these programs is computer disc space. Ensure before proceeding that you have sufficient space on your computer hard drive. We reccomend **at least 32 Gb**.
The primary requirement for installing these programs is computer disc space. Ensure before proceeding that you have sufficient space on your computer hard drive. We reccomend **at least 25 Gb**. The install script will require you to free this much disk space.

Some of our software, such as Docker or simulation software, may run slowly on a lower power machine (or an Apple Silicon chip). Please reach out to a leadership member if you are having techincal difficulties of any kind (or email [Drew Council]([email protected])).

## For Windows 10 and 11
## Install

### For Windows 10 and 11

To simplify the installation steps for Windows 10 and 11 users, we have created an installation script that automates the installation of several applications.
- Before running this script, **install `winget` on your computer**. Open Windows Store and search for *"App Installer"*. Install the first result. `winget` is a package manager made by Microsoft to manage applications for Windows.
- Once `winget` is installed, right-click on **[this link]**(https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/winget-ros-configuration.ps1) and select *"Save link as"*. Save the file somewhere with the default name and extension. Open the file location in File Explorer, right-click on the file and select *"Run with Powershell"*.
- You may be prompted to ask if you trust this file to run. Please permit the file to execute. If you are unsure, you may look at the source code yourself and see what it does! You have succeeded when a blue terminal window displays a loading bar.
- Now allow the script to execute! **Be sure to watch your computer, as you may be prompted to accept license agreements or give administrator access.** The script will install the following programs:
- Docker Desktop
- Git
- GitHub Desktop
- Windows Terminal
- Slack
- Python3
- Once it has installed these programs, you will be prompted asking if you would like to install VS Code, our recommended code editor. If you prefer another editor or already have VS Code installed, you should reject here.
- Once the script has completed, you may delete the script file. To update your programs in the future, simply run
```powershell
winget upgrade --all

Open the Start Menu and search for Powershell. Right click on Powershell and select *Run as Administrator*.

Run the following command:
```ps1
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/winget-ros-configuration.ps1'))
```

## Command Line
> If your antivirus is giving you trouble with the above, right-click on **[this link](https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/winget-ros-configuration.ps1)** and select *"Save link as"*. Save the file somewhere with the default name and extension. Open the file location in File Explorer, right-click on the file and select *"Run with Powershell"*.
You may be prompted to ask if you trust this file to run. Please permit the file to execute. If you are unsure, you may look at the source code yourself and see what it does!

Now allow the script to execute! **Be sure to watch your computer, as you may be prompted to accept license agreements or give administrator access. When prompted, please select "Y" and allow the installations to proceed** The script will install the following programs:
- Docker Desktop
- Git
- GitHub Desktop
- Slack
- Python3
- MobaXTerm

Once it has installed these programs, you will be prompted asking if you would like to install VS Code, our recommended code editor. If you prefer another editor or already have VS Code installed, you should reject here.
> To update your programs in the future, simply run `winget upgrade --all`

### For MacOS

Open terminal and run the following command:
```sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/brew-ros-configuration.sh)"
```

Before continuing, if you have never used the Unix command line (or Terminal in Mac or Command Prompt in Windows), complete [this short tutorial](https://www.vikingcodeschool.com/web-development-basics/a-command-line-crash-course).
Now allow the script to execute! **Be sure to watch your computer, as you may be prompted to accept license agreements or give superuser permissions. When prompted, please select "Y" and allow the installations to proceed** The script will install the following programs:
- Docker Desktop
- Git
- GitHub Desktop
- Slack
- Python3.11
- XQuartz

Once it has installed these programs, you will be prompted asking if you would like to install VS Code, our recommended code editor. If you prefer another editor or already have VS Code installed, you should reject here.
> To update your programs in the future, simply run `brew update && brew upgrade && brew upgrade --cask && brew cleanup`

## Starter Code and Git

To share and manage versions of our source code, we use [Git](https://git-scm.com/). When you have a folder of code files for your project, Git calls it a repository. We're going to use Git now to get some starter code for these tutorials.
### For those not using `winget` script
Install Git [from their website](https://git-scm.com/) now if you have not already.

Open up Terminal in Mac or Command Prompt in Windows. Type `git --version` and press Enter. If the command is not found, close the window and install Git from [here](https://git-scm.com/downloads). Then re-open Terminal or Command Prompt.

Now, run the following command:
Run the following command in a location you would like to use for these tutorials:

```bash
git clone https://github.com/DukeRobotics/documentation.git
Expand All @@ -49,15 +67,9 @@ This clones, or makes a copy of, our documentation repository (the one you're re

## Docker Setup

To run ROS, we will be using Docker. This is a software that allows you to run programs inside an isolated environment called a container. So, you only need to download Docker Desktop and then run our image. Our image includes all of the little pieces of software we need, rather than installing them individually. If you're curious, learn more [here](https://www.docker.com/resources/what-container) or [here](https://docs.docker.com/get-started/) or ask a software team member.

Download and install the appropriate Docker client:
To run ROS, we will be using Docker. This is a software that allows you to run programs inside an isolated environment called a container. So, you only need to open Docker Desktop and then run our image. Our image includes all of the little pieces of software we need, rather than installing them individually. If you're curious, learn more [here](https://www.docker.com/resources/what-container) or [here](https://docs.docker.com/get-started/) or ask a software team member.

* [Windows (10 and 11)](#for-windows-10-and-11) see above
* [Windows (Other, no `winget`)](https://docs.docker.com/desktop/install/windows-install/)
* [Mac](https://docs.docker.com/desktop/install/mac-install/)

Once Docker Desktop is installed, run it like you would any other app on your computer.
Search for the program Docker Desktop and run it.

## Run Docker

Expand All @@ -70,29 +82,36 @@ cd documentation/ros-tutorials

Then run this (it may take a few minutes to download the image and run the container):
```bash
docker compose up -d
docker-compose up -d
```

## Connect to Docker via SSH

Now that the container is up and running, let's get into that isolated environment so that we can use it. We'll do that by connecting to the command line that is _inside_ of that container using Secure Shell (SSH).

Install and run one of the following:
* [Mac: XQuartz](https://www.xquartz.org/)
* [Windows: MobaXterm](https://mobaxterm.mobatek.net/)<br>
- If on MacOS, Run the program called **XQuartz**
- As long as this program is running in the background, you can just use the normal MacOS terminal to run your commands.
- If on Windows, Run the program called **MobaXTerm**
- Be sure to run all commands in this terminal and *not* anywhere else.

:warning: Open MobaXterm > click on Settings > go the X11 tab > uncheck RANDR. This will help with some graphics display later.

After opening that program, SSH into the container by running:
```bash
ssh -XY -p 2201 root@localhost
```

The password is `robotics`.
> The password is `robotics`.

Now you're inside the container, isolated from the rest of your computer. This environment has ROS installed for you.

:information_source: **Whenever you're running ROS, you should be in this environment.**


## Command Line

Before continuing, if you have never used the Unix/Bash command line (Terminal in MacOS or Linux), [this page](https://cs.colby.edu/maxwell/courses/tutorials/terminal/) provides a good reference.

***

Excellent! Now proceed to [Lesson 1 - Basics](lesson-1-basics.md).
19 changes: 0 additions & 19 deletions ros-tutorials/lesson-4-smach.md

This file was deleted.

37 changes: 34 additions & 3 deletions ros-tutorials/winget-ros-configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,44 @@
# - Docker Desktop
# - Git
# - GitHub Desktop
# - Windows Terminal
# - Slack
# - Python3
# The script also gives the option to install VS Code.
# winget MUST BE INSTALLED BEFORE RUNNING THIS SCRIPT

winget install -e --id Docker.DockerDesktop;winget install -e --id Git.Git;winget install -e --id GitHub.GitHubDesktop;winget install -e --id Microsoft.WindowsTerminal;winget install -e --id SlackTechnologies.Slack;winget install -e --id Python.Python.3
# Set to exit if error occurs
$ErrorActionPreference = "Stop"

Write-Host "Beginning Duke Robotics Software Install..." -ForegroundColor Yellow

# install winget if not already installed
if (-not(Get-Command winget -ErrorAction SilentlyContinue)){
# print message
Write-Host "WinGet is not installed. Installing WinGet..." -ForegroundColor Yellow
# $progressPreference = 'silentlyContinue'
# Write-Information "Downloading WinGet and its dependencies..."
# Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
# Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
# Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx
# Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
# Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx
# Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Install-Script winget-install -Force
}

$Disk = Get-WmiObject -Class Win32_LogicalDisk
$Freespace = $Disk.FreeSpace/1GB
# if freespace is less than 25GB, exit the script with an error message
if ($Freespace -lt 25){
Write-Host "Not enough disk space to install all packages. Please free up some space and try again." -ForegroundColor Red
exit
}

winget install -e --id Docker.DockerDesktop
winget install -e --id Git.Git
winget install -e --id GitHub.GitHubDesktop
winget install -e --id SlackTechnologies.Slack
winget install -e --id Python.Python.3
winget install -e --id=Mobatek.MobaXterm
# Ask user if they want to install the optional packages
$response = Read-Host -Prompt "Do you want to install VS Code? (y/N)"
# If $respose is y, install the optional packages
Expand Down