Skip to content

Commit e35f036

Browse files
arthemidegireg.rousselbojeanson
authored
Update docker compose ansible (#76)
* make torch dockerfile works * simplify ansible and update docker compose to pull image from gchr * rollback to main branch * update with a playbook of debug * fix docker-compose and add Makefile for deployment * Update deployment/edge/ansible/Makefile --------- Co-authored-by: gireg.roussel <gireg.roussel@octo.com> Co-authored-by: Baptiste O'Jeanson <b.ojeanson@gmail.com>
1 parent 8259a68 commit e35f036

5 files changed

Lines changed: 79 additions & 25 deletions

File tree

deployment/edge/ansible/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ ping-inventory:
1818
deploy-vio-on-inventory:
1919
LOCAL_VIO_DIR=${LOCAL_VIO_DIR} ansible-playbook -v -i inventory.ini deploy_vio_on_edge.yml
2020

21+
.PHONY: deploy-vio-on-inventory-from-git-branch ## 🚀 Deploy VIO on the edge devices described in the inventory from a branch to debug
22+
deploy-vio-on-inventory-from-git-branch:
23+
LOCAL_VIO_DIR=${LOCAL_VIO_DIR} ansible-playbook -v -i inventory.ini deploy_vio_on_edge_from_git_branch.yml
24+
2125
.PHONY: register-inventory-on-gcp-hub ## 🚀 Register the inventory on the GCP hub
2226
register-inventory-on-gcp-hub:
2327
LOCAL_VIO_DIR=${LOCAL_VIO_DIR} ansible-playbook -v -i inventory.ini register_edge_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python

deployment/edge/ansible/deploy_vio_on_edge.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
- name: "Deploy vio on edge and launch"
22
hosts: all
33
tasks:
4-
- name: Clone vio git repo
5-
ansible.builtin.git:
6-
repo: https://github.com/octo-technology/VIO.git
7-
dest: "{{ REMOTE_VIO_DIR }}"
8-
single_branch: yes
9-
version: main
10-
force: true
11-
124
- name: Remove config folder
135
ansible.builtin.file:
146
path: "{{ REMOTE_VIO_DIR }}/edge_orchestrator/config"
@@ -29,10 +21,15 @@
2921
src: "{{ LOCAL_VIO_DIR }}/edge_model_serving/models/tflite"
3022
dest: "{{ REMOTE_VIO_DIR }}/edge_model_serving/models/"
3123

32-
- name: Template docker compose
24+
- name: Copy docker compose
3325
ansible.builtin.template:
3426
src: "{{ LOCAL_VIO_DIR }}/deployment/edge/ansible/files/docker-compose.template.yml"
3527
dest: "{{ REMOTE_VIO_DIR }}/docker-compose.yml"
28+
29+
- name: Copy Makefile
30+
ansible.builtin.template:
31+
src: "{{ LOCAL_VIO_DIR }}/deployment/edge/ansible/files/Makefile.template"
32+
dest: "{{ REMOTE_VIO_DIR }}/Makefile"
3633

3734
- name: Start all edge services on intel (model_serving, orchestrator, interface)
3835
make:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
- name: "Deploy vio on edge and launch"
2+
hosts: all
3+
tasks:
4+
- name: Clone vio git repo
5+
ansible.builtin.git:
6+
repo: https://github.com/octo-technology/VIO.git
7+
dest: "{{ REMOTE_VIO_DIR }}"
8+
single_branch: yes
9+
version: main
10+
force: true
11+
12+
- name: Remove config folder
13+
ansible.builtin.file:
14+
path: "{{ REMOTE_VIO_DIR }}/edge_orchestrator/config"
15+
state: absent
16+
17+
- name: Copy config on the remote machine
18+
ansible.builtin.copy:
19+
src: "{{ LOCAL_VIO_DIR }}/edge_orchestrator/config"
20+
dest: "{{ REMOTE_VIO_DIR }}/edge_orchestrator/"
21+
22+
- name: Remove model folder
23+
ansible.builtin.file:
24+
path: "{{ REMOTE_VIO_DIR }}/edge_model_serving/models"
25+
state: absent
26+
27+
- name: Copy model file on the remote machine
28+
ansible.builtin.copy:
29+
src: "{{ LOCAL_VIO_DIR }}/edge_model_serving/models/tflite"
30+
dest: "{{ REMOTE_VIO_DIR }}/edge_model_serving/models/"
31+
32+
- name: Set environment variables for edge-orchestrator
33+
ansible.builtin.set_fact:
34+
edge_orchestrator_env:
35+
- EDGE_NAME={{ EDGE_NAME }}
36+
- SERVING_MODEL_URL=http://edge_model_serving:8501
37+
- GOOGLE_APPLICATION_CREDENTIALS=/edge_orchestrator/config/secrets/credentials.json
38+
- BUCKET_NAME=tf-vio-bucket
39+
- ACTIVE_CONFIG_NAME=marker_classification_with_1_fake_camera
40+
41+
- name: Start all edge services on intel (model_serving, orchestrator, interface)
42+
make:
43+
chdir: "{{ REMOTE_VIO_DIR }}"
44+
target: vio-edge-up
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SHELL := /bin/bash
2+
.SHELLFLAGS = -ec
3+
.ONESHELL:
4+
.SILENT:
5+
BUILDOS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
6+
7+
8+
.PHONY: help
9+
help:
10+
echo "❓ Use \`make <target>'"
11+
grep -E '^\.PHONY: [a-zA-Z0-9_-]+ .*?## .*$$' $(MAKEFILE_LIST) | \
12+
awk 'BEGIN {FS = "(: |##)"}; {printf "\033[36m%-30s\033[0m %s\n", $$2, $$3}'
13+
14+
.PHONY: vio-edge-up ## 🐳 Start all edge services (db, model_serving, orchestrator, interface)
15+
vio-edge-up:
16+
BUILDOS=${BUILDOS} docker compose --profile edge up -d
17+
18+
.PHONY: vio-down ## ❌ Stop all services (model_serving, edge_orchestrator, ui)
19+
vio-down:
20+
docker compose --profile hub --profile edge down
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
services:
22
edge_model_serving:
33
container_name: edge_model_serving
4-
build:
5-
context: edge_model_serving
6-
dockerfile: tflite_serving/Dockerfile
7-
args:
8-
BUILDOS: ${BUILDOS:-linux}
4+
image: ghcr.io/octo-technology/vio/edge_tflite_serving:latest
95
environment:
106
TF_CPP_MIN_VLOG_LEVEL: 0 # TensorFlow logging level
117
ports:
@@ -15,11 +11,7 @@ services:
1511

1612
edge_orchestrator:
1713
container_name: edge_orchestrator
18-
build:
19-
context: edge_orchestrator
20-
dockerfile: Dockerfile
21-
args:
22-
BUILDOS: ${BUILDOS:-linux}
14+
image: ghcr.io/octo-technology/vio/edge_orchestrator:latest
2315
volumes:
2416
- ./config:/edge_orchestrator/config
2517
- ./data_storage:/edge_orchestrator/data_storage
@@ -32,19 +24,16 @@ services:
3224
GOOGLE_APPLICATION_CREDENTIALS: /edge_orchestrator/config/secrets/credentials.json
3325
BUCKET_NAME: tf-vio-bucket
3426
ACTIVE_CONFIG_NAME: marker_classification_with_1_fake_camera
27+
privileged: true
3528

3629
edge_interface:
3730
container_name: edge_interface
38-
build:
39-
context: edge_interface
40-
dockerfile: Dockerfile
31+
image: ghcr.io/octo-technology/vio/edge_interface:latest
4132
ports:
4233
- 8080:80
4334

4435
edge_streamlit:
4536
container_name: edge_streamlit
46-
build:
47-
context: edge_streamlit
48-
dockerfile: Dockerfile
37+
image: ghcr.io/octo-technology/vio/edge_streamlit:latest
4938
ports:
5039
- 8502:8502

0 commit comments

Comments
 (0)