Skip to content

Deployment for controlling my iot raspberry 4 with AWS CodePipeline and Docker Compose

License

Notifications You must be signed in to change notification settings

mmuller88/rasp4

Repository files navigation

rasp4

That is a git repo for remote control my Raspberry 4 via AWS CodeDeploy & AWS CDK. Basically I only will need to push stuff here and that get installed and executed on my Raspberry 4. Very cool or? Write me for any questions/ideas.

AWS CDK & Deploy specifics

I use AWS CDK for the deployment. AWS CDK is an abstraction on top of AWS Cloudformation which uses a higher abstraction language like TypeScript. Under the hood AWS CDK produces Cloudformation templates and applies them. Find out more about AWS CDK on my blog post side https://martinmueller.dev/tags/cdk

cdk bootstrap aws://981237193288/eu-central-1

Deploy

yarn build
yarn deploy [--profile X]

InfluxDB Backup

For the backup you need to put your in ./../.secrets

AWS_ACCESS_KEY_ID=AKIA6I5SLLxx
AWS_SECRET_ACCESS_KEY=7PBRSlGhZoovOxx

Tosmato Specifics

MQTT

If you want to send MQTT commands to your Tosmator devices install:

sudo apt-get install mosquitto-clients
mosquitto_sub -t "test"

additional

Reduce Power usage time from 5m to 10s mosquitto_pub -h rasp4.alfpro.net -t "cmnd/tasmota/TelePeriod" -m 10

3 Raspberry 4 Specifics

...

Preparation

Install the supported Ubuntu Image https://ubuntu.com/download/raspberry-pi on your Raspberry 4. For me this image worked ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz

Install a lot stuff more on it like git, docker, docker-compose, aws cli and so on. Use the script for those:

./misc/init.sh

SSH Key

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-20-04

Troubleshooting

CodeDeploy Agent

/var/log/aws/codedeploy-agent/codedeploy-agent.log

Docker
  • Kill docker with:
ps -A | grep docker
kill -9 1321
sudo systemctl enable docker
sudo systemctl start docker
  • Uninstall docker:
sudo apt-get purge docker-ce
dpkg -l | grep -i docker
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce

sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
Files

Sometimes the AWS CodeDeploy Agent can't delete the existing files and folders than use :

sudo rm -rf .gitignore .eslintrc.json .github .mergify.yml .npmignore .projen .projenrc.js .secret.example .versionrc.json .vscode cdk.json secret.env.example
sudo rm -rf LICENSE README.md appspec.yml docker-compose.yml misc package.json preact-netlify scripts services src test tsconfig.jest.json tsconfig.json version.json yarn.lock

Thanks To

About

Deployment for controlling my iot raspberry 4 with AWS CodePipeline and Docker Compose

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published