Skip to content

Commit

Permalink
Merge branch 'main' into tshoot-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt authored Nov 22, 2023
2 parents a179e2c + 3fe894d commit 68b7899
Show file tree
Hide file tree
Showing 9 changed files with 459 additions and 247 deletions.
199 changes: 142 additions & 57 deletions docs/blog/posts/2023/instant-srl-labs.md

Large diffs are not rendered by default.

217 changes: 119 additions & 98 deletions docs/blog/posts/2023/srlgpt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tags:
- ndk
- ai
- chatgpt
- media
authors:
- ejames
---
Expand Down Expand Up @@ -76,11 +77,12 @@ Additionally, in today's release we only support using OpenAI's LLM and you must

[[[% import 'macros.html' as macros %]]]
[[[ macros.srl_version('23.7.1') ]]]
[[[ macros.clab_version('0.48.2') ]]]

OK, so to demonstrate SR Linux GPT app we will use Containerlab (min version 0.47.1) and spin up a very simple single node SR Linux topology:

```bash
curl -sL srlinux.dev/clab-srl | containerlab deploy -c -t -
sudo containerlab deploy -c -t srlinux.dev/clab-srl
```

Wait ~20 seconds for the lab to deploy and SSH into the node:
Expand Down Expand Up @@ -119,108 +121,122 @@ There are two different package formats that SR Linux uses:

Depending on which version of SR Linux you're running you will need to run the relevant installation command:

=== "APT (deb)"
```srl
--{ running }--[ ]--
A:srl# bash sudo apt install -y srlgpt
```
/// tab | APT (deb)

=== "YUM (rpm)"
To speed things up in YUM/rpm system we will disable all the repos except for the one that contains the `srlgpt` package.
```srl
--{ running }--[ ]--
A:srl# bash sudo apt update && sudo apt install -y srlgpt
```

```srl title="paste this two-line command into your CLI"
--{ running }--[ ]--
A:srl# bash sudo yum install -y --disablerepo=* --enablerepo=srlinux srlgpt
```
In case APT index update is taking too long, use the following command to only update the custom repository:

```
bash sudo apt -o Dir::Etc::sourcelist=sources.list.d/srlinux.list -o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0 update && sudo apt install srlgpt
```

///
/// tab | YUM (rpm)
To speed things up in YUM/rpm system we will disable all the repos except for the one that contains the `srlgpt` package.

```srl title="paste this two-line command into your CLI"
--{ running }--[ ]--
A:srl# bash sudo yum install -y --disablerepo=* --enablerepo=srlinux srlgpt
```

///

Wait a few seconds for the app to download and install. It is that simple!

??? "Alternative installation options"
If you want to install SR Linux GPT app on a hardware device, or a virtual device that is run by a different orchestrator, you can download the SR Linux GPT application package and `scp` it to your SR Linux device.

!!!note
SR Linux GPT uses some advanced CLI capabilities that we added in 23.7.1, therefore you need to be running 23.7.1 or later.

=== "Install RPM"
Up until release 23.10 SR Linux used to run Centos-based Linux OS with RPM package manager.

```bash
curl -L https://gitlab.com/rdodin/pics/-/wikis/uploads/5b5a3eab3e14229d484a35dcd2f23264/srlgpt_1.0.99_linux_amd64.rpm \
-o /tmp/srlgpt.rpm && scp /tmp/srlgpt.rpm clab-srl-srl: #(1)!
```

1. In the example the SR Linux node is named `clab-srl-srl`, replace with the name/address you have.

=== "Install DEB"
Starting from 23.10 version, SR Linux uses Debian-based Linux OS with DEB package manager.

```bash
curl -L https://gitlab.com/rdodin/pics/-/wikis/uploads/19637b56a042c6d6aaa51072e3fefa55/srlgpt_1.0.99_linux_amd64.deb \
-o /tmp/srlgpt.deb && scp /tmp/srlgpt.deb clab-srl-srl: #(1)!
```

2. In the example the SR Linux node is named `clab-srl-srl`, replace with the name/address you have.

Now install the copied package by opening a bash shell and running the relevant command for the package manager used in your SR Linux version.

```bash
docker exec -it clab-srl-srl bash
```

```bash
[admin@srl ~]$ sudo rpm -i srlgpt.rpm #(1)!
```

1. Replace with `sudo dpkg -i srlgpt.deb` if you're using DEB package manager.

Now enter SR Linux CLI and reload `app_mgr` so that it can read the new application YANG models:

```
[root@srl /]# sr_cli
Using configuration file(s): []
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ running }--[ ]--
A:srl# tools system app-management application app_mgr reload
```

We need to get into a new CLI session to pickup on the newly installed CLI plugin and configuration tree. So close the existing session and open a new one:

```srl
❯ ssh admin@clab-srl-srl

................................................................
: Welcome to Nokia SR Linux! :
: Open Network OS for the NetOps era. :
: :
: This is a freely distributed official container image. :
: Use it - Share it :
: :
: Get started: https://learn.srlinux.dev :
: Container: https://go.srlinux.dev/container-image :
: Docs: https://doc.srlinux.dev/23-7 :
: Rel. notes: https://doc.srlinux.dev/rn23-7-1 :
: YANG: https://yang.srlinux.dev/v23.7.1 :
: Discord: https://go.srlinux.dev/discord :
: Contact: https://go.srlinux.dev/contact-sales :
................................................................

Last login: Mon Oct 9 21:24:47 2023 from 2001:172:20:20::1
Using configuration file(s): []
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ running }--[ ]--
A:srl#
```

!!!note "Configuring DNS servers"
For SR Linux GPT app to reach out to OpenAI API you need to configure DNS servers on your SR Linux device ensuring that DNS resolution works. Containerlab does that on your behalf, but if you don't use it you have to configure it manually. It might depend on your infra, but usually configuring public DNS servers works just fine:

```srl title="paste this into your CLI"
enter candidate
system dns network-instance mgmt server-list [ 1.1.1.1 ]
commit now
```
//// details | Alternative installation options
If you want to install SR Linux GPT app on a hardware device, or a virtual device that is run by a different orchestrator, you can download the SR Linux GPT application package and `scp` it to your SR Linux device.

!!!note
SR Linux GPT uses some advanced CLI capabilities that we added in 23.7.1, therefore you need to be running 23.7.1 or later.

/// tab | Install RPM
Up until release 23.10 SR Linux used to run Centos-based Linux OS with RPM package manager.

```bash
curl -L https://gitlab.com/rdodin/pics/-/wikis/uploads/5b5a3eab3e14229d484a35dcd2f23264/srlgpt_1.0.99_linux_amd64.rpm \
-o /tmp/srlgpt.rpm && scp /tmp/srlgpt.rpm clab-srl-srl: #(1)!
```

1. In the example the SR Linux node is named `clab-srl-srl`, replace with the name/address you have.
///
/// tab | Install DEB
Starting from 23.10 version, SR Linux uses Debian-based Linux OS with DEB package manager.

```bash
curl -L https://gitlab.com/rdodin/pics/-/wikis/uploads/19637b56a042c6d6aaa51072e3fefa55/srlgpt_1.0.99_linux_amd64.deb \
-o /tmp/srlgpt.deb && scp /tmp/srlgpt.deb clab-srl-srl: #(1)!
```

2. In the example the SR Linux node is named `clab-srl-srl`, replace with the name/address you have.
///

Now install the copied package by opening a bash shell and running the relevant command for the package manager used in your SR Linux version.

```bash
docker exec -it clab-srl-srl bash
```

```bash
[admin@srl ~]$ sudo rpm -i srlgpt.rpm #(1)!
```

1. Replace with `sudo dpkg -i srlgpt.deb` if you're using DEB package manager.

Now enter SR Linux CLI and reload `app_mgr` so that it can read the new application YANG models:

```
[root@srl /]# sr_cli
Using configuration file(s): []
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ running }--[ ]--
A:srl# tools system app-management application app_mgr reload
```

We need to get into a new CLI session to pickup on the newly installed CLI plugin and configuration tree. So close the existing session and open a new one:

```srl
❯ ssh admin@clab-srl-srl
................................................................
: Welcome to Nokia SR Linux! :
: Open Network OS for the NetOps era. :
: :
: This is a freely distributed official container image. :
: Use it - Share it :
: :
: Get started: https://learn.srlinux.dev :
: Container: https://go.srlinux.dev/container-image :
: Docs: https://doc.srlinux.dev/23-7 :
: Rel. notes: https://doc.srlinux.dev/rn23-7-1 :
: YANG: https://yang.srlinux.dev/v23.7.1 :
: Discord: https://go.srlinux.dev/discord :
: Contact: https://go.srlinux.dev/contact-sales :
................................................................
Last login: Mon Oct 9 21:24:47 2023 from 2001:172:20:20::1
Using configuration file(s): []
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ running }--[ ]--
A:srl#
```

/// note | Configuring DNS servers
For SR Linux GPT app to reach out to OpenAI API you need to configure DNS servers on your SR Linux device ensuring that DNS resolution works. Containerlab does that on your behalf, but if you don't use it you have to configure it manually. It might depend on your infra, but usually configuring public DNS servers works just fine:

```srl title="paste this into your CLI"
enter candidate
system dns network-instance mgmt server-list [ 1.1.1.1 ]
commit now
```

///
////

### Configuring SR Linux GPT App

Expand Down Expand Up @@ -277,3 +293,8 @@ And for a deep dive into the SR Linux GPT app, check out Erwan James' appearance
<div class="iframe-container">
<iframe width="853" height="480" src="https://www.youtube.com/embed/zxwdecY12-E" title="SR Linux GPT" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>

and a demo of the SR Linux GPT app in action at NFD33:
<div class="iframe-container">
<iframe width="100%" src="https://www.youtube.com/embed/tUjN2VtveCw" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
73 changes: 73 additions & 0 deletions docs/blog/posts/2023/sshx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
date: 2023-11-07
tags:
- sr linux
- ssh
authors:
- rdodin
---

# Sharing SR Linux Terminal with SSHX

Countless times I've been in a situation where I needed to share my terminal with someone or being asked to connect to someone's device instead.

Either I exhausted my networking foo and needed help from a colleague, or I was the one who was asked to help. In both cases, the problem was the same - how to **quickly**, **securely**[^1] and **effortlessly** share the terminal with someone else.

The problem is not new and there are many options on the table. From installing a VPN software and sharing the credentials, through zero-trust solutions like [teleport](https://goteleport.com/), to using a simple SSH tunnel. All of these solutions are great, but they require some setup and configuration. And sometimes you just want to share your terminal with someone without going through the hassle of setting up a VPN or a zero-trust solution.

The [sshx.io](https://sshx.io) open-source service that [just](https://twitter.com/ekzhang1/status/1721288674204131523) popped out offers a simple solution to this problem.

1. Install the multi-arch lightweight[^2] `sshx` binary on your machine
2. Run `sshx`
3. Share the URL with someone
4. Enjoy collaborative terminal in a responsive web UI with a multi panel canvas

I felt an immediate urge to try it out with SR Linux. And it worked like a charm!

<div class="iframe-container">
<iframe width="560" height="315" src="https://www.youtube.com/embed/-BByXtL6dNo?si=vkvZUUPsxg7GdF6R" title="Sharing SR Linux Terminal with SSHX" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>

<!-- more -->

It is super easy to bring `sshx` to SR Linux, here is a quick demo environment that you can spin up to try it out:

1. Deploy a single-node SR Linux lab

```
curl -sL srlinux.dev/clab-srl | sudo clab dep -c -t -
```

2. Login to the newly-created `srl` node

```
ssh srl
```

3. In the SR Linux terminal go to `bash` and install `sshx`

```srl
--{ running }--[ ]--
A:srl# bash
[admin@srl ~]$
```

4. Install `sshx`

```bash
[admin@srl ~]$ curl -sSf https://sshx.io/get | sh
```

5. Run `sshx`, grab a link and pop up the Web UI with the terminal

```bash
[admin@srl ~]$ sshx
sshx v0.2.0
➜ Link: https://sshx.io/s/bRPTeBxXiY#YKcwyLj03r0tik
➜ Shell: /bin/bash
```

[^1]: Usual security measures apply. Vet the installation binary, keep a vetted copy of the binary, etc.
[^2]: The binary is around 3MB in size
2 changes: 1 addition & 1 deletion docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Let's explore the different ways you can launch SR Linux container.
```shell
sudo docker run -t -d --rm --privileged \
-u 0:0 \
-v srl23-7-1.json:/etc/opt/srlinux/config.json \ #(1)!
-v srl23-7-1.json:/etc/opt/srlinux/config.json \#(1)!
--name srlinux ghcr.io/nokia/srlinux:23.7.1 \
sudo bash /opt/srlinux/bin/sr_linux
```
Expand Down
5 changes: 5 additions & 0 deletions docs/images/srl-icong-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 68b7899

Please sign in to comment.