mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-09 16:30:10 +01:00
84 lines
3.2 KiB
YAML
84 lines
3.2 KiB
YAML
resources:
|
|
- name: anything-llm-instance
|
|
type: compute.v1.instance
|
|
properties:
|
|
zone: us-central1-a
|
|
machineType: zones/us-central1-a/machineTypes/n1-standard-1
|
|
disks:
|
|
- deviceName: boot
|
|
type: PERSISTENT
|
|
boot: true
|
|
autoDelete: true
|
|
initializeParams:
|
|
sourceImage: projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts
|
|
diskSizeGb: 10
|
|
networkInterfaces:
|
|
- network: global/networks/default
|
|
accessConfigs:
|
|
- name: External NAT
|
|
type: ONE_TO_ONE_NAT
|
|
metadata:
|
|
items:
|
|
- key: startup-script
|
|
value: |
|
|
#!/bin/bash
|
|
# check output of userdata script with sudo tail -f /var/log/cloud-init-output.log
|
|
|
|
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
|
|
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!"
|
|
|