docs: update deployment templates to just pull the docker image (#445)

docs: update deployment templates to just pull the docker image and boot that instead of building
This commit is contained in:
Timothy Carambat 2023-12-13 19:55:23 -08:00 committed by GitHub
parent cc3343ba79
commit d094cc3c10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 109 deletions

View File

@ -80,10 +80,10 @@ These instructions are for CLI configuration and assume you are logged in to EC2
1. $sudo certbot --nginx -d [Insert FQDN here]
Example command: $sudo certbot --nginx -d anythingllm.exampleorganization.org
This command will generate the appropriate certificate files, write the files to /etc/letsencrypt/live/yourFQDN, and make updates to the nginx
configuration file for anythingllm locdated at /etc/nginx/conf.d/anything.llm
configuration file for anythingllm located at /etc/nginx/conf.d/anything.llm
3. Enter the email address you would like to use for updates.
4. Accept the terms of service.
5. Accept or decline to recieve communication from letsencrypt.
5. Accept or decline to receive communication from LetsEncrypt.
## Step 10: Test Cert installation
1. $sudo cat /etc/nginx/conf.d/anything.conf

View File

@ -5,7 +5,7 @@
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t2.small"
"Default": "t3.small"
},
"InstanceVolume": {
"Description": "Storage size of disk on Instance in GB",
@ -83,28 +83,16 @@
"#!/bin/bash\n",
"# check output of userdata script with sudo tail -f /var/log/cloud-init-output.log\n",
"sudo yum install docker -y\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",
"sudo chmod +x /usr/local/bin/docker-compose\n",
"sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose\n",
"sudo systemctl enable docker\n",
"sudo systemctl start docker\n",
"sudo yum install git -y\n",
"git clone https://github.com/Mintplex-Labs/anything-llm.git /home/ec2-user/anything-llm\n",
"touch /home/ec2-user/anything-llm/server/storage/anythingllm.db\n",
"cd /home/ec2-user/anything-llm/docker\n",
"cp .env.example .env\n",
"cd ../frontend\n",
"rm -rf .env.production\n",
"cat >> .env.production << \"END\"\n",
"GENERATE_SOURCEMAP=true\n",
"VITE_API_BASE=\"/api\"\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",
"mkdir -p /home/ec2-user/anythingllm\n",
"touch /home/ec2-user/anythingllm/.env\n",
"sudo chown ec2-user:ec2-user -R /home/ec2-user/anythingllm\n",
"docker pull mintplexlabs/anythingllm:master\n",
"docker run -d -p 3001:3001 -v /home/ec2-user/anythingllm:/app/server/storage -v /home/ec2-user/anythingllm/.env:/app/server/.env -e STORAGE_DIR=\"/app/server/storage\" mintplexlabs/anythingllm:master\n",
"echo \"Container ID: $(sudo docker ps --latest --quiet)\"\n",
"export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)\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",
"echo \"Setup complete! AnythingLLM instance is now online!\"\n",
"\n",
"--//--\n"

View File

@ -19,7 +19,7 @@ resource "digitalocean_droplet" "anything_llm_instance" {
image = "ubuntu-22-10-x64"
name = "anything-llm-instance"
region = "nyc3"
size = "s-1vcpu-1gb"
size = "s-2vcpu-2gb"
user_data = templatefile("user_data.tp1", {
env_content = local.formatted_env_content

View File

@ -5,55 +5,16 @@ sudo apt-get update
sudo apt-get install -y docker.io
sudo usermod -a -G docker ubuntu
curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo systemctl enable docker
sudo systemctl start docker
sudo apt-get install -y git
mkdir -p /home/anythingllm
touch /home/anythingllm/.env
git clone https://github.com/Mintplex-Labs/anything-llm.git /home/anything-llm
cd /home/anything-llm/docker
cat >> .env << END
${env_content}
UID="1000"
GID="1000"
NO_DEBUG="true"
END
echo "Set .env file"
cd ../frontend
sudo rm -rf .env.production
sudo cat >> .env.production << END
GENERATE_SOURCEMAP=true
VITE_API_BASE="/api"
END
echo "Set .env.production file"
cd ../docker
sudo docker-compose up -d --build
sudo docker pull mintplexlabs/anythingllm:master
sudo docker run -d -p 3001:3001 -v /home/anythingllm:/app/server/storage -v /home/anythingllm/.env:/app/server/.env -e STORAGE_DIR="/app/server/storage" mintplexlabs/anythingllm:master
echo "Container ID: $(sudo docker ps --latest --quiet)"
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
echo "Placeholder folders in storage created."
sudo docker container exec -u 0 -t $(sudo docker ps --latest --quiet) touch /app/server/storage/anythingllm.db
echo "SQLite DB placeholder set."
sudo docker container exec -u 0 -t $(sudo docker ps --latest --quiet) chown -R anythingllm:anythingllm /app/collector /app/server
echo "File permissions corrected."
export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)
echo "Health check: $ONLINE"
if [ "$ONLINE" = 200 ]; then
echo "Running migrations..." && curl -Is http://localhost:3001/api/migrate | head -n 1 | cut -d$' ' -f2
fi
echo "Setup complete! AnythingLLM instance is now online!"

View File

@ -51,7 +51,7 @@ gcloud deployment-manager deployments delete anything-llm-deployment
## Please read this notice before submitting issues about your deployment
**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 anywhere from 5-10 minutes to fully boot up.
If you want to check the instances progress, navigate to [your deployed instances](https://console.cloud.google.com/compute/instances) and connect to your instance via SSH in browser.

View File

@ -27,57 +27,18 @@ resources:
sudo apt-get update
sudo apt-get install -y docker.io
sudo usermod -a -G docker ubuntu
curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo systemctl enable docker
sudo systemctl start docker
sudo apt-get install -y git
git clone https://github.com/Mintplex-Labs/anything-llm.git /home/anything-llm
cd /home/anything-llm/docker
cat >> .env << END
!SUB::USER::CONTENT!
UID="1000"
GID="1000"
NO_DEBUG="true"
END
echo "Set .env file"
cd ../frontend
sudo rm -rf .env.production
sudo cat >> .env.production << END
GENERATE_SOURCEMAP=true
VITE_API_BASE="/api"
END
echo "Set .env.production file"
cd ../docker
sudo docker-compose up -d --build
mkdir -p /home/anythingllm
touch /home/anythingllm/.env
sudo docker pull mintplexlabs/anythingllm:master
sudo docker run -d -p 3001:3001 -v /home/anythingllm:/app/server/storage -v /home/anythingllm/.env:/app/server/.env -e STORAGE_DIR="/app/server/storage" mintplexlabs/anythingllm:master
echo "Container ID: $(sudo docker ps --latest --quiet)"
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
echo "Placeholder folders in storage created."
sudo docker container exec -u 0 -t $(sudo docker ps --latest --quiet) touch /app/server/storage/anythingllm.db
echo "SQLite DB placeholder set."
sudo docker container exec -u 0 -t $(sudo docker ps --latest --quiet) chown -R anythingllm:anythingllm /app/collector /app/server
echo "File permissions corrected."
export ONLINE=$(curl -Is http://localhost:3001/api/ping | head -n 1|cut -d$' ' -f2)
echo "Health check: $ONLINE"
if [ "$ONLINE" = 200 ]; then
echo "Running migrations..." && curl -Is http://localhost:3001/api/migrate | head -n 1 | cut -d$' ' -f2
fi
echo "Setup complete! AnythingLLM instance is now online!"