Skip to content

Commit

Permalink
update ansible deployment (#70)
Browse files Browse the repository at this point in the history
Co-authored-by: gireg.roussel <gireg.roussel@octo.com>
  • Loading branch information
Arthemide and gireg.roussel authored Feb 13, 2025
1 parent e104195 commit 4645873
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 23 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/publication_vio_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@ jobs:
- dockerfile: ./edge_interface/Dockerfile
image: ghcr.io/${{ github.repository }}/edge_interface
context: ./edge_interface
- dockerfile: ./edge_streamlit/Dockerfile
image: ghcr.io/${{ github.repository }}/edge_streamlit
context: ./edge_streamlit
- dockerfile: ./edge_orchestrator/Dockerfile
image: ghcr.io/${{ github.repository }}/edge_orchestrator
context: ./edge_orchestrator
- dockerfile: ./edge_model_serving/tf_serving/Dockerfile
image: ghcr.io/${{ github.repository }}/edge_model_serving
image: ghcr.io/${{ github.repository }}/edge_tf_serving
context: ./edge_model_serving
- dockerfile: ./edge_model_serving/tflite_serving/Dockerfile
image: ghcr.io/${{ github.repository }}/edge_tflite_serving
context: ./edge_model_serving
- dockerfile: ./edge_model_serving/torch_serving/Dockerfile
image: ghcr.io/${{ github.repository }}/edge_torch_serving
context: ./edge_model_serving
uses: ./.github/workflows/template_build_and_push_docker_images.yml
with:
context: ${{ matrix.context }}
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ edge_interface:
edge_db:
docker-compose up -d --build edge_db

.PHONY: hub_monitoring ## ⚙️ Start hub_monitoring inside a docker container
.PHONY: hub_streamlit ## 🚀 Start hub_streamlit inside a docker container
hub_streamlit:
docker-compose up -d --build hub_streamlit

.PHONY: hub_monitoring ## 🚀 Start hub_monitoring inside a docker container
hub_monitoring:
docker-compose up -d --build hub_monitoring

.PHONY: hub_labelizer ## ⚙️ Start hub_labelizer inside a docker container
.PHONY: hub_labelizer ## 🚀 Start hub_labelizer inside a docker container
hub_labelizer:
docker-compose up -d --build hub_labelizer

.PHONY: hub_monitoring_db ## ⚙️ Start hub_monitoring database inside a docker container
.PHONY: hub_monitoring_db ## 🚀 Start hub_monitoring database inside a docker container
hub_monitoring_db:
docker-compose up -d --build hub_monitoring_db

Expand Down
10 changes: 5 additions & 5 deletions deployment/edge/ansible/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ ping-inventory:
deploy-vio-on-inventory:
ansible-playbook -v -i inventory.ini deploy_vio_on_edge.yml

.PHONY: register-inventory-on-gcp-hub ## 🚀 Register the edge devices on the GCP hub
.PHONY: register-inventory-on-gcp-hub ## 🚀 Register the inventory on the GCP hub
register-inventory-on-gcp-hub:
ansible-playbook -v -i inventory.ini register_edge_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python
ansible-playbook -v -i inventory.ini register_inventory_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python

.PHONY: test-registering-localhost-on-gcp-hub ## 🚀 Test registering localhost on the GCP hub
test-registering-localhost-on-gcp-hub:
ansible-playbook -v -c local -l localhost -i inventory.ini register_edge_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python
.PHONY: test-register-localhost-on-gcp-hub ## 🚀 Test register localhost on the GCP hub
test-register-localhost-on-gcp-hub:
ansible-playbook -v -c local -l localhost -i inventory.ini register_inventory_on_gcp_hub.yml -e ansible_python_interpreter=.venv/bin/python
33 changes: 31 additions & 2 deletions deployment/edge/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,47 @@ Before launching ansible export a env to specify your local vio directory
```
export LOCAL_VIO_DIR=
```
### Setup the edge

Install openssh-server on the edge:
```bash
sudo apt-get install openssh-server
```
Add public ssh key on the .ssh folder of the edge:
```bash
ssh-copy-id -i ~/.ssh/id_rsa.pub user@edge_ip
```

Then, try to connect through:
```bash
ssh user@edge_ip
```

Do not forget to install the google-cloud-storage package:
```bash
pip install google-cloud-storage==3.0.0
```


Install Docker on the edge help you with [this link](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
Don't forget [post-installation](https://docs.docker.com/engine/install/linux-postinstall/) steps to run docker as a non-root user.

Install *make* on the edge:
```bash
sudo apt-get install build-essential
```


### Install sshpass and the requirements

On MacOS, you can install sshpass using brew:
```bash
brew install sshpass
brew install sshpass
```

Then install requirements:
```bash
pip install -r requirements.txt
pip install -r requirements.txt
```

### Find the IP of the edge
Expand Down
12 changes: 0 additions & 12 deletions deployment/edge/ansible/files/docker-compose.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,10 @@ services:
GCP_BUCKET_NAME: tf-vio-bucket
ACTIVE_CONFIG_NAME: marker_classification_with_1_fake_camera

edge_interface:
container_name: edge_interface
build:
context: edge_interface
dockerfile: Dockerfile
ports:
- 8080:80

edge_streamlit:
container_name: edge_streamlit
build:
context: edge_streamlit
dockerfile: Dockerfile
# devices:
# - /dev/video0:/dev/video0
# - /dev/video2:/dev/video2
ports:
- 8502:8501
profiles: [edge]
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
content: "{{ IP_ADDRESS }}"
dest: "{{ REMOTE_VIO_DIR }}/edge_orchestrator/config/edge_ip.txt"

- name: Install pip through apt
ansible.builtin.apt:
name: python3-pip

- name: Install google-cloud-storage
ansible.builtin.pip:
name: google-cloud-storage
version: 3.0.0

- name: Upload edge_ip file on GCP
google.cloud.gcp_storage_object:
action: upload
Expand Down

0 comments on commit 4645873

Please sign in to comment.