Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more documentation on how to run a module client #192

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 105 additions & 1 deletion docs/module-client.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,107 @@
# Module client

todo: `cimonitor/module-client:latest`
In this documentation we will teach you how to run a module-client on a Raspberry Pi. Note that this is
not very complete information yet, but it should give you some pointers at least.

## Install docker

https://docs.docker.com/engine/install/raspberry-pi-os/#install-using-the-repository

## Using GPIO modules?

http://wiringpi.com/download-and-install/

## Starting CIMonitor on a display (optional)

```shell
sudo vim /etc/xdg/lxsession/LXDE-pi/autostart
```

and insert the contents:

```
@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --kiosk https://ci.example.com
```

you might also want to hide the mouse, install unclutter:

```shell
sudo apt install unclutter
```

## Running module client

Create a CIMonitor folder on your PI:

```shell
mkdir ~/CIMonitor;
cd ~/CIMonitor;
```

## Create module config

Create a `~/CIMonitor/storage/modules.json`:

```json
{
"triggers": [
{
"status": {
"state": "success",
"branch": "master"
},
"event": "celebrate"
},
{
"status": {
"state": "success",
"branch": "main"
},
"event": "celebrate"
},
{
"status": {
"state": "success",
"branch": "production"
},
"event": "celebrate"
}
],
"events": [
{
"name": "celebrate",
"modules": [
{
"type": "gpio",
"pin": 7,
"mode": "on-for",
"duration": 10000
}
]
}
]
}
```

## Start docker container

There, run the CIMonitor module client:

```shell
docker run \
--privileged \
--detach \
--restart unless-stopped \
--name CIMonitorClient \
--volume $(pwd)/storage:/CIMonitor/storage \
--volume /usr/bin/gpio:/usr/bin/gpio \
--volume /lib/libwiringPiDev.so:/lib/libwiringPiDev.so \
--volume /lib/libwiringPi.so:/lib/libwiringPi.so \
--volume /dev/mem:/dev/mem \
--volume /dev/gpiomem:/dev/gpiomem \
--env CIMONITOR_SERVER_URL="https://ci.example.com" \
cimonitor/module-client:latest-arm
```
Loading