Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move use cases to connections #36

Merged
merged 4 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 11
slug: /usecases/aws-resources
slug: /connections/aws-resources
---

# AWS | resources
Expand Down
36 changes: 31 additions & 5 deletions docs/usecases/ecs-exec-oneoff.md → docs/connections/ecs-exec.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
sidebar_position: 10
slug: /usecases/ecs-exec-oneoff
sidebar_position: 11
slug: /connections/ecs-exec
---

# AWS ECS | exec one-off
# AWS ECS

The Elastic Container Service allows executing one off tasks of any type directly into ECS tasks/containers.
Interact with Elastic Container Service executing one off tasks or an interactive session into ECS tasks/containers.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here


:::info note
It's important to configure the ECS tasks before trying this feature, please refer to the [AWS documentation first](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html)
Expand All @@ -21,13 +21,39 @@ It's important to configure the ECS tasks before trying this feature, please ref
| `AWS_SECRET_ACCESS_KEY` | env-var | The secret key credential |
| `AWS_DEFAULT_REGION` | env-var | The AWS region |

## AWS ECS - Interactive Sessions

The AWS Elastic Container Service allows connecting to tasks and starting interactive sessions. It's possible to map these commands to Hoop to obtain interactive sessions allocating a pseudo TTY.

:::info note
It's important to configure the ECS tasks before trying this feature, please refer to the [AWS documentation first](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html)
:::

### Connection Command

```shell
ecs-exec.sh --interactive --cluster=$CLUSTER_NAME --service-name=$SERVICE_NAME
```

### How to Use

Start an interactive session

```shell
hoop connect my-ecs -- --pipe /bin/bash
hoop connect my-ecs -- --pipe 'rails console'
hoop connect my-ecs -- --pipe clojure
```

## AWS ECS - Execute one task off
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task to session here as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to call "One Off Execution" @mtmr0x . The session is derived from an execution.


### Connection Command

```shell
ecs-exec.sh --cluster=$CLUSTER_NAME --service-name=$SERVICE_NAME
```

## How to Use
### How to Use

Now it's possible to execute ruby script straight from Hoop

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
sidebar_position: 7
slug: /usecases/heroku-oneoff
sidebar_position: 20
slug: /connections/heroku-oneoff
---

import ConnectOnHoopButton from './../../src/components/ConnectOnHoopButton';

# Heroku one-off
# Heroku execute task one-off
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I would change the task to session here. I say that because task is a Runops concept and I would want to avoid confusion but maybe it's here for a reason that I don't know

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is related to heroku one off dynos:
https://devcenter.heroku.com/articles/one-off-dynos


<ConnectOnHoopButton url='https://app.hoop.dev/connections/command-line/new?data=ewogICAgIm5hbWUiOiJteS1oZXJva3Utb25lLW9mZiIsCiAgICAidHlwZSI6ImNvbW1hbmQtbGluZSIsCiAgICAiaWNvbl9uYW1lIjogImhlcm9rdSIsCiAgICAic2VjcmV0IjogewogICAgICAgICJlbnZ2YXI6SEVST0tVX0FQSV9LRVkiOiIiCiAgICB9LAogICAgImNvbW1hbmQiOiBbIi9hcHAvYmluL2hlcm9rdSIsICJydW4iLCAiLS1leGl0LWNvZGUiXQp9' />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
sidebar_position: 8
slug: /usecases/heroku-psexec
sidebar_position: 20
slug: /connections/heroku-psexec
---

import ConnectOnHoopButton from './../../src/components/ConnectOnHoopButton';

# Heroku | exec
# Heroku | interactive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe interactive is the command "connect" not the "exec". I always make misunderstand these kinds of commands, hahaha, but I believe that "exec" is not interactive.
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The psexec allows connecting both interactive and non-interactive as do heroku one-off. The difference between then is that ps-exec executes stuff inside a running dyno and the other one executes in an one off dyno:
https://devcenter.heroku.com/articles/one-off-dynos


<ConnectOnHoopButton url='https://app.hoop.dev/connections/command-line/new?data=ewogICAgIm5hbWUiOiJteS1oZXJva3UtZXhlYyIsCiAgICAidHlwZSI6ImNvbW1hbmQtbGluZSIsCiAgICAiaWNvbl9uYW1lIjogImhlcm9rdSIsCiAgICAic2VjcmV0IjogewogICAgICAgICJlbnZ2YXI6SEVST0tVX0FQSV9LRVkiOiIiCiAgICB9LAogICAgImNvbW1hbmQiOiBbIi9hcHAvYmluL3BzLWV4ZWMuc2giXQp9' />

Expand Down
6 changes: 3 additions & 3 deletions docs/usecases/forwarding-http.md → docs/connections/http.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 3
slug: /usecases/forwarding-http
sidebar_position: 2
slug: /connections/http
---

# Port Forward | http
# Http

Port Forward local ports from your private network | HTTP example.

Expand Down
2 changes: 2 additions & 0 deletions docs/connections/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Connect and interact with your internal services.

Quickstart about how to connect hoop with the services.

```mdx-code-block
import DocCardList from '@theme/DocCardList';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
sidebar_position: 4
slug: /usecases/k8s-exec
sidebar_position: 7
slug: /usecases/k8s/exec
---

import ConnectOnHoopButton from './../../src/components/ConnectOnHoopButton';

# Kubernetes | exec
# Kubernetes

<ConnectOnHoopButton url='https://app.hoop.dev/connections/command-line/new?data=ewogICAgIm5hbWUiOiJteS1rdWJlcm5ldHMtZXhlYyIsCiAgICAidHlwZSI6ImNvbW1hbmQtbGluZSIsCiAgICAiaWNvbl9uYW1lIjogImt1YmVybmV0ZXMiLAogICAgInNlY3JldCI6IHsKICAgICAgICAiZmlsZXN5c3RlbTpLVUJFQ09ORklHIjoiIiwKICAgICAgICAiZW52dmFyOkRFUExPWV9OQU1FIjogIiIsCiAgICAgICAgImVudnZhcjpOQU1FU1BBQ0UiOiAiIgogICAgfSwKICAgICJjb21tYW5kIjogWyJrdWJlY3RsIiwgImV4ZWMiLCAiLS10dHkiLCAiLS1zdGRpbiIsICIkREVQTE9ZX05BTUUiLCAiLS1uYW1lc3BhY2UiLCAiJE5BTUVTUEFDRSIsICItLSJdCn0=' />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 5
slug: /usecases/k8s-oneoff
sidebar_position: 7
slug: /usecases/k8s/oneoff
---

import ConnectOnHoopButton from './../../src/components/ConnectOnHoopButton';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 6
slug: /usecases/k8s-resources
sidebar_position: 7
slug: /usecases/k8s/resources
---

# Kubernetes | resources
Expand All @@ -23,11 +23,11 @@ kubectl

```shell
# view pods in the default namespace
hoop exec k8s -- get pods
hoop exec my-conn-k8s -- get pods
# restart an app
hoop exec k8s -- rollout restart deployment/myapp
# scale up an app
hoop exec k8s -- scale --replicas=3 deployment/myapp
hoop exec my-conn-k8s -- scale --replicas=3 deployment/myapp
```

It's possible to narrow down the commands in distinct connections, this gives a better user experience
Expand All @@ -41,6 +41,6 @@ kubectl --namespace prod rollout
Then it's possible

```shell
hoop exec k8s -- restart deployment/myapp
hoop exec k8s -- undo deployment/myapp
hoop exec my-conn-k8s -- restart deployment/myapp
hoop exec my-conn-k8s -- undo deployment/myapp
```
2 changes: 1 addition & 1 deletion docs/usecases/mongodb.md → docs/connections/mongodb.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 16
slug: /usecases/mongodb
slug: /connections/mongodb
---

# MongoDB | mongosh cli
Expand Down
4 changes: 2 additions & 2 deletions docs/usecases/mysqlcli.md → docs/connections/mysql-cli.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 14
slug: /usecases/mysqlcli
sidebar_position: 3
slug: /connections/mysqlcli
---

# MySQL | mysql cli
Expand Down
4 changes: 4 additions & 0 deletions docs/connections/native/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Native Connections",
"position": 1
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 1
slug: /connections/command-line
slug: /connections/native/command-line
---

import ConnectOnHoopButton from './../../src/components/ConnectOnHoopButton';
import ConnectOnHoopButton from './../../../src/components/ConnectOnHoopButton';

# Command Line

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 2
slug: /connections/port-forward
slug: /connections/native/port-forward
---

import ConnectOnHoopButton from './../../src/components/ConnectOnHoopButton';
import ConnectOnHoopButton from './../../../src/components/ConnectOnHoopButton';

# Port Forward

Expand Down
6 changes: 3 additions & 3 deletions docs/usecases/psql.md → docs/connections/postgres-psql.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 14
slug: /usecases/psql
sidebar_position: 4
slug: /connections/psql
---

# Postgres | psql cli
# Postgres | psql cli

An optional way to connect into postgres is using the `psql` client. It's possible to create a interactive session or execute one-off commands.

Expand Down
2 changes: 1 addition & 1 deletion docs/connections/postgres.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 3
sidebar_position: 5
slug: /connections/postgres
---

Expand Down
4 changes: 2 additions & 2 deletions docs/usecases/postgres.md → docs/connections/postgres.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 13
slug: /usecases/postgres
sidebar_position: 5
slug: /connections/postgres-psql
---

# Postgres
Expand Down
4 changes: 2 additions & 2 deletions docs/usecases/scripts.md → docs/connections/scripts.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 16
slug: /usecases/scripts
slug: /connections/scripts
---

# Scripts | one-off
# Execute scripts with Hoop connections

Allows executing one-off scripts using the underlying Operating System tools.

Expand Down
4 changes: 2 additions & 2 deletions docs/usecases/sqlserver.md → docs/connections/sqlserver.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 15
slug: /usecases/sqlserver
sidebar_position: 6
slug: /connections/sqlserver
---

# SQL Server | sqlcmd cli
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 17
slug: /usecases/bastion
slug: /connections/bastion
---

# Bastion Server | ssh cli
Expand Down
4 changes: 2 additions & 2 deletions docs/installing-hoop-agent/heroku.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ After disconnecting it, check if there's any recorded session available at **htt
See how to use the heroku cli through Hoop.

- [Heroku Management Guide](../tutorials/heroku-exec.mdx)
- [Heroku ps:exec](../usecases/heroku-psexec.mdx)
- [Heroku one-off](../usecases/heroku-oneoff.mdx)
- [Heroku ps:exec](../connections/heroku-psexec.mdx)
- [Heroku one-off](../connections/heroku-oneoff.mdx)
33 changes: 16 additions & 17 deletions docs/setting-up/quickstart-builder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@ import DockerPlatform from './../installing-hoop-agent/docker.mdx';
import HerokuPlatform from './../installing-hoop-agent/heroku.mdx';
import KubernetesPlatform from './../installing-hoop-agent/kubernetes.md';

// use cases docs
import MySQLUseCase from './../usecases/forwarding-mysql.md';
import MySQLCLIUseCase from './../usecases/mysql.md';
import NativePostgresUseCase from './../usecases/postgres.md';
import PostgresPSQLUseCase from './../usecases/psql.md';
import MongoDBmongoshUseCase from './../usecases/mongodb.md';
import KubernetesExecUseCase from './../usecases/kubernetes-exec.mdx';
import KubernetesResourcesUseCase from './../usecases/kubernetes-resources.md';
import HerokuExecUseCase from './../usecases/heroku-oneoff.mdx';
import HerokuInteractiveUseCase from './../usecases/heroku-psexec.mdx';
import AWSExecUseCase from './../usecases/ecs-exec.md';
import AWSResourcesUseCase from './../usecases/aws-resources.md';
import SQLServerCLIUseCase from './../usecases/sqlserver.md';
import BastionServerUseCase from './../usecases/ssh-bastion.md';
import PortForwardHTTPUseCase from './../usecases/forwarding-http.md';
// use cases docs --> moved to connections
import MySQLCLIUseCase from './../connections/mysql-cli.md';
import NativePostgresUseCase from './../connections/postgres-psql.md';
import PostgresPSQLUseCase from './../connections/postgres-psql.md';
import MongoDBmongoshUseCase from './../connections/mongodb.md';
import KubernetesExecUseCase from './../connections/kubernetes-exec.mdx';
import KubernetesResourcesUseCase from './../connections/kubernetes-resources.md';
import HerokuExecUseCase from './../connections/heroku-oneoff.mdx';
import HerokuInteractiveUseCase from './../connections/heroku-psexec.mdx';
import AWSExecUseCase from './../connections/ecs-exec.md';
import AWSResourcesUseCase from './../connections/aws-resources.md';
import SQLServerCLIUseCase from './../connections/sqlserver.md';
import BastionServerUseCase from './../connections/ssh-bastion.md';
import PortForwardHTTPUseCase from './../connections/http.md';

// connections
import CommandLineConnection from './../connections/command-line.mdx';
import PortForwardConnection from './../connections/port-forward.mdx';
import CommandLineConnection from './../connections/native/command-line.mdx';
import PortForwardConnection from './../connections/native/port-forward.mdx';
import PostgresConnection from './../connections/postgres.mdx';

const docOptions = {
Expand Down
4 changes: 0 additions & 4 deletions docs/usecases/_category_.json

This file was deleted.

39 changes: 0 additions & 39 deletions docs/usecases/ecs-exec.md

This file was deleted.