Skip to content

padabap/pi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi

This repository contains documentation and setup for my Raspberry Pi.

Prerequisites

Instructions below assume a headless setup.

  • You have a Raspberry Pi, power supply/cable, and SD card.
  • You have a separate computer for writing to the SD card and SSH-ing to the Pi.

Initial Setup

  1. Plug the SD card into a computer, install Raspberry Pi Lite on it via the Raspberry Pi Imager. Be sure to configure your hostname, SSH, and wifi settings prior to installation.
  2. Put the SD card into the Pi and plug it in.
  3. On another computer, ping <hostname>.local to find the IP address.
  4. ssh <username>@<ip_address> or ssh <username>@<hostname>.local
  5. Enter password set in the imager settings .

Now you should be connected to the Pi 😁

Apps and packages

Update packages

sudo apt update
sudo apt upgrade -y

Install useful packages

sudo apt install \
  vim \
  git

Swtich to zsh shell and use oh my zsh

Install zsh

sudo apt install zsh

Set it as your default shell

chsh -s /bin/zsh

Install oh my zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Install the plugins zsh-autosuggestions and zsh-syntax-highlighting. Add git and history to the plugins list in ~/.zshrc.

Docker

Docker is a software platform for building applications based on containers. It is used to run all the applications on my Pi.

Install Docker and set your user permissions. You will be logged out and need to re-login.

curl -sSL https://get.docker.com | sh
sudo usermod -aG docker $USER
logout

After re-logging in, enable the Docker system service. This ensures Docker automatically starts whenever you reboot your system and will also start containers configured with a restart-policy of always or unless-stopped.

sudo systemctl enable docker

Portainer

Portainer is a lightweight management UI which allows you to easily manage your different Docker environments. Pull the Portainer image and run it.

docker pull portainer/portainer-ce:latest
docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

Access the Portainer UI via http://<ip_address>:9000.

Homebridge

Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API.

Update the HOMEBRIDGE_CONFIG_UI_PORT env var in the homebridge/docker-compose.yml to the desired port. Then start up homebridge:

cd ~/pi/homebridge && docker compose up -d

Access the homebridge UI via http://<ip_address>:<port_number>. The default port number is 8581.

Pi-hole

Pi-hole is a DNS sinkhole the blocks network-level advertisements and Internet trackers.

Update the ports and password as desired in pihole/docker-compose.yml. Then start up pi-hole:

cd ~/pi/pihole && docker compose up -d

Access the pi-hole UI at http://<ip_address>/admin/index.php.

Prometheus & Grafana

Prometheus + Node Exporter is a data store for hardware and kernal metrics. With Grafana as a data visualizer, you can get a nice dashboard of your system metrics.

Update the username and password environment variables in prometheus-grafana/docker-compose.yml as desired:

  • GF_SECURITY_ADMIN_USER
  • GF_SECURITY_ADMIN_PASSWORD

Start everything up:

cd ~/pi/prometheus-grafana && docker compose up -d

Verify all 3 services are running, it may take a few minutes to load:

  • See metrics via Node Exporter at http://<ip_address>:9100/metrics
  • Prometheus should now be running at http://<ip_address>:9090
  • Grafana should now be running at http://<ip_address>:3000

You can create a dashboard on the Grafana webpage once all 3 services are running. Log in via the username/password set in the docker-compose fil (default username = "admin", password = "grafana"). Then create a new dashboard - Node Exporter Full is the template I use. Import the dashboard template via its ID and select your Prometheus datasource to visualize your metrics.

About

This repository contains documentation and setup for my Raspberry Pi.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors