[microservices] Deploy docker-compose files

This commit is contained in:
Cyrille Nofficial 2020-02-08 12:17:47 +01:00
parent f552ec5209
commit cd6e57bf7d
5 changed files with 232 additions and 8 deletions

View File

@ -1,8 +1,2 @@
$ANSIBLE_VAULT;1.1;AES256
62663835343566613663623336313161646363633064623663303132373038633038356138636139
6636616636653236633030383635373037373630653664350a353134356661613137336633336630
66393130656530333335616465346437363835313036653166326635333234356438633733313738
3536633935663730360a656133663436376239646631346466393037613432343339373836373263
30333861653837643663333234366561313062326437326366633733626230396634663738633034
32666533666234663639383733393466636164393531663534343963663863343237303931666466
333639333234373231613130346562326665
rabbitmq_user: satanas
rabbitmq_password: satanas

View File

@ -0,0 +1,196 @@
version: '3.7'
services:
camera:
image: cyrilix/robocar-camera
command:
- "-mqtt-pub-frequency=20"
- "-video-device=0"
- "-video-width=160"
- "-video-height=128"
devices:
- "/dev/video0:/dev/video0:rw"
user: "1234:44" # Set 44/video group to access to video device
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-camera
MQTT_TOPIC: "${MQTT_TOPIC_CAMERA}"
MQTT_QOS: "0"
TZ: "Europe/Paris"
arduino:
image: cyrilix/robocar-arduino
command:
- "-device=/dev/ttyAMA1"
- "-baud=115200"
- "-mqtt-retain=false"
- "-debug=false"
devices:
- "/dev/ttyAMA1:/dev/ttyAMA1:rw"
user: "1234:20" # Set 20/dialout group to access to serial device
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-arduino
MQTT_TOPIC_THROTTLE: "${{ MQTT_TOPIC_RC_THROTTLE }}"
MQTT_TOPIC_STEERING: "${{ MQTT_TOPIC_RC_STEERING }}"
MQTT_TOPIC_DRIVE_MODE: "${{ MQTT_TOPIC_RC_DRIVE_MODE }}"
MQTT_TOPIC_SWITCH_RECORD: "${{ MQTT_TOPIC_RC_SWITCH_RECORD }}"
MQTT_QOS: "0"
TZ: "Europe/Paris"
led:
image: cyrilix/robocar-led
command:
- "-mqtt-retain=false"
devices:
- "/dev/gpiomem:/dev/gpiomem:rw"
user: "1234:997" # Set 997/gpio group to access to serial device
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-led
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
MQTT_TOPIC_RECORD: "${MQTT_TOPIC_RC_SWITCH_RECORD}"
MQTT_QOS: "0"
TZ: "Europe/Paris"
pca9685:
image: cyrilix/robocar-pca9685
command:
- "-mqtt-retain=false"
- "-throttle-channel=1"
- "-steering-channel=0"
- "-throttle-zero-pwm=378"
- "-throttle-min-pwm=250"
- "-throttle-max-pwm=500"
- "-steering-left-pwm=490"
- "-steering-right-pwm=265"
- "-update-pwm-frequency=10"
devices:
- "/dev/i2c-1:/dev/i2c-1:rw"
user: "1234:998" # Set 998/i2c group to access to i2c device
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-pca9685
MQTT_TOPIC_THROTTLE: "${{ MQTT_TOPIC_THROTTLE }}"
MQTT_TOPIC_STEERING: "${{ MQTT_TOPIC_STEERING }}"
MQTT_QOS: "0"
TZ: "Europe/Paris"
tflite-steering:
image: cyrilix/robocar-tflite-steering
command: "--tf-model-path=/model/model.tflite"
user: "1234:1234"
network_mode: host
volumes:
- /home/pi/models/steering:/model
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-tflite-steering
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_TF_STEERING}"
MQTT_QOS: "0"
TZ: "Europe/Paris"
steering:
image: cyrilix/robocar-steering
command: ""
user: "1234:1234"
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-steering
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_STEERING}"
MQTT_TOPIC_TF_STEERING: "${MQTT_TOPIC_TF_STEERING}"
MQTT_TOPIC_RC_STEERING: "${MQTT_TOPIC_RC_STEERING}"
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
MQTT_QOS: "0"
TZ: "Europe/Paris"
throttle:
image: cyrilix/robocar-throttle
command:
- "-mqtt-retain=false"
user: "1234:1234"
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-throttle
MQTT_TOPIC_THROTTLE: "${MQTT_TOPIC_THROTTLE}"
MQTT_TOPIC_RC_THROTTLE: "${{ MQTT_TOPIC_RC_THROTTLE }}"
MQTT_TOPIC_DRIVE_MODE: "${MQTT_TOPIC_RC_DRIVE_MODE}"
THROTTLE_MIN: "0.3"
THROTTLE_MAX: "0.4"
MQTT_QOS: "0"
TZ: "Europe/Paris"
road:
image: cyrilix/robocar-road
command:
- "-horizon=20"
- "-mqtt-retain=false"
user: "1234:1234"
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-road
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
MQTT_TOPIC_ROAD: car/satanas/part/road
MQTT_QOS: "0"
TZ: "Europe/Paris"
# objects:
# image: cyrilix/robocar-objects-detection
# command:
# - "-mqtt-retain=false"
# - "-tf-model-path=/model/frozen_inference_graph.pb"
# - "-tf-model-config-path=/model/ssd_mobilenet_v2_coco_2018_03_29.pbtxt"
# user: "1234:1234"
# volumes:
# - /home/pi/models/objects-detection:/model
# network_mode: host
# environment:
# MQTT_BROKER: "${MQTT_BROKER}"
# MQTT_USERNAME: "${MQTT_USERNAME}"
# MQTT_PASSWORD: "${MQTT_PASSWORD}"
# MQTT_CLIENT_ID: rc-objects-detection
# MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
# MQTT_TOPIC_OBJECTS: car/satanas/part/objects
# MQTT_QOS: "0"
# TZ: "Europe/Paris"
record:
image: cyrilix/robocar-record
command:
- "-mqtt-retain=true"
user: "1234:1234"
network_mode: host
environment:
MQTT_BROKER: "${MQTT_BROKER}"
MQTT_USERNAME: "${MQTT_USERNAME}"
MQTT_PASSWORD: "${MQTT_PASSWORD}"
MQTT_CLIENT_ID: rc-record
MQTT_TOPIC_CAMERA: "${MQTT_TOPIC_CAMERA}"
MQTT_TOPIC_STEERING: "${MQTT_TOPIC_RC_STEERING}"
MQTT_TOPIC_SWITCH_RECORD: "${MQTT_TOPIC_RC_SWITCH_RECORD"
MQTT_QOS: "0"
TZ: "Europe/Paris"

View File

@ -0,0 +1,11 @@
---
- name: Copy docker-compose env file
template:
src: env
dest: /home/pi/.env
- name: Copy docker-compose file
copy:
src: docker-compose.yaml
dest: /home/pi/

View File

@ -0,0 +1,21 @@
# Broker configuration
MQTT_BROKER=tcp://localhost:1883
MQTT_USERNAME="{{ rabbitmq_user }}"
MQTT_PASSWORD="{{ rabbitmq_password }}"
# Camera
MQTT_TOPIC_CAMERA="car/satanas/part/camera"
# Radio command
MQTT_TOPIC_RC_THROTTLE: car/satanas/part/rc/throttle
MQTT_TOPIC_RC_STEERING: car/satanas/part/rc/steering
MQTT_TOPIC_RC_SWITCH_RECORD: car/satanas/part/rc/switch_record
MQTT_TOPIC_RC_DRIVE_MODE: car/satanas/part/rc/drive_mode
MQTT_TOPIC_TF_STEERING: car/satanas/part/tflite/steering
# Values to apply
MQTT_TOPIC_THROTTLE: car/satanas/part/throttle
MQTT_TOPIC_STEERING: car/satanas/part/steering

View File

@ -10,6 +10,8 @@
roles:
- { role: rabbitmq, tags: [rabbitmq] }
- { role: docker, tags: [docker] }
- { role: microservices, tags: [microservices, ms] }
- hosts: donkey
become: yes