Skip to content
Snippets Groups Projects
Commit c3fa67bc authored by timothycarambat's avatar timothycarambat
Browse files

Update AWS deployment

parent 92425782
No related branches found
No related tags found
No related merge requests found
...@@ -3,53 +3,39 @@ ...@@ -3,53 +3,39 @@
With an AWS account you can easily deploy a private AnythingLLM instance on AWS. This will create a url that you can access from any browser over HTTP (HTTPS not supported). This single instance will run on your own keys and they will not be exposed - however if you want your instance to be protected it is highly recommend that you set the `AUTH_TOKEN` and `JWT_SECRET` variables in the `docker/` ENV. With an AWS account you can easily deploy a private AnythingLLM instance on AWS. This will create a url that you can access from any browser over HTTP (HTTPS not supported). This single instance will run on your own keys and they will not be exposed - however if you want your instance to be protected it is highly recommend that you set the `AUTH_TOKEN` and `JWT_SECRET` variables in the `docker/` ENV.
**Quick Launch (EASY)** **Quick Launch (EASY)**
2. Log in to your AWS account 1. Log in to your AWS account
3. Open [CloudFormation](https://us-west-1.console.aws.amazon.com/cloudformation/home) 2. Open [CloudFormation](https://us-west-1.console.aws.amazon.com/cloudformation/home)
4. Ensure you are deploying in a geographic zone that is nearest to your physical location to reduce latency. 3. Ensure you are deploying in a geographic zone that is nearest to your physical location to reduce latency.
5. Click `Create Stack` 4. Click `Create Stack`
6. Use the file `create_anythinng_llm_instance.json` as your JSON template.
7. Launch. On first boot fill out your ENV keys and you are fully live. Time to boot is approximately 60 seconds.
Done.
**Custom Launch and Build From Source**
[Refer to .env.example](../../../docker/HOW_TO_USE_DOCKER.md) for data format.
The output of this cloudformation stack will be:
- 1 EC2 Instance
- 1 Security Group with 0.0.0.0/0 access on Ports 22 & 3001
- 1 EC2 Instance Volume `gb2` of 10Gib minimum
**Requirements**
- An AWS account with billing information.
- AnythingLLM (GUI + document processor) must use a t2.small minimum and 10Gib SSD hard disk volume
- `.env` file that is filled out with your settings and set up in the `docker/` folder
## How to deploy on AWS
1. Generate your specific cloudformation document by running `yarn generate:cloudformation` from the project root directory.
2. Log in to your AWS account
3. Open [CloudFormation](https://us-west-1.console.aws.amazon.com/cloudformation/home)
4. Ensure you are deploying in a geographic zone that is nearest to your physical location to reduce latency.
5. Click `Create Stack`
![Create Stack](../../../images/screenshots/create_stack.png) ![Create Stack](../../../images/screenshots/create_stack.png)
6. Upload your `aws_cf_deploy_anything_llm.json` to the stack 5. Use the file `cloudformation_create_anythingllm.json` as your JSON template.
![Upload Stack](../../../images/screenshots/upload.png) ![Upload Stack](../../../images/screenshots/upload.png)
7. Click `Next` and give your stack a name. This is superficial. 6. Click Deploy.
8. No other changes are needed, just proceed though each step 7. Wait for stack events to finish and be marked as `Completed`
9. Click `Submit` 8. View `Outputs` tab.
10. Wait for stack events to finish and be marked as `Completed`
11. View `Outputs` tab.
![Stack Output](../../../images/screenshots/cf_outputs.png) ![Stack Output](../../../images/screenshots/cf_outputs.png)
9. Wait for all resources to be built. Now wait until instance is available on `[InstanceIP]:3001`.
This process may take up to 10 minutes. See **Note** below on how to visualize this process.
The output of this cloudformation stack will be:
- 1 EC2 Instance
- 1 Security Group with 0.0.0.0/0 access on port 3001
- 1 EC2 Instance Volume `gb2` of 10Gib minimum - customizable pre-deploy.
**Requirements**
- An AWS account with billing information.
- AnythingLLM (GUI + document processor) must use a t2.small minimum and 10Gib SSD hard disk volume
## Please read this notice before submitting issues about your deployment ## Please read this notice before submitting issues about your deployment
**Note:** **Note:**
Your instance will not be available instantly. Depending on the instance size you launched with it can take anywhere from 10-20 minutes to fully boot up. Your instance will not be available instantly. Depending on the instance size you launched with it can take varying amounts of time to fully boot up.
If you want to check the instance's progress, navigate to [your deployed EC2 instances](https://us-west-1.console.aws.amazon.com/ec2/home) and connect to your instance via SSH in browser. If you want to check the instance's progress, navigate to [your deployed EC2 instances](https://us-west-1.console.aws.amazon.com/ec2/home) and connect to your instance via SSH in browser.
......
...@@ -83,39 +83,25 @@ ...@@ -83,39 +83,25 @@
"#!/bin/bash\n", "#!/bin/bash\n",
"# check output of userdata script with sudo tail -f /var/log/cloud-init-output.log\n", "# check output of userdata script with sudo tail -f /var/log/cloud-init-output.log\n",
"sudo yum install docker -y\n", "sudo yum install docker -y\n",
"sudo usermod -a -G docker ec2-user\n", "sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose\n",
"curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose\n",
"sudo chmod +x /usr/local/bin/docker-compose\n", "sudo chmod +x /usr/local/bin/docker-compose\n",
"sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose\n", "sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose\n",
"sudo systemctl enable docker\n", "sudo systemctl enable docker\n",
"sudo systemctl start docker\n", "sudo systemctl start docker\n",
"sudo yum install git -y\n", "sudo yum install git -y\n",
"git clone https://github.com/Mintplex-Labs/anything-llm.git /home/ec2-user/anything-llm\n", "git clone https://github.com/Mintplex-Labs/anything-llm.git /home/ec2-user/anything-llm\n",
"sudo touch /home/ec2-user/anything-llm/server/storage/anythingllm.db\n", "touch /home/ec2-user/anything-llm/server/storage/anythingllm.db\n",
"cd /home/ec2-user/anything-llm/docker\n", "cd /home/ec2-user/anything-llm/docker\n",
"cat >> .env << \"END\"\n", "cp .env.example .env\n",
"SERVER_PORT=3001\n",
"OPEN_AI_KEY=\n",
"OPEN_MODEL_PREF='gpt-3.5-turbo'\n",
"CACHE_VECTORS=\"true\"\n",
"VECTOR_DB=\"lancedb\"\n",
"STORAGE_DIR=\"/app/server/storage\"\n",
"GOOGLE_APIS_KEY=\n",
"UID=\"1000\"\n",
"GID=\"1000\"\n",
"END\n",
"cd ../frontend\n", "cd ../frontend\n",
"rm -rf .env.production\n", "rm -rf .env.production\n",
"cat >> .env.production << \"END\"\n", "cat >> .env.production << \"END\"\n",
"GENERATE_SOURCEMAP=true\n", "GENERATE_SOURCEMAP=true\n",
"VITE_API_BASE=\"/api\"\n", "VITE_API_BASE=\"/api\"\n",
"END\n", "END\n",
"sudo chown ec2-user:ec2-user -R /home/ec2-user/anything-llm\n",
"sudo docker-compose -f /home/ec2-user/anything-llm/docker/docker-compose.yml up -d\n", "sudo docker-compose -f /home/ec2-user/anything-llm/docker/docker-compose.yml up -d\n",
"echo \"Container ID: $(sudo docker ps --latest --quiet)\"\n", "echo \"Container ID: $(sudo docker ps --latest --quiet)\"\n",
"sudo docker container exec -u 0 -t $(sudo docker ps --latest --quiet) mkdir -p /app/server/storage /app/server/storage/documents /app/server/storage/vector-cache /app/server/storage/lancedb\n",
"echo \"Placeholder folders in storage created.\"\n",
"sudo docker container exec -u 0 -t $(sudo docker ps --latest --quiet) chown -R anythingllm:anythingllm /app/collector /app/server\n",
"echo \"File permissions corrected.\"\n",
"export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)\n", "export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)\n",
"echo \"Health check: $ONLINE\"\n", "echo \"Health check: $ONLINE\"\n",
"if [ \"$ONLINE\" = 200 ] ; then echo \"Running migrations...\" && curl -Is http://localhost:3001/api/migrate | head -n 1|cut -d$' ' -f2; fi\n", "if [ \"$ONLINE\" = 200 ] ; then echo \"Running migrations...\" && curl -Is http://localhost:3001/api/migrate | head -n 1|cut -d$' ' -f2; fi\n",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment