diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..25b94cf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.dockerignore +.gitignore +Dockerfile +*.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fa57cb8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM balenalib/raspberrypi400-64-debian + +WORKDIR /PCA9685 + +COPY . . + +RUN apt update +RUN apt install cmake build-essential + +RUN mkdir build + +WORKDIR /PCA9685/build + +RUN cmake .. + +RUN make + +RUN make install + +# ola deps +RUN apt install ola libola-dev + +# audio deps +# RUN apt install libasound2 libasound2-dev libfftw3-3 libfftw3-dev + +# demo deps +# RUN apt install libncurses5-dev + +RUN make examples + +CMD ["sleep", "7200"] \ No newline at end of file diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index dff8b76..79cee5b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,9 +1,10 @@ project(examples) # build the examples add_subdirectory(olaclient) -add_subdirectory(PCA9685demo) -add_subdirectory(quickstart) -add_subdirectory(audio) +#add_subdirectory(PCA9685demo) +#add_subdirectory(quickstart) +#add_subdirectory(audio) add_custom_target(examples) -add_dependencies(examples olaclient PCA9685demo quickstart audio) +add_dependencies(examples olaclient) +# PCA9685demo quickstart audio) diff --git a/examples/olaclient/CMakeLists.txt b/examples/olaclient/CMakeLists.txt index 45a0e2f..3e43559 100644 --- a/examples/olaclient/CMakeLists.txt +++ b/examples/olaclient/CMakeLists.txt @@ -8,6 +8,10 @@ target_link_libraries(olaclient PCA9685) target_link_libraries(olaclient ola) target_link_libraries(olaclient olacommon) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +target_link_libraries(olaclient Threads::Threads) + install(TARGETS olaclient DESTINATION bin) install(FILES olaclient.service DESTINATION /etc/systemd/system) diff --git a/svc.yml b/svc.yml new file mode 100644 index 0000000..a293035 --- /dev/null +++ b/svc.yml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: my-service +spec: + selector: + app: pca9685 + type: NodePort + ports: + - + port: 9090 + nodePort: 30000 + name: my-port-9090 + + - + port: 7890 + nodePort: 30001 + name: my-port-9010 + + \ No newline at end of file diff --git a/system-dependency-note/MicroOs.md b/system-dependency-note/MicroOs.md new file mode 100644 index 0000000..998066e --- /dev/null +++ b/system-dependency-note/MicroOs.md @@ -0,0 +1,8 @@ +# Some changes are needed to the system + +i2c-dev must be loaded on boot + + + echo "i2c-dev" > /etc/modules-load.d/i2c-dev.conf + echo "i2c-bcm2708" > /etc/modules-load.d/i2c-bcm2708.conf + diff --git a/test-deploy.yml b/test-deploy.yml new file mode 100644 index 0000000..1daa9c9 --- /dev/null +++ b/test-deploy.yml @@ -0,0 +1,44 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pca9685 + labels: + app: pca9685 +spec: + replicas: 1 + selector: + matchLabels: + app: pca9685 + template: + metadata: + labels: + app: pca9685 + spec: + nodeName: tanis02 + containers: + - name: pca9685 + resources: + limits: + memory: "512Mi" + cpu: "400m" + image: nargetdev/pca9685:v0.0.0 + securityContext: + privileged: true + imagePullPolicy: Always + command: + - "/PCA9685/build/examples/olaclient/olaclient" + - name: ola + image: nargetdev/ola:v0.1.2 + imagePullPolicy: Always + securityContext: + privileged: true + resources: + limits: + memory: "512Mi" + cpu: 400m + # ports: + # - containerPort: 9090 + # - containerPort: 9010 + # - containerPort: 7890 + # - containerPort: 6454 + # - containerPort: 5568