Skip to content

Commit 98a2402

Browse files
committed
πŸ‘±πŸ»β€β™€οΈ Cindy: iJUG's homebrewn event dispatcher β˜•
1 parent 5b2db8b commit 98a2402

File tree

10 files changed

+575
-242
lines changed

10 files changed

+575
-242
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
# πŸ‘±πŸ»β€β™€οΈ Monika: The iJUG's homebrewn Infrastructure Monitor
1+
# πŸ‘±πŸ»β€β™€οΈ Cindy: iJUG's homebrewn event dispatcher β˜•
22

3-
*Monika* is a Java-implemented RESTful Web Service serving as an agent for Uptime Kuma to read the local disk's free space.
4-
5-
6-
## Use
7-
8-
* Disk Free: `/monika/status` responds status `100` on hardware failures, status `901` if volume has less than 20% free, status `2XX` in all other cases (where `XX` is the lowest free value in %). The status text contains the smallest free percentage of all monitored volumes. Example: `260 Smallest free volume is 60 %.`
9-
* Health Check: `/monika/health` responds status 204 always.
3+
*Cindy* is a Java-implemented RESTful Web Service for collecting events in [iCalender](https://www.rfc-editor.org/rfc/rfc5545.txt) format and publishing them on a Mastodon instance.
104

115

126
## Administrate
137

14-
* `docker logs monika` - Contains one entry for each monitored path per `/status` request, like:
15-
```
16-
/home is 60 % free
17-
/var is 75 % free
18-
```
8+
* `docker logs cindy` - Contains (at least) one entry for each processed event.
199

2010

2111
## Deploy
2212

23-
* `docker run --name monika -d -e MONITORED_PATHS=/home:/var -e IP_PORT=8123 -P ghcr.io/ijug-ev/monika`: Monika will listen to requests on port 8123 and monitor paths `/home` and `/var`.
24-
- `MONITORED_PATH`: Monika will monitor each path in this list. The default is `/`, i. e. only the root file system is monitored.
25-
- `IP_PORT`: Monika will listen to this IP port. The default is `8080`.
13+
* `docker run --name cindy -d -e CINDY_IP_PORT=7231 -e ... -P ghcr.io/ijug-ev/cindy`: Cindy will listen to requests on port 7231.
14+
- `CINDY_IP_PORT`: Cindy will listen to this IP port. The default is `8080`.
15+
- `CINDY_MASTODON_HOST`: Cindy will publish events on this Mastodon host. There is no default.
16+
- `CINDY_MASTODON_ACCESS_TOKEN`: Cindy uses this access token to log in to the Mastodon host. There is no default.
17+
- `CINDY_LAST_RUN_FILE`: Cindy rembembers the instant when it last pulled calenders, so it understands which calender events are new/modified, and which are old. The default is `lastRun`
18+
- `CINDY_POLLING_SECONDS`: Time between two calendar polls. The default frequency is one minute, i. e. `60`.
19+
- `CINDY_CALENDAR_SOURCES`: Comma-separated list of download URLs of calendars to poll. There is no default.
2620

2721

2822
## Build
@@ -33,7 +27,7 @@
3327
mvn clean package
3428
cp src/main/docker/Dockerfile target
3529
pushd ./target
36-
docker build -t monika .
30+
docker build -t cindy .
3731
popd
38-
docker run -it --rm -P monika
32+
docker run -it --rm -P cindy
3933
```

β€Žbuildβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
mvn clean package
33
cp src/main/docker/Dockerfile target
44
pushd ./target
5-
docker build -t monika .
5+
docker build -t cindy .
66
popd
7-
docker run -it --rm -P -e OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED=True -e OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf -e OTEL_EXPORTER_OTLP_ENDPOINT=https://grafana.ijug.eu:8080/otlp -e OTEL_SERVICE_NAME=Monika -e OTEL_METRIC_EXPORT_INTERVAL=15000 -e OTEL_METRICS_EXPORTER=otlp -e OTEL_LOGS_EXPORTER=none -e OTEL_TRACES_EXPORTER=none monika
7+
docker run -it --rm -P cindy
88

β€Žpom.xmlβ€Ž

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>eu.headcrashing.eclipsecon.lightweightmicroservices</groupId>
7-
<artifactId>monika</artifactId>
6+
<groupId>eu.ijug.services</groupId>
7+
<artifactId>cindy</artifactId>
88
<version>1.0-SNAPSHOT</version>
99

1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<maven.compiler.release>21</maven.compiler.release>
1313
<jaxrs.version>3.1.0</jaxrs.version>
14-
<jersey.version>3.1.9</jersey.version>
15-
<otelsdk.version>1.43.0</otelsdk.version>
14+
<jersey.version>3.1.10</jersey.version>
15+
<ical4j.version>4.1.0</ical4j.version>
16+
<bigbone.version>2.0.0-SNAPSHOT</bigbone.version>
1617
</properties>
1718

1819
<dependencyManagement>
@@ -24,14 +25,6 @@
2425
<type>pom</type>
2526
<scope>import</scope>
2627
</dependency>
27-
28-
<dependency>
29-
<groupId>io.opentelemetry</groupId>
30-
<artifactId>opentelemetry-bom</artifactId>
31-
<version>${otelsdk.version}</version>
32-
<type>pom</type>
33-
<scope>import</scope>
34-
</dependency>
3528
</dependencies>
3629
</dependencyManagement>
3730

@@ -61,58 +54,70 @@
6154
</dependency>
6255

6356
<dependency>
64-
<groupId>io.opentelemetry</groupId>
65-
<artifactId>opentelemetry-api</artifactId>
66-
</dependency>
67-
68-
<dependency>
69-
<groupId>io.opentelemetry</groupId>
70-
<artifactId>opentelemetry-exporter-otlp</artifactId>
71-
</dependency>
72-
73-
<dependency>
74-
<groupId>io.opentelemetry</groupId>
75-
<artifactId>opentelemetry-exporter-logging</artifactId>
57+
<groupId>org.mnode.ical4j</groupId>
58+
<artifactId>ical4j</artifactId>
59+
<version>${ical4j.version}</version>
7660
</dependency>
7761

7862
<dependency>
79-
<groupId>io.opentelemetry</groupId>
80-
<artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
63+
<groupId>social.bigbone</groupId>
64+
<artifactId>bigbone</artifactId>
65+
<version>${bigbone.version}</version>
8166
</dependency>
8267
</dependencies>
8368

69+
<repositories>
70+
<repository>
71+
<id>maven-central-snapshots</id>
72+
<name>Maven Central Snapshot Repository</name>
73+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
74+
<releases>
75+
<enabled>false</enabled>
76+
</releases>
77+
<snapshots>
78+
<enabled>true</enabled>
79+
</snapshots>
80+
</repository>
81+
</repositories>
82+
8483
<build>
8584
<plugins>
8685
<plugin>
8786
<artifactId>maven-compiler-plugin</artifactId>
88-
<version>3.11.0</version>
87+
<version>3.13.0</version>
8988
</plugin>
9089

9190
<plugin>
9291
<groupId>org.codehaus.mojo</groupId>
9392
<artifactId>exec-maven-plugin</artifactId>
94-
<version>3.1.0</version>
93+
<version>3.5.0</version>
9594
<configuration>
96-
<mainClass>MonikaBootstrap</mainClass>
95+
<mainClass>CindyBootstrap</mainClass>
96+
<systemProperties>
97+
<systemProperty>
98+
<key>java.util.logging.SimpleFormatter.format</key>
99+
<value>[%1$tF %1$tT.%1$tL] [%4$s] %5$s%n</value>
100+
</systemProperty>
101+
</systemProperties>
97102
</configuration>
98103
</plugin>
99104

100105
<plugin>
101106
<artifactId>maven-jar-plugin</artifactId>
102-
<version>3.3.0</version>
107+
<version>3.4.2</version>
103108
<configuration>
104109
<archive>
105110
<manifest>
106111
<addClasspath>true</addClasspath>
107-
<mainClass>MonikaBootstrap</mainClass>
112+
<mainClass>CindyBootstrap</mainClass>
108113
</manifest>
109114
</archive>
110115
</configuration>
111116
</plugin>
112117

113118
<plugin>
114119
<artifactId>maven-shade-plugin</artifactId>
115-
<version>3.5.1</version>
120+
<version>3.6.0</version>
116121
<executions>
117122
<execution>
118123
<phase>package</phase>
@@ -147,7 +152,7 @@
147152
</excludes>
148153
</filter>
149154
<filter>
150-
<artifact>io.opentelemetry:*</artifact>
155+
<artifact>*:ical4j</artifact>
151156
<includes>
152157
<include>**/*</include>
153158
</includes>
@@ -156,7 +161,7 @@
156161
<transformers>
157162
<transformer
158163
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
159-
<mainClass>MonikaBootstrap</mainClass>
164+
<mainClass>CindyBootstrap</mainClass>
160165
<manifestEntries>
161166
<Multi-Release>true</Multi-Release>
162167
</manifestEntries>
@@ -170,4 +175,4 @@
170175
</plugin>
171176
</plugins>
172177
</build>
173-
</project>
178+
</project>

β€Žsrc/main/docker/Dockerfileβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM gcr.io/distroless/java21-debian12:nonroot
2-
COPY monika-1.0-SNAPSHOT.jar /home
3-
RUN [ "java", "-XX:ArchiveClassesAtExit=monika.jsa", "-jar", "/home/monika-1.0-SNAPSHOT.jar", "--stop" ]
4-
RUN [ "java", "-XX:ArchiveClassesAtExit=healthcheck.jsa", "-jar", "/home/monika-1.0-SNAPSHOT.jar", "--check-health", "--ignore-errors" ]
2+
COPY cindy-1.0-SNAPSHOT.jar /home
3+
RUN [ "java", "-Djava.util.logging.SimpleFormatter.format=[%1$tF %1$tT.%1$tL] [%4$s] %5$s%n", "-XX:ArchiveClassesAtExit=cindy.jsa", "-jar", "/home/cindy-1.0-SNAPSHOT.jar", "--stop" ]
4+
RUN [ "java", "-Djava.util.logging.SimpleFormatter.format=[%1$tF %1$tT.%1$tL] [%4$s] %5$s%n", "-XX:ArchiveClassesAtExit=healthcheck.jsa", "-jar", "/home/cindy-1.0-SNAPSHOT.jar", "--check-health", "--ignore-errors" ]
55
EXPOSE 8080
6-
ENTRYPOINT [ "java", "-XX:SharedArchiveFile=monika.jsa", "-jar", "/home/monika-1.0-SNAPSHOT.jar" ]
7-
HEALTHCHECK CMD [ "java", "-XX:SharedArchiveFile=healthcheck.jsa", "-jar", "/home/monika-1.0-SNAPSHOT.jar", "--check-health" ]
6+
ENTRYPOINT [ "java", "-Djava.util.logging.SimpleFormatter.format=[%1$tF %1$tT.%1$tL] [%4$s] %5$s%n", "-XX:SharedArchiveFile=cindy.jsa", "-jar", "/home/cindy-1.0-SNAPSHOT.jar" ]
7+
HEALTHCHECK CMD [ "java", "-Djava.util.logging.SimpleFormatter.format=[%1$tF %1$tT.%1$tL] [%4$s] %5$s%n", "-XX:SharedArchiveFile=healthcheck.jsa", "-jar", "/home/cindy-1.0-SNAPSHOT.jar", "--check-health" ]

0 commit comments

Comments
Β (0)