Skip to content

Commit

Permalink
Provision with Ansible
Browse files Browse the repository at this point in the history
Signed-off-by: Liora Milbaum <[email protected]>
  • Loading branch information
lmilbaum committed Apr 10, 2024
1 parent dd4cf14 commit 2452e41
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
13 changes: 2 additions & 11 deletions .github/scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

set -x

if [[ "$(uname -m)" == "aarch64" ]]; then
arch="arm64"
else
arch="amd64"
fi

dnf install -y podman wget \
https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/latest/linux_${arch}/amazon-ssm-agent.rpm
dnf install -y podman wget
dnf clean all

wget -P locallm/models https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q5_K_S.gguf
Expand All @@ -24,6 +17,4 @@ podman run -it \
-p 8501:8501 \
-e MODEL_SERVICE_ENDPOINT=http://10.88.0.1:8001/v1 \
ghcr.io/containers/chatbot:latest

# this file is sampled when the terraform apply is running
touch /tmp/user_data_completed
ß
17 changes: 10 additions & 7 deletions .github/workflows/testing-framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:

workflow_dispatch:

# pull_request: ## temporary for debugging development purposes
# branches:
# - main
pull_request: ## temporary for debugging development purposes
branches:
- main

env:
TF_VAR_aws_region: "eu-west-2"
Expand Down Expand Up @@ -59,11 +59,11 @@ jobs:
terraform_version: "1.7.5"
terraform_wrapper: false

- name: Init Terraform
- name: Init
run: terraform init
working-directory: terraform-test-environment-module

- name: Spin Test Environment
- name: Bootstrap
id: up
run: terraform apply -auto-approve -lock=false
working-directory: terraform-test-environment-module
Expand All @@ -75,9 +75,12 @@ jobs:
id: terraform-output
run: |
echo "id=$(terraform output id | xargs)" >> $GITHUB_OUTPUT
echo "url=$(terraform output host | xargs)" >> $GITHUB_OUTPUT
echo "instance_name=$(terraform output host | xargs)" >> $GITHUB_OUTPUT
working-directory: terraform-test-environment-module

- name: Provision
run: ansible-playbook ./main/recipes/natural_language_processing/chatbot/provision/playbook.yml -i terraform-test-environment-module/hosts.init

- name: Set up Python
uses: actions/[email protected]
with:
Expand All @@ -94,7 +97,7 @@ jobs:
working-directory: ./main/recipes/natural_language_processing/chatbot
run: make integration-tests
env:
URL: ${{ steps.terraform-output.outputs.url }}
URL: ${{ steps.terraform-output.outputs.instance_name }}

- name: Destroy Test Environment
id: down
Expand Down
18 changes: 18 additions & 0 deletions recipes/natural_language_processing/chatbot/provision/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Test Environment Provisioning
hosts: test_environments
gather_facts: true
vars:
arch: "amd64"

tasks:

- name: Set variable arch
set_fact:
arch: "arm64"
when: ansible_architecture == "aarch64"

- name: Required packages
ansible.builtin.package:
name: "https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/latest/linux_{{ arch }}/amazon-ssm-agent.rpm"
state: present

0 comments on commit 2452e41

Please sign in to comment.