From b2632018f1f4d088c523b997c447617a9953f37d Mon Sep 17 00:00:00 2001 From: Lubos Zima Date: Sun, 31 Mar 2024 14:29:39 +0700 Subject: [PATCH] feat: wip --- scripts/restart-webui.sh | 5 +++++ scripts/ssh.sh | 8 +------- scripts/upload-rag-docs.sh | 2 +- terragrunt/ai/server/cloud_init.yaml.tftpl | 7 ++++--- terragrunt/ai/server/terragrunt.hcl | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) create mode 100755 scripts/restart-webui.sh diff --git a/scripts/restart-webui.sh b/scripts/restart-webui.sh new file mode 100755 index 0000000..735e54f --- /dev/null +++ b/scripts/restart-webui.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +MY_IP=$(terragrunt output --terragrunt-working-dir ./terragrunt/ai/server ipv4 | xargs) +ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null "devops@$MY_IP" docker restart webui 2>/dev/null +echo "restarted webui on $MY_IP" diff --git a/scripts/ssh.sh b/scripts/ssh.sh index b0ea85d..b6e232a 100755 --- a/scripts/ssh.sh +++ b/scripts/ssh.sh @@ -2,10 +2,4 @@ MY_IP=$(terragrunt output --terragrunt-working-dir ./terragrunt/ai/server ipv4 | xargs) ssh-keygen -R "$MY_IP" -ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "devops@$MY_IP" - - -# cycle through a list of items -echo "llama2-uncensored, llama2:13b" | sed 's/,/\n/g' | xargs -I {} echo "{}" | while read -r item; do - echo "item: $item" -done +ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null "devops@$MY_IP" 2>/dev/null diff --git a/scripts/upload-rag-docs.sh b/scripts/upload-rag-docs.sh index 20a48a1..60ce6f9 100755 --- a/scripts/upload-rag-docs.sh +++ b/scripts/upload-rag-docs.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash MY_IP=$(terragrunt output --terragrunt-working-dir ./terragrunt/ai/server ipv4 | xargs) - scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -r ./RAG-docs devops@$MY_IP:/home/devops/data/docs + scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o GlobalKnownHostsFile=/dev/null -r ./RAG-docs devops@$MY_IP:/home/devops/data/docs 2>/dev/null diff --git a/terragrunt/ai/server/cloud_init.yaml.tftpl b/terragrunt/ai/server/cloud_init.yaml.tftpl index 825c3f4..0c85d2e 100644 --- a/terragrunt/ai/server/cloud_init.yaml.tftpl +++ b/terragrunt/ai/server/cloud_init.yaml.tftpl @@ -132,7 +132,7 @@ write_files: expose: - 11434 volumes: - - ollama_vol:/root/.ollama + - /home/${user_name}/data/ollama:/root/.ollama networks: - ollama_net restart: always @@ -147,8 +147,8 @@ write_files: environment: - OLLAMA_BASE_URL=http://ollama:11434 - ENABLE_SIGNUP=true - volumes: - ollama_vol: + volumes: + - /home/${user_name}/data/docs:/data/docs networks: ollama_net: @@ -160,6 +160,7 @@ write_files: # - ollama pull llama2-uncensored runcmd: - mkdir -p /home/${user_name}/data/docs + - mkdir -p /home/${user_name}/data/ollama - chown ${user_name}:${user_name} -R /home/${user_name} # Change default ssh port, disable root login and allow new user login diff --git a/terragrunt/ai/server/terragrunt.hcl b/terragrunt/ai/server/terragrunt.hcl index e66962c..91cea94 100644 --- a/terragrunt/ai/server/terragrunt.hcl +++ b/terragrunt/ai/server/terragrunt.hcl @@ -75,6 +75,6 @@ generate "cloud_init" { user_name = "devops" init_ssh_public_key = local.env["secrets"]["pub_ssh_key"] timezone = local.region["timezone"] - ai_models = local.env["ai"]["models"] + ai_models = local.env["ai"]["models"] }) }