-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Liora Milbaum <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
36 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ env: | |
TF_VAR_aws_volume_size: 100 | ||
TF_VAR_aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
TF_VAR_aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
TF_VAR_provision_script: ../main/.github/scripts/provision.sh | ||
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# AWS_DEFAULT_REGION: "eu-west-2" | ||
|
@@ -41,7 +40,8 @@ jobs: | |
aws_image_type: m7g.medium | ||
aws_ami_architecture: arm64 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
path: main | ||
|
||
|
@@ -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 | ||
|
@@ -76,8 +76,21 @@ jobs: | |
run: | | ||
echo "id=$(terraform output id | xargs)" >> $GITHUB_OUTPUT | ||
echo "url=$(terraform output host | xargs)" >> $GITHUB_OUTPUT | ||
echo "pem_filename=$(terraform output pem_filename | xargs)" >> $GITHUB_OUTPUT | ||
working-directory: terraform-test-environment-module | ||
|
||
- name: Ansible Collections | ||
run: ansible-galaxy install -r ./provision/requirements.yml | ||
working-directory: ./main/recipes/natural_language_processing/chatbot | ||
|
||
- name: Provision | ||
run: | | ||
ansible-playbook ./main/recipes/natural_language_processing/chatbot/provision/playbook.yml \ | ||
-i terraform-test-environment-module/hosts.ini \ | ||
--private-key=terraform-test-environment-module/${{ steps.terraform-output.outputs.pem_filename }} | ||
env: | ||
ANSIBLE_HOST_KEY_CHECKING: false | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -87,9 +100,6 @@ jobs: | |
working-directory: ./main/recipes/natural_language_processing/chatbot | ||
run: make install | ||
|
||
- name: Wait for the user data script to finish | ||
run: sleep 240 | ||
|
||
- name: Run Integration Tests | ||
working-directory: ./main/recipes/natural_language_processing/chatbot | ||
run: make integration-tests | ||
|
60 changes: 60 additions & 0 deletions
60
recipes/natural_language_processing/chatbot/provision/playbook.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
- name: Test Environment Provisioning | ||
hosts: test_environments | ||
remote_user: fedora | ||
become: true | ||
gather_facts: false | ||
|
||
tasks: | ||
|
||
- name: Wait until the instance is ready | ||
ansible.builtin.wait_for_connection: | ||
delay: 10 | ||
timeout: 60 | ||
|
||
- name: Gather facts for first time | ||
ansible.builtin.setup: | ||
|
||
- name: Required Packages | ||
ansible.builtin.package: | ||
name: podman | ||
state: present | ||
|
||
- name: Models host directory | ||
ansible.builtin.file: | ||
path: locallm/models | ||
state: directory | ||
|
||
- name: Download Model | ||
ansible.builtin.get_url: | ||
url: https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q5_K_S.gguf | ||
dest: locallm/models | ||
|
||
- name: Run Model | ||
containers.podman.podman_container: | ||
name: llamacpp_python | ||
image: ghcr.io/containers/llamacpp_python:latest | ||
state: started | ||
interactive: true | ||
tty: true | ||
detach: true | ||
ports: | ||
- 8001:8001 | ||
volume: | ||
- ./locallm/models:/locallm/models:ro,Z | ||
env: | ||
MODEL_PATH: models/llama-2-7b-chat.Q5_K_S.gguf | ||
HOST: 0.0.0.0 | ||
PORT: 8001 | ||
|
||
- name: Run Application | ||
containers.podman.podman_container: | ||
name: chatbot | ||
image: ghcr.io/containers/chatbot:latest | ||
state: started | ||
interactive: true | ||
tty: true | ||
ports: | ||
- 8501:8501 | ||
env: | ||
MODEL_SERVICE_ENDPOINT: http://10.88.0.1:8001/v1 |
4 changes: 4 additions & 0 deletions
4
recipes/natural_language_processing/chatbot/provision/requirements.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
collections: | ||
- name: containers.podman | ||
version: 1.12.0 |