Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
3fc83eefe6
|
|||
a58959a316
|
|||
2c21ab00a0
|
|||
d66483cdf3
|
|||
ecceb5baa3
|
|||
c505c525f8
|
|||
3595bf251d
|
|||
1f078aa2a2
|
|||
490bbb2ded
|
@ -4,7 +4,7 @@ PGHOST=`kubectl get services traefik -n system -o jsonpath="{.status.loadBalance
|
|||||||
PGPASSWORD=`kubectl get secrets ma-db-cred -n $N -o jsonpath="{.data.PGPASSWORD}" | base64 --decode`
|
PGPASSWORD=`kubectl get secrets ma-db-cred -n $N -o jsonpath="{.data.PGPASSWORD}" | base64 --decode`
|
||||||
PGUSER=`kubectl get secrets ma-db-cred -n $N -o jsonpath="{.data.PGUSER}" | base64 --decode`
|
PGUSER=`kubectl get secrets ma-db-cred -n $N -o jsonpath="{.data.PGUSER}" | base64 --decode`
|
||||||
PGSSLMODE=`kubectl get secrets ma-db-cred -n $N -o jsonpath="{.data.PGSSLMODE}" | base64 --decode`
|
PGSSLMODE=`kubectl get secrets ma-db-cred -n $N -o jsonpath="{.data.PGSSLMODE}" | base64 --decode`
|
||||||
PGDATABASE="matest"
|
PGDATABASE="ma"
|
||||||
export PGUSER PGHOST PGPASSWORD PGSSLMODE PGDATABASE
|
export PGUSER PGHOST PGPASSWORD PGSSLMODE PGDATABASE
|
||||||
|
|
||||||
MA_CONF=`cat config-test.json`
|
MA_CONF=`cat config-test.json`
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"mqtt": {
|
"mqtt": {
|
||||||
"broker": "mqtt://emqx01-anonymous-cluster-internal.broker.svc.cluster.local:1883",
|
"broker": "mqtt://emqx01-anonymous-cluster-internal.broker.svc.cluster.local:1883",
|
||||||
|
"username": "archiver",
|
||||||
"tlsEnable": "false"
|
"tlsEnable": "false"
|
||||||
},
|
},
|
||||||
"includeTopics": [
|
"includeTopics": [
|
||||||
|
@ -22,7 +22,9 @@ spec:
|
|||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: ma-db-cred
|
name: ma-db-cred
|
||||||
|
- secretRef:
|
||||||
|
name: ma-mqtt-cred
|
||||||
- configMapRef:
|
- configMapRef:
|
||||||
name: ma-conf
|
name: ma-conf
|
||||||
|
|
||||||
|
@ -3,21 +3,20 @@
|
|||||||
|
|
||||||
|
|
||||||
ARG1=$1
|
ARG1=$1
|
||||||
NAMESPACE=`cat namespace`
|
|
||||||
IMAGE_NAME=$FORGE_NAME/$CI_REPO
|
IMAGE_NAME=$FORGE_NAME/$CI_REPO
|
||||||
|
|
||||||
DEPLOYMENT_DIR=$PWD/deployment
|
DEPLOYMENT_DIR=$PWD/deployment
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pushd $DEPLOYMENT_DIR > /dev/null
|
pushd $DEPLOYMENT_DIR
|
||||||
|
|
||||||
./roll-db-credential.sh
|
NAMESPACE=`cat namespace`
|
||||||
|
|
||||||
kubectl create configmap ma-conf \
|
kubectl create configmap ma-conf \
|
||||||
--from-literal=MA_CONF="`cat config.json`" \
|
--from-literal=MA_CONF="`cat config.json`" \
|
||||||
--dry-run=client \
|
--dry-run=client \
|
||||||
--o yaml \
|
-o yaml \
|
||||||
--save-config | \
|
--save-config | \
|
||||||
kubectl apply -f - -n $NAMESPACE
|
kubectl apply -f - -n $NAMESPACE
|
||||||
|
|
||||||
@ -26,4 +25,4 @@ cat deploy-yml.tmpl | \
|
|||||||
kubectl apply -f - -n $NAMESPACE
|
kubectl apply -f - -n $NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
popd /dev/null
|
popd
|
||||||
|
@ -11,6 +11,7 @@ LOGIN=ma
|
|||||||
PASSWORD=`openssl rand -base64 24`
|
PASSWORD=`openssl rand -base64 24`
|
||||||
NAMESPACE=`cat namespace`
|
NAMESPACE=`cat namespace`
|
||||||
|
|
||||||
|
|
||||||
psql <<EOF
|
psql <<EOF
|
||||||
do
|
do
|
||||||
\$\$
|
\$\$
|
@ -7,7 +7,7 @@ import "time"
|
|||||||
//import "net/url"
|
//import "net/url"
|
||||||
import "ma/mqtt"
|
import "ma/mqtt"
|
||||||
//import "ma/config"
|
//import "ma/config"
|
||||||
import "ma/counter"
|
//import "ma/counter"
|
||||||
import "ma/database"
|
import "ma/database"
|
||||||
|
|
||||||
var dbh *database.DatabaseHandle
|
var dbh *database.DatabaseHandle
|
||||||
@ -29,8 +29,7 @@ func InputArchiver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleMessage(message database.Message) {
|
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)
|
dbh.StoreMessage(&message)
|
||||||
counter.S("Stored")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,9 @@ func StartMqttClient() {
|
|||||||
if token := mqttClient.Connect(); token.Wait() && token.Error() != nil {
|
if token := mqttClient.Connect(); token.Wait() && token.Error() != nil {
|
||||||
log.Fatalf("Unable to connect to broker %s, error %s", broker, token.Error())
|
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)
|
go outputDispatcher(mqttClient)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user