You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DocsGPT/docs/pages/Deploying/Hosting-the-app.md

111 lines
3.8 KiB
Markdown

1 year ago
# Self-hosting DocsGPT on Amazon Lightsail
Here's a step-by-step guide on how to set up an Amazon Lightsail instance to host DocsGPT.
1 year ago
## Configuring your instance
11 months ago
(If you know how to create a Lightsail instance, you can skip to the recommended configuration part by clicking [here](#connecting-to-your-newly-created-instance)).
1 year ago
### 1. Create an AWS Account:
If you haven't already, create or log in to your AWS account at https://lightsail.aws.amazon.com.
1 year ago
### 2. Create an Instance:
1 year ago
a. Click "Create Instance."
1 year ago
b. Select the "Instance location." In most cases, the default location works fine.
1 year ago
c. Choose "Linux/Unix" as the image and "Ubuntu 20.04 LTS" as the Operating System.
1 year ago
d. Configure the instance plan based on your requirements. A "1 GB, 1vCPU, 40GB SSD, and 2TB transfer" setup is recommended for most scenarios.
1 year ago
e. Give your instance a unique name and click "Create Instance."
1 year ago
PS: It may take a few minutes for the instance setup to complete.
1 year ago
### Connecting to Your newly created Instance
1 year ago
Your instance will be ready a few minutes after creation. To access it, open the instance and click "Connect using SSH."
1 year ago
#### Clone the DocsGPT Repository
1 year ago
A terminal window will pop up, and the first step will be to clone the DocsGPT Git repository:
1 year ago
`git clone https://github.com/arc53/DocsGPT.git`
#### Download the package information
Once it has finished cloning the repository, it is time to download the package information from all sources. To do so, simply enter the following command:
1 year ago
`sudo apt update`
#### Install Docker and Docker Compose
1 year ago
DocsGPT backend and worker use Python, Frontend is written on React and the whole application is containerized using Docker. To install Docker and Docker Compose, enter the following commands:
1 year ago
`sudo apt install docker.io`
And now install docker-compose:
`sudo apt install docker-compose`
1 year ago
#### Access the DocsGPT Folder
1 year ago
Enter the following command to access the folder in which the DocsGPT docker-compose file is present.
`cd DocsGPT/`
#### Prepare the Environment
Inside the DocsGPT folder create a `.env` file and copy the contents of `.env_sample` into it.
1 year ago
`nano .env`
1 year ago
Make sure your `.env` file looks like this:
1 year ago
```
OPENAI_API_KEY=(Your OpenAI API key)
VITE_API_STREAMING=true
SELF_HOSTED_MODEL=false
```
1 year ago
To save the file, press CTRL+X, then Y, and then ENTER.
Next, set the correct IP for the Backend by opening the docker-compose.yml file:
`nano docker-compose.yml`
And Change line 7 to: `VITE_API_HOST=http://localhost:7091`
to this `VITE_API_HOST=http://<your instance public IP>:7091`
This will allow the frontend to connect to the backend.
1 year ago
#### Running the Application
1 year ago
You're almost there! Now that all the necessary bits and pieces have been installed, it is time to run the application. To do so, use the following command:
`sudo docker-compose up -d`
1 year ago
Launching it for the first time will take a few minutes to download all the necessary dependencies and build.
1 year ago
Once this is done you can go ahead and close the terminal window.
1 year ago
#### Enabling Ports
1 year ago
a. Before you are able to access your live instance, you must first enable the port that it is using.
1 year ago
b. Open your Lightsail instance and head to "Networking".
1 year ago
c. Then click on "Add rule" under "IPv4 Firewall", enter `5173` as your port, and hit "Create".
Repeat the process for port `7091`.
1 year ago
#### Access your instance
Your instance is now available at your Public IP Address on port 5173. Enjoy using DocsGPT!
## Other Deployment Options
- [Deploy DocsGPT on Civo Compute Cloud](https://dev.to/rutamhere/deploying-docsgpt-on-civo-compute-c)
- [Deploy DocsGPT on DigitalOcean Droplet](https://dev.to/rutamhere/deploying-docsgpt-on-digitalocean-droplet-50ea)
- [Deploy DocsGPT on Kamatera Performance Cloud](https://dev.to/rutamhere/deploying-docsgpt-on-kamatera-performance-cloud-1bj)