Skip to content

Commit

Permalink
Add new images and update installation instructions for Spin
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydrogers committed Dec 13, 2023
1 parent 080694b commit 123e84d
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 41 deletions.
105 changes: 94 additions & 11 deletions docs/content/docs/2.installation/2.install-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@ layout: docs
⚠️ This document is a work in progress. We're currently testing some things out and continuing to add to this document. If you see errors or have advice, please contribute!
::

## Pre-requisites
Windows requires a "Linux Subsystem" to run Docker. We will break this into two parts:
# Install to Windows
::lead-p
Spin is able to run on any Windows machine that supports Windows Subsystem Linux v2 (WLS2). This is a feature developed by Microsoft that allows you to run a Linux distribution on your Windows machine. It is supported in updated versions of Windows 10 and Windows 11.
::

## Prerequisites
Spin requires a working Windows installation with Docker installed. There are two popular methods to install Docker on Windows:

1. Install `docker-ce` on Windows Subsystem Linux v2 (WSL2) *\[recommended\]*
2. Install Docker Desktop on Windows with WSL2 backend

![Docker Installation Options](/images/docs/windows/docker-installation-options.png)

1. Install Windows Subsystem Linux (v2)
2. Install Docker Desktop

#### Optional software
You may want to consider installing this software to improve your development experience (this is what we use).
* [Windows Terminal](https://docs.microsoft.com/en-us/windows/terminal/install) - This is a great terminal application that will give you tab support for your CLIs.

## Install Windows Subsystem Linux (WSL)
We can follow the principles discussed in the [official WSL2 documentation](https://docs.microsoft.com/en-us/windows/wsl/install) and prepare our machine to run "Windows Subsystem Linux v2" (WSL2). We prefer Ubuntu as our distribution. So if you're happy with that recommendation, run this command in PowerShell as administrator to install WSL2.
## Install Windows Subsystem Linux v2 (WSL2)
Both options require installing WSL2. We can follow the principles discussed in the [official WSL2 documentation](https://docs.microsoft.com/en-us/windows/wsl/install) and prepare our machine to run "Windows Subsystem Linux v2" (WSL2). We prefer Ubuntu as our distribution. So if you're happy with that recommendation, run this command in PowerShell as administrator to install WSL2.

::code-panel
---
Expand Down Expand Up @@ -52,9 +60,36 @@ wsl
```
::

## Install Docker Desktop
::note
⚠️ Always be aware of what shell you're in (Windows or Ubuntu). You can always tell by the prompt.
::

### What a Windows shell looks like
You can tell you're in a Windows shell by the prompt when you see the `PS` prefix and the `C:\` prefix.
![Windows Shell](/images/docs/windows/shell-windows.png)

### What a Linux shell looks like
When you're in a Linux shell, you'll see the different colors and things like `/mnt/c` for your Windows drive.
![Linux Shell](/images/docs/windows/shell-linux.png)

To go back to your Windows shell, type `exit` and press enter.

::note
**⚠️ Always run `spin` from the Linux shell**. You'll need to run `wsl` from a Windows prompt to enter the Linux shell, then you can run `spin` after you complete the installation.
::

Download and install the latest version of Docker Desktop from Docker's Website [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
## Install `docker-ce` within WSL2 (option 1)
Installing `docker-ce` within Linux allows you to run the open source versions of Docker without installing any proprietary software.

If this option interests you, run `wsl` to enter a Linux shell and then follow our instructions for installing Spin on Linux.

[Install Spin to Linux (WSL2) →](/docs/installation/install-linux)

## Install Docker Desktop (option 2)
If you prefer to install Docker Desktop with the WSL2 backend, you'll need to [download Docker Desktop](https://www.docker.com/products/docker-desktop) from Docker's website.

### Installation
Double click the setup file to begin the installation.

### Configuration

Expand Down Expand Up @@ -82,7 +117,7 @@ You will be prompted to login to your Docker account. If you don't have one, you

![Docker Login](/images/docs/windows/docker-login.png)

# Verify everything is working
## Verify Docker Desktop

::code-panel
---
Expand Down Expand Up @@ -110,5 +145,53 @@ It should return something like this.

![Docker Run Hello World!](/images/docs/windows/docker-run-hello-world.png)

## TODO
* Need to add detailed instructions how to install `spin` on the Windows with WSL
## Download and install `spin` into WSL2
::note
⚠️ Be sure to run `wsl` to enter the Linux shell before running the following commands.
::

Run the installer with this simple command in your terminal

::code-panel
---
label: Install beta version of Spin (no root permissions required)
---
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/serversideup/spin/main/tools/install.sh)" "" --beta
```
::

The above script will install spin at the _user_ level in `~/.spin`, using less than 300KB of storage.

## Add `spin` to your PATH
In order for your terminal to know where `spin` is located, we need to add this to your "PATH" for your shell. Depending on your shell, you will need to **paste the following text at the BOTTOM of the appropriate file**:


::code-panel
---
label: Add spin to your path (singe-line, hassle free)
---
```bash
echo $0 && { [ "$0" = "-bash" ] && file=~/.bash_profile || file=~/.zshrc; } && { [ -f "$file" ] || touch "$file"; } && grep -qxF 'export PATH="$HOME/.spin/bin:$PATH"' "$file" || echo 'export PATH="$HOME/.spin/bin:$PATH"' >> "$file" && source "$file" && echo "✅ Spin path added and sourced successfully!"
```
::

This giant command above does a few things:
- It checks to see if you're using Bash or ZSH
- It checks to see if your shell profile file exists
- It checks to see if the `spin` path is already added to your shell profile file
- If the `spin` path is not added, it adds it to the bottom of your shell profile file
- It sources your shell profile file so you don't have to restart your terminal

Just copy and paste the above command into your terminal and it will intelligently add the `spin` path to your shell profile file.

## Validate `spin` is working

::code-panel
---
label: Confirm spin is working correctly by getting the version
---
```bash
spin version
```
::
41 changes: 11 additions & 30 deletions docs/content/docs/2.installation/3.install-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ Run the installer with this simple command in your terminal

::code-panel
---
label: Install spin (no root permissions required)
label: Install beta version of Spin (no root permissions required)
---
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/serversideup/spin/main/tools/install.sh)"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/serversideup/spin/main/tools/install.sh)" "" --beta
```
::

Expand All @@ -99,46 +99,27 @@ The above script will install spin at the _user_ level in `~/.spin`, using less
## Add `spin` to your PATH
In order for your terminal to know where `spin` is located, we need to add this to your "PATH" for your shell. Depending on your shell, you will need to **paste the following text at the BOTTOM of the appropriate file**:

::note
Run `echo $0` in your terminal to figure out which shell you are using.
::


::code-panel
---
label: Add spin to your path
label: Add spin to your path (singe-line, hassle free)
---
```bash
# Add this to `~/.zshrc` or `~/.bash_profile`
export PATH="$HOME/.spin/bin:$PATH"
echo $0 && { [ "$0" = "-bash" ] && file=~/.bash_profile || file=~/.zshrc; } && { [ -f "$file" ] || touch "$file"; } && grep -qxF 'export PATH="$HOME/.spin/bin:$PATH"' "$file" || echo 'export PATH="$HOME/.spin/bin:$PATH"' >> "$file" && source "$file" && echo "✅ Spin path added and sourced successfully!"
```
::

Files to modify:
- **ZSH (most modern Macs):** ~/.zshrc
- **Bash:** ~/.bash_profile

You can use something like `nano` or `vim` to modify these files.
This giant command above does a few things:
- It checks to see if you're using Bash or ZSH
- It checks to see if your shell profile file exists
- It checks to see if the `spin` path is already added to your shell profile file
- If the `spin` path is not added, it adds it to the bottom of your shell profile file
- It sources your shell profile file so you don't have to restart your terminal

## Apply your changes
To apply the changes, simply restart your terminal or you can source the file you just modified:

::code-panel
---
label: Use the "source" command to apply your profile changes immediately
---
```bash
# If you're using ZSH
source ~/.zshrc

# If you're using Bash
source ~/.bash_profile
```
::
Just copy and paste the above command into your terminal and it will intelligently add the `spin` path to your shell profile file.

## Validate `spin` is working


::code-panel
---
label: Confirm spin is working correctly by getting the version
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/images/docs/windows/shell-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 123e84d

Please sign in to comment.