-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
220 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: rpi | ||
|
||
on: | ||
push: | ||
tags: | ||
- v*.** | ||
|
||
jobs: | ||
image-creation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
mkdir -p exporter-stage/00-install-packages && | ||
{ | ||
cat > exporter-stage/prerun.sh <<-EOF | ||
#!/bin/bash -e | ||
if [ ! -d "${ROOTFS_DIR}" ]; then | ||
copy_previous | ||
fi | ||
EOF | ||
} && | ||
chmod +x exporter-stage/prerun.sh && | ||
{ | ||
cat > exporter-stage/00-install-packages/00-packages <<-PCK | ||
apt-utils | ||
curl | ||
apt-transport-https | ||
ca-certificates | ||
gnupg | ||
PCK | ||
} && | ||
{ | ||
cat > exporter-stage/00-install-packages/01-run.sh <<-RUN | ||
#!/bin/bash -e | ||
on_chroot << EOF | ||
curl -fsSL https://get.docker.com -o get-docker.sh | ||
sh ./get-docker.sh | ||
systemctl enable docker | ||
curl https://raw.githubusercontent.com/pstrobl96/prusa_exporter/main/docs/examples/config/grafana_cloud/prusa.yml -o /boot/firmware/prusa.yml | ||
curl https://raw.githubusercontent.com/pstrobl96/prusa_exporter/main/docs/examples/config/grafana_cloud/agent.yaml -o /boot/firmware/agent.yaml | ||
rm -rf /opt/prusa_exporter | ||
mkdir /opt/prusa_exporter | ||
curl https://raw.githubusercontent.com/pstrobl96/prusa_exporter/main/docker-compose.rpi-cloud.yaml -o /opt/prusa_exporter/docker-compose.yaml | ||
curl https://raw.githubusercontent.com/pstrobl96/prusa_exporter/main/docs/services/prusa-exporter-docker.service -o /etc/systemd/system/prusa-exporter.service | ||
systemctl enable prusa-exporter | ||
EOF | ||
RUN | ||
} && chmod +x exporter-stage/00-install-packages/01-run.sh | ||
- uses: usimd/pi-gen-action@v1 | ||
id: build | ||
with: | ||
hostname: prusa_pi | ||
compression-level: 9 | ||
compression: xz | ||
image-name: prusa_exporter-image | ||
stage-list: stage0 stage1 stage2 ./exporter-stage | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: pi-gen-image | ||
path: ${{ steps.build.outputs.image-path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: "3" | ||
|
||
networks: | ||
prusa: | ||
|
||
services: | ||
exporter: | ||
image: pubeldev/prusa_exporter:latest | ||
container_name: exporter | ||
restart: unless-stopped | ||
volumes: | ||
- type: bind | ||
source: /boot/firmware/prusa.yml | ||
target: /app/prusa.yml | ||
ports: | ||
- "10009:10009" | ||
networks: | ||
- prusa | ||
agent: | ||
image: grafana/agent:latest | ||
container_name: grafana_agent | ||
restart: unless-stopped | ||
volumes: | ||
- type: bind | ||
source: /boot/firmware/agent.yaml | ||
target: /etc/agent-config/agent.yaml | ||
entrypoint: | ||
- /bin/grafana-agent | ||
- -server.http.address=0.0.0.0:12345 | ||
- -config.file=/etc/agent-config/agent.yaml | ||
- -metrics.wal-directory=/tmp/agent/wal | ||
ports: | ||
- "12345:12345" | ||
networks: | ||
- prusa | ||
depends_on: | ||
- exporter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
server: | ||
log_level: info | ||
|
||
metrics: | ||
global: | ||
scrape_interval: 15s | ||
remote_write: | ||
- url: <YOUR CLOUD METRICS URL> | ||
basic_auth: | ||
username: "<YOUR CLOUD METRICS USERNAME>" | ||
password: "<YOUR CLOUD METRICS PASSWORD>" | ||
configs: | ||
- name: default | ||
scrape_configs: | ||
- job_name: "prusa" | ||
static_configs: | ||
- targets: ["exporter:10009"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Prusa Exporter service | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
Restart=always | ||
ExecStart=/usr/bin/docker compose -f /opt/prusa_exporter/docker-compose.yaml up | ||
ExecStop=/usr/bin/docker compose -f /opt/prusa_exporter/docker-compose.yaml down | ||
|
||
[Install] | ||
WantedBy=multi-user.target |