9 Commits
0.0.3 ... main

Author SHA1 Message Date
5a25204f2f new database
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2025-01-09 14:31:39 +01:00
52b414f60f use matest in local env
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-12-02 13:11:54 +01:00
3fc83eefe6 logging
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-02 11:48:24 +01:00
a58959a316 counter fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-02 10:59:29 +01:00
2c21ab00a0 counter fix
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline failed
2024-12-02 10:31:11 +01:00
d66483cdf3 minimize debug output
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-02 10:26:55 +01:00
ecceb5baa3 mqtt cred
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-02 10:19:58 +01:00
c505c525f8 fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-02 09:55:54 +01:00
3595bf251d fix
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-12-02 09:53:05 +01:00
6 changed files with 14 additions and 15 deletions

View File

@ -1,6 +1,7 @@
{
"mqtt": {
"broker": "mqtt://emqx01-anonymous-cluster-internal.broker.svc.cluster.local:1883",
"username": "archiver",
"tlsEnable": "false"
},
"includeTopics": [

View File

@ -22,7 +22,9 @@ spec:
imagePullPolicy: Always
envFrom:
- secretRef:
name: ma-db-cred
name: ma-db-cred
- secretRef:
name: ma-mqtt-cred
- configMapRef:
name: ma-conf
name: ma-conf

View File

@ -13,12 +13,10 @@ pushd $DEPLOYMENT_DIR
NAMESPACE=`cat namespace`
./roll-db-credentials.sh
kubectl create configmap ma-conf \
--from-literal=MA_CONF="`cat config.json`" \
--dry-run=client \
--o yaml \
-o yaml \
--save-config | \
kubectl apply -f - -n $NAMESPACE

View File

@ -1,16 +1,13 @@
#!/bin/bash
export PGUSER=`kubectl get secret -n database timescaledb -o jsonpath="{.data.superuser-username}" | base64 --decode`
export PGHOST=`kubectl get services traefik -n system -o jsonpath="{.status.loadBalancer.ingress[0].ip}"`
export PGPASSWORD=`kubectl get secret -n database timescaledb -o jsonpath="{.data.superuser-password}" | base64 --decode`
export PGSSLMODE=require
. ~/Workspace/mykubernetesenv/ENVDB1
DATABASE=ma
LOGIN=ma
PASSWORD=`openssl rand -base64 24`
NAMESPACE=`cat namespace`
psql <<EOF
do
\$\$
@ -32,7 +29,7 @@ kubectl create secret generic ma-db-cred \
--from-literal=PGUSER="$LOGIN" \
--from-literal=PGPASSWORD="$PASSWORD" \
--from-literal=PGDATABASE="$DATABASE" \
--from-literal=PGHOST="timescaledb.database.svc.cluster.local" \
--from-literal=PGHOST="database.database1.svc.cluster.local" \
--from-literal=PGSSLMODE="require" | \
kubectl apply -f - -n $NAMESPACE

View File

@ -7,7 +7,7 @@ import "time"
//import "net/url"
import "ma/mqtt"
//import "ma/config"
import "ma/counter"
//import "ma/counter"
import "ma/database"
var dbh *database.DatabaseHandle
@ -29,8 +29,7 @@ func InputArchiver() {
}
func handleMessage(message database.Message) {
log.Printf("Archiving Timestamp: %s, Topic: %s, Payload: %s", message.Time, message.Topic, message.Payload)
// log.Printf("Archiving Timestamp: %s, Topic: %s, Payload: %s", message.Time, message.Topic, message.Payload)
dbh.StoreMessage(&message)
counter.S("Stored")
}

View File

@ -122,7 +122,9 @@ func StartMqttClient() {
if token := mqttClient.Connect(); token.Wait() && token.Error() != nil {
log.Fatalf("Unable to connect to broker %s, error %s", broker, token.Error())
}
//log.Printf("Successfully connected to broker %s", broker)
log.Printf("Successfully connected to broker %s", broker)
log.Printf("Include topics: %s", config.Config.IncludeTopics)
log.Printf("Exclude topics: %s", config.Config.ExcludeTopics)
go outputDispatcher(mqttClient)