Contents: 1, 2, 3, (4)
In this series of articles, I will explain how I built my own home development environment using a couple of Raspberry Pis and a lot of software. The code referenced in these articles can be found here. In this article I will cover the monitoring of my pipeline, as well as discuss a few gotchas.
My initial thought for monitoring uptime of my development pipeline was UpTimeRobot, a free service which pings periodically and if failures alerts via email.
Example email*
However, being able to monitor and repair your development pipeline in a web app is just great and portainer have really aced this one.
This application is great and many more features than I want to explain. But it allows for inspection of container logs, ssh into containers, and even deployment of new images — controlling and monitoring multiple hosts.
Portainer running*
To get portainer running I added this to my code docker-compose template:
portainer:
image: portainer/portainer
command: -H unix:///var/run/docker.sock
restart: always
networks:
- homereponet
ports:
- 9000:9000
- 8000:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /mnt/hdd/portainer:/data
labels:
- "traefik.enable=true"
- traefik.backend=portainer
- traefik.portainer.frontend.rule=Host:portainer.<domain>
- traefik.docker.network=homereponet
- traefik.portainer.port=9000
This is where this story ends for now. I think that this is a great starter set up for anyone looking to have a industry style development pipeline. As a recap this final setup is:
Gitea Repository for storing code, using git LFS for large media files. Drone CI to build containers, store them in Docker Registry, and deploy using an Ansible plugin to a local set of machines as well as cloudformation plugin for AWS deployment. Portainer for monitoring and control over containers in a UI. Traefik for a reverse proxy with let’s encrypt free https certificate on a free duckdns domain. All storage is done on a hard drive and there are periodic backups to AWS s3.
I hope you have enjoyed this series of articles. I also make many more projects including other hardware, 3D printing, smart-home applications, and machine learning in video form over at T3chFlicks — check us out.
Code: https://github.com/sk-t3ch/home-repo
Random Things I learned along the way:
-
Docker-compose has to be controlled inside the same directory as it was started
-
policy creation for aws s3 is needed because you only want the pi and the root aws user to be able to access the bucket also add encryption
-
need to look more into backup techniques
-
s3 backups to glacier after 10 days meaning storage cost stays low
-
Raspberry Pi 4 has two usb 3.0 ports and two 2.0 ones.
-
Using an EXFAT drive instead of HFS+ resulted in failures for the Postgres container
-
ssh on Gitea cannot use port 22 due to permissions problem that i am yet to solve. to work around this i changed the router forward port to allow for an ssh port in the accepted range (1065+)
I hope you have enjoyed this article. If you like the style, check out T3chFlicks.org for more tech-focused educational content (YouTube, Instagram, Facebook, Twitter).