Deploying DocsGPT on Civo Compute
Tags: ai, cloud, gpt3, automl
Published: 2023-10-17 22:27:30

![Cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gvjgnq1fvjtqu59b6u7e.png)

## Introduction

DocsGPT is an AI assistant for your technical documentation needs. It serves you with any specific information you may seek from a piece of documentation and eliminates the need for manual searches.

In this tutorial, you will learn to self-host DocsGPT on one of the major cloud providers i.e., Civo. The only objective will be to deploy an instance of DocsGPT on a Civo Compute VM.

## Initiating Civo Compute

We will start this tutorial by creating a Civo compute instance first. The steps given below will simply help you create one easily.

**Step 1:** Login to your Civo Dashboard. If you don't have an account, then simply [Sign Up](https://dashboard.civo.com/signup) and claim your free credits worth 250$ valid for 1 month.

![Civo Signup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rftcf49a74gjyj2x6v0i.png)

**Step 2:** Once you're in the Civo Dashboard, click on `Compute` from the left panel and then click on the `Launch my first instance` button.

![Create Compute](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7thspoff9v60xz2xskv2.png)

**Step 3:** Here you need to define the configuration for the compute machine that you want to create. Feel free to customize it as per your demands but for the sake of this tutorial, we will use the configuration given below.

- **Hostname:** Name the machine as you wish.
- **How many instances:** Keep it at default 1.
- **Select Size:** Select `Small Standard` as the size.
- **Select image:** Choose `Ubuntu 22.04 LTS`.
- **Initial User:** Choose `root` to have all privileges or `ubuntu` to have the standard privileges.
- **Network:** Keep it at `default`.
- **Public IP address:** You will need a Public IP to be able to use DocsGPT instance from the internet. Select `Create`.
- **Firewall:** Use `default-default` from the dropdown or if you don't have that option, then select `Create new firewall`. It will add a default firewall policy.
- **SSH Key:** Choose `Random Password`.
- **Initialisation Script:** Leave it empty.
- **Tags:** Leave it empty as well.

![Compute Config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9f0tlmtzqy0n7wio7gfa.png)

Now click on the `Create` button. This is going to take a while to boot up your new instance.

**Step 4:** Wait until you can see the `The instance is running.` message at the top of the screen. You can now click on the `View SSH information` to find your username and random password that you can use to log in to your instance through SSH.

![Instance Ready](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ka77n51bcs0rwunzf8z.png)

You're now ready to move to the next part where you will install DocsGPT in your instance and use it through your Public IP.

## Deploying DocsGPT

You can now simply follow the steps below to successfully deploy DocsGPT on your compute instance.

**Step 1:** Open your terminal and SSH into your compute instance using the command below.

```bash
ssh username@<Public IP of the instance>
```

Type `yes` when prompted and then enter the random password that you can find in the `SSH Information` panel on your compute dashboard to log in.

![SSH Instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2g3k3h1xifsmv7w3e606.png)

**Step 2:** Now you can clone the DocsGPT clone repository to your instance with the command given below.

```bash
git clone https://github.com/arc53/DocsGPT.git
```

![GIT Clone](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upmwsrpqt7aq3nlcnihc.png)

Now, try running the following to update the package lists.

```bash
sudo apt update
```

![sudo apt update](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/swfysw7q84ikpotov5ok.png)

**Step 3:** You will need the docker and docker-compose containerization tools to run DocsGPT easily. You can install these using the following commands.

```bash
sudo apt install docker.io
```

![Install Docker.io](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opdjw8ey17uyk24bp0zd.png)

Now install docker-compose. Type `Y` and hit `Enter` when prompted.

```bash
sudo apt install docker-compose
```

![Install Docker-Compose](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vloqucsu774ccrjiqj7q.png)

**Step 3:** Navigate to the DocsGPT folder now and define the environment variables in a `.env` file.

```bash
cd DocsGPT/

nano .env
```

Enter the following details in your `.env` and save it.

```
API_KEY= <Your OpenAI API key>
VITE_API_STREAMING= true
```

![.env File](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ykhqwpmvlw024rtb97zo.png)

Use `Ctrl + X` and then type `Y` and hit `Enter` to exit the editor.

**Step 4:** You will now need to set the correct IP for the backend so that it can communicate with the frontend properly. Modify the `docker-compose.yaml` file to do this.

```bash
nano docker-compose.yaml
```

Navigate to Line 7 where the `VITE_API_HOST` is defined. Modify the host URL as such.

```bash
VITE_API_HOST=http://<Compute Instance Public IP>:7091
```

![Docker Compose Config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q9pczhkvn6n69gvsa3p1.png)

**Step 5:** You can now run the DocsGPT app on your instance with the command below. The initial start-up time can be a bit longer as it downloads all the necessary dependencies and builds the app.

```bash
sudo docker-compose up -d
```

![Running DocsGPT](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fk2sl50o3mijkehkn5y2.png)

Now you should be able to access your own self-hosted DocsGPT on Civo Compute using the following URL.

```bash
http://<Public Compute Instance IP:5173>
```

![DocsGPT UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xsnrjw3zosxtf8fon93d.png)

## Working with DocsGPT

When you open the DocsGPT page for the first time, it is going to ask you to select `Source Document`. You can choose any one source from the list and then start querying about it using DocsGPT.

![Selecting Source](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2bxwarailhfbzmzac8up.png)

You can now query anything about the Docs.

For e.g., if you selected the source document as `default`, then you can ask generic queries about it.

```bash
You: What is DocsGPT?

DocsGPT: DocsGPT is an AI-powered language model developed using OpenAI's GPT (Generative Pre-trained Transformer) architecture. It is designed specifically to assist users in composing and editing documents. DocsGPT can help generate text in various formats, such as essays, code snippets, technical documentation, and more. It understands natural language commands and provides informative responses to user queries. Through its conversational interface, DocsGPT can assist with a wide range of document-related tasks, including content generation, formatting, organization, and more.
```

![Querying DocsGPT](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5q5uochf2ecixcv9fv26.png)

So, now your self-hosted DocsGPT instance is ready to serve all of your documentation needs.

## Conclusion

DocsGPT is ever-evolving, and they are striving to add more features and are continuously supporting the community and consumers as much as they can.

Feel free to use it yourself and share your feedback with the team.

We hope you had a great time reading this deployment guide. Don't forget to drop a Like and share it with your peers.


[![DocsGPT Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vqnxhej0likzfwwakkzx.png)](https://docsgpt.arc53.com/)