Skip to content

Commit

Permalink
adds terminalgpt
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfriesen committed May 28, 2024
1 parent 6875cdf commit 74b20a8
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/.tools/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ cd "$SCRIPT_DIR/.."
README_WEB_TEMPLATE=$(cat "$SCRIPT_DIR/readme.web.md")
README_CONSOLE_TEMPLATE=$(cat "$SCRIPT_DIR/readme.console.md")

# Skip
skip_projects=("terminalgpt")

# List of console languages
console_languages=("curl")

Expand All @@ -18,6 +21,13 @@ for dir in */; do
if [ -f "${dir}Dockerfile" ]; then
# Remove the trailing slash from the directory name
service_name=${dir%/}

# Check if the service_name is in the skip_projects array
if [[ " ${skip_projects[@]} " =~ " ${service_name} " ]]; then
echo "Skipping $service_name"
continue
fi

# Extract the service language
service_language=$(echo "$service_name" | cut -d'-' -f1)

Expand Down
1 change: 1 addition & 0 deletions apps/curl-geoweather/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Within an app directory of your choosing, run the following command to build and
docker build -t curl-geoweather . && \
docker run -it --rm \
--network host \
-e http_proxy=http://localhost:18080 \
-e HTTP_PROXY=http://localhost:18080 \
-e HTTPS_PROXY=http://localhost:18443 \
curl-geoweather
Expand Down
17 changes: 17 additions & 0 deletions apps/terminalgpt/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:latest

# Get latest CA's
ARG TOKEN
RUN apt-get update && apt-get install -y curl bash ca-certificates && \
if [ -n "$TOKEN" ]; then \
curl -s https://api.qpoint.io/deploy/certificate -H "Authorization: Bearer $TOKEN" > /usr/local/share/ca-certificates/qpoint-ca.crt && \
update-ca-certificates; \
fi

# Set the working directory inside the container.
WORKDIR /app

RUN curl -sSL https://raw.githubusercontent.com/aandrew-me/tgpt/main/install | bash -s /usr/local/bin

CMD ["tgpt", "-i"]

58 changes: 58 additions & 0 deletions apps/terminalgpt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# TerminalGPT

This is a simple chat GPT like in the terminal.


## Prerequisites

- Git
- Docker

## Running the Application

### 1. Setup a Qpoint Qproxy
This demo utilizes the Qpoint Control Plane and requires a free Qpoint account.

1. Head over to [Qpoint](https://qpoint.io) and sign up for an account.
2. Click the `+ Go` button on the nav bar.
3. Select the `Deploy Qproxy` option.
4. Select `Docker`.
5. Copy the provided Docker run command and execute it in a terminal.
6. Set the Address, `localhost` is probably fine for this example.

At this point, you'll have a running Qpoint proxy ready to take on traffic!

### 2. Connect an App to a Transparent Qpoint Proxy

1. On the [Qpoint Dashboard](https://qpoint.io), select `+ Go`.
2. Select `Connect an App` on the right side of the menu.
3. Select the `Proxy Environment Variable` option.
4. Select the `Transparent Proxy` option.
5. Make a note of the HTTP and HTTPS proxy URLs.

### 3. Clone the Repository

```
git clone https://github.com/qpoint-io/demos.git
cd demos/apps/terminalgpt
```

### 4. Build & Start the Docker Container
Within the terminalgpt directory of your choosing, run the following command to build and run the application.

> Note: If you used an address other than "localhost," make sure to update those values in this command.
```
docker build -t terminalgpt . && \
docker run -it --rm \
--network host \
-e HTTP_PROXY=http://localhost:10080 \
-e HTTPS_PROXY=http://localhost:10443 \
terminalgpt
```

> Note: This command uses the host machine's network to provide access to the published ports in the Qpoint container.
## License

This project is licensed under the Apache-2.0 License.

0 comments on commit 74b20a8

Please sign in to comment.